#!/usr/bin/env bash

if [[ -z "$1" ]]
then
	echo "usage $0 [all|<checknumber>]"
	exit 7
fi

source ./migration_fn.sh
if [[ "all" = "$1" ]]
then
	for i in $(seq 1 60)
	do
		$0 "$i"
	done
	exit
fi

(( 1 == $1 )) && (
	export QUICKFIX=/tmp/check1.qf
	echo "Running check number # 1 "
	header "Backward Incompatible Changes"
	info "Although not explicitly stated in this section, every new function, class, interface, enum, or constant may cause a redeclaration Error to be thrown. https://www.php.net/manual/en/migration84.new-functions.php"
	grep_fn_def \
		request_parse_body \
		bcceil \
		bcdivmod \
		bcfloor \
		bcround \
		intltz_get_iana_id \
		grapheme_str_split \
		opcache_jit_blacklist \
		mb_trim \
		mb_ltrim \
		mb_rtrim \
		mb_ucfirst \
		mb_lcfirst \
		pcntl_getcpu \
		pcntl_getcpuaffinity \
		pcntl_getqos_class \
		pcntl_setns \
		pcntl_waitid \
		pg_change_password \
		pg_jit \
		pg_put_copy_data \
		pg_put_copy_end \
		pg_result_memory_size \
		pg_set_chunked_rows_size \
		pg_socket_poll \
		http_get_last_response_headers \
		http_clear_last_response_headers \
		fpow \
		array_all \
		array_any \
		array_find \
		array_find_key
)

(( 2 == $1 )) && (
	export QUICKFIX=/tmp/check2.qf
	echo "Running check number # 2 "
	info "exit() behavioral change"
	info "The exit() (and die()) language constructs now behave more like a function. This means that they can now be passed like callables, are affected by the strict_types declare statement, and now perform the usual type coercions instead of casting any non-integer value to a string."
	note "Query matches exit and die calls with one or more arguments, check type coersion there."
	grep_tree "(exit_statement (_)+) @exit"
	grep_tree "(
		(function_call_expression function: (name) @name arguments: (arguments (argument)+))
		(#eq? @name \"die\")
	)"
)

(( 3 == $1 )) && (
	export QUICKFIX=/tmp/check3.qf
	echo "Running check number # 3 "
	info "The PHP_DEBUG and PHP_ZTS constants are now of type bool. Previously they were of type int."
	grep_constant PHP_DEBUG PHP_ZTS
)

(( 4 == $1 )) && (
	export QUICKFIX=/tmp/check4.qf
	echo "Running check number # 4 "
	info "The name of uploaded files and files created by the tempnam() function are now 13 bytes longer. The total length is still platform-dependent."
	grep_fn_call tempnam
)

(( 5 == $1 )) && (
	export QUICKFIX=/tmp/check5.qf
	echo "Running check number # 5 "
	info "Removal of E_STRICT error level"
	info "The E_STRICT error level has been removed, as it was no longer in use within the PHP engine. The E_STRICT constant has been deprecated."
	grep_constant E_STRICT
)

(( 6 == $1 )) && (
	export QUICKFIX=/tmp/check6.qf
	echo "Running check number # 6 "
	info "Several resources have been migrated to objects. Return value checks using is_resource() should be replaced with checks for false, unless specified otherwise."
	grep_fn_call is_resource
)

(( 7 == $1 )) && (
	export QUICKFIX=/tmp/check7.qf
	echo "Running check number # 7 "
	info "DBA, ODBC, SOAP check if relevant (likely not)"
	info "The DBA functions now accept and return Dba\Connection objects instead of dba_connection resources.
	The ODBC functions now accept and return Odbc\Result objects instead of odbc_result resources.
	The ODBC functions now accept and return Odbc\Connection objects instead of odbc_connection resources.
	The SoapClient::\$httpurl property is now a Soap\Url object rather than a soap_url resource. Checks using is_resource() (i.e. is_resource(\$client->httpurl)) should be replaced with checks for null (i.e. \$client->httpurl !== null).
	The SoapClient::\$sdl property is now a Soap\Sdl object rather than a soap_sdl resource. Checks using is_resource() (i.e. is_resource(\$client->sdl)) should be replaced with checks for null (i.e. \$client->sdl !== null)."
	greplike_fn_call odcb_
	greplike_fn_call dba_
	greplike_constant Soap
)

(( 8 == $1 )) && (
	export QUICKFIX=/tmp/check8.qf
	echo "Running check number # 8 "
	header "Backward Incompatible Changes: New warnings and exceptions"
	info "curl_multi_select() now throws a ValueError if the timeout parameter is less than 0 or greater than PHP_INT_MAX."
	grep_fn_call curl_multi_select
)

(( 9 == $1 )) && (
	export QUICKFIX=/tmp/check9.qf
	echo "Running check number # 9 "
	info "GD: imagejpeg(), imagewebp(), imagepng(), imageavif() now throw a ValueError when an invalid quality is passed. imageavif() will now throw a ValueError if an invalid speed parameter value is passed. imagescale() will now throw a ValueError if the width or height parameters underflows/overflows. imagescale() will now throw a ValueError if an invalid mode parameter value is passed. imagefilter() will now throw a ValueError with the IMG_FILTER_SCATTER filter if the sub or plus parameters underflows/overflows."
	grep_fn_call \
		imagejpeg \
		imagewebp \
		imagepng \
		imageavif \
		imagescale \
		imagefilter \
		imagefilter
)

(( 10 == $1 )) && (
	export QUICKFIX=/tmp/check10.qf
	echo "Running check number # 10 "
	info "bind_textdomain_codeset(), textdomain(), d()*gettext() now throw a ValueError if domain is the empty string."
	grep_fn_call bind_textdomain_codeset textdomain
)

(( 11 == $1 )) && (
	export QUICKFIX=/tmp/check11.qf
	echo "Running check number # 11 "
	info "resourcebundle_get(), ResourceBundle::get(), and accessing offsets on a ResourceBundle object now throw:"
	info "IntlDateFormatter::__construct() throws a ValueError if the locale is invalid."
	info "NumberFormatter::__construct() throws a ValueError if the locale is invalid."
	grep_fn_call resourcebundle_get
	grep_constant ResourceBundle IntlDateFormatter NumberFormatter
)

(( 12 == $1 )) && (
	export QUICKFIX=/tmp/check12.qf
	echo "Running check number # 12 "
	info "mb_encode_numericentity() and mb_decode_numericentity() now check that the map is only composed of ints, if not a ValueError is now thrown."
	info "mb_http_input() now always throw a ValueError if type is invalid."
	info "mb_http_output() now check that the encoding does not contain any null bytes, if it does a ValueError is now thrown."
	grep_fn_call mb_encode_numericentity mb_decode_numericentity mb_http_input mb_http_output
)

(( 14 == $1 )) && (
	export QUICKFIX=/tmp/check14.qf
	echo "Running check number # 14 "
	info "odbc_fetch_row() returns false when row is less than or equal to 0. A warning is now emitted in this case."
	grep_fn_call odbc_fetch_row
)

(( 15 == $1 )) && (
	export QUICKFIX=/tmp/check15.qf
	echo "Running check number # 15 "
	info "The pcntl_sigprocmask(), pcntl_sigwaitinfo(), and pcntl_sigtimedwait() functions now always return false on failure. In some case previously it could return the value -1."
	grep_fn_call \
		pcntl_sigprocmask \
		pcntl_sigwaitinfo \
		pcntl_sigtimedwait
)

(( 16 == $1 )) && (
	export QUICKFIX=/tmp/check16.qf
	echo "Running check number # 16 "
	info "Calling simplexml_import_dom() with a non-XML object now throws a TypeError instead of a ValueError."
	grep_fn_call simplexml_import_dom
)

(( 18 == $1 )) && (
	export QUICKFIX=/tmp/check18.qf
	echo "Running check number # 18 "
	info "XMLReader: Passing an invalid character encoding to XMLReader::open() or XMLReader::XML() now throws a ValueError. Passing a string containing null bytes previously emitted a warning and now throws a ValueError."
	grep_constant XMLReader
)

(( 20 == $1 )) && (
	export QUICKFIX=/tmp/check20.qf
	echo "Running check number # 20 "
	info "XMLWriter: Passing a string containing null bytes previously emitted a warning and now throws a ValueError."
	grep_constant XMLWriter
)

(( 21 == $1 )) && (
	export QUICKFIX=/tmp/check21.qf
	echo "Running check number # 21 "
	info "Calling XSLTProcessor::importStyleSheet() with a non-XML object now throws a TypeError instead of a ValueError. Failure to call a PHP function callback during evaluation now throws instead of emitting a warning."
	grep_constant XSLTProcessor
)

(( 22 == $1 )) && (
	export QUICKFIX=/tmp/check22.qf
	echo "Running check number # 22 "
	info "Previously, DOMXPath objects could be cloned, but resulted in an unusable object. This is no longer possible, and cloning a DOMXPath object now throws an Error. The DOMImplementation::getFeature() method has been removed."
	grep_constant DOMImplementation DOMXPath
)

(( 23 == $1 )) && (
	export QUICKFIX=/tmp/check23.qf
	echo "Running check number # 23 "
	info "The GMP class is now final and cannot be extended anymore."
	note "Query finds occurences of extended GMP"
	grep_tree "(class_declaration (base_clause) @base (#match? @base \"extends.*GMP\"))"
)

(( 24 == $1 )) && (
	export QUICKFIX=/tmp/check24.qf
	echo "Running check number # 24 "
	info "On invalid strings (those with encoding errors), mb_substr() now interprets character indices in the same manner as most other mbstring functions. This means that character indices returned by mb_strpos() can be passed to mb_substr()."
	info "For SJIS-Mac (MacJapanese) strings, character indices passed to mb_substr() now refer to the indices of the Unicode codepoints which are produced when the string is converted to Unicode. This is significant because around 40 SJIS-Mac characters convert to a sequence of multiple Unicode codepoints."
	grep_fn_call mb_substr
)

(( 25 == $1 )) && (
	export QUICKFIX=/tmp/check25.qf
	echo "Running check number # 25 "
	info "The bundled pcre2lib has been updated to version 10.44. As a consequence, this means {,3} is now recognized as a quantifier instead of as text. Furthermore, the meaning of some character classes in UCP mode has changed. Consult the » PCRE2 Changelog for a full changelog."
	info "Look for any dynamic input and correct it, pulling up all PCRE function invocations that accept pattern:"
	grep_fn_call \
		preg_split \
		preg_replace_callback_array \
		preg_replace_callback \
		preg_replace \
		preg_match_all \
		preg_match \
		preg_grep \
		preg_filter
)

(( 26 == $1 )) && (
	export QUICKFIX=/tmp/check26.qf
	echo "Running check number # 26 "
	info "stream_bucket_make_writeable() and stream_bucket_new() will now return a StreamBucket instance instead of an instance of stdClass."
	grep_fn_call stream_bucket_make_writeable stream_bucket_new
)

(( 27 == $1 )) && (
	export QUICKFIX=/tmp/check27.qf
	echo "Running check number # 27 "
	info "Passing non-callable strings to the xml_set_()* functions is now deprecated."
	greplike_fn_call xml_set_
)

(( 28 == $1 )) && (
	export QUICKFIX=/tmp/check28.qf
	echo "Running check number # 28 "
	header "Deprecated features"
	info "Implicitly nullable parameter."
	info "A parameter's type is implicitly widened to accept null if the default value for it is null."
	note "Query captures named type parameters having default value null (excludes nullable types) and union type parameters not having \"null\" in union and having default value null. Has very few false positives, no false negatives."
	grep_tree "
	; Capture named type parameters having default value null (excludes nullable types).
	(simple_parameter
		type: (named_type)
		name: (variable_name)
		default_value: (null)) @res1
	; Capture union type parameters not having \"null\" in union and having default value null.
	(simple_parameter
		type: (union_type (primitive_type) @union)
		name: (variable_name)
		default_value: (null)
		(#not-eq? @union \"null\")) @res2
	; For primitive type.
	(simple_parameter
		type: (primitive_type)
		name: (variable_name)
		default_value: (null)) @res3
	"
)

(( 29 == $1 )) && (
	export QUICKFIX=/tmp/check29.qf
	echo "Running check number # 29 "
	info "Raising zero to the power of negative number"
	info "Raising a number to the power of a negative number is equivalent to taking the reciprocal of the number raised to the positive opposite of the power. That is, 10-2 is the same as 1 / 102. Therefore raising 0 to the power of a negative number corresponds to dividing by 0, i.e. 0-2 is the same as 1 / 02, or 1 / 0. Thus, this behavior has been deprecated."
	note "Capture right side if not positive integer in \"**\" and second argument of pow function if it may be negative."
	grep_tree "
	; Capture right side if not positive integer
	(binary_expression operator: \"**\"
		right: [
			(variable_name) (function_call_expression) (name)
			(parenthesized_expression) (unary_op_expression)
			(_ (string_content))
		]
	) @res1
	; Captures second argument of pow function if it may be negative.
	(function_call_expression
		function: (name) @res2
		arguments: (arguments (_)
			(argument [
			(variable_name) (function_call_expression) (name)
			(parenthesized_expression) (unary_op_expression)
			(_ (string_content))
		])
		(#eq? @res2 \"pow\")))
	; If zero is raised to power.
	(function_call_expression
		function: (name) @res3
		arguments: (arguments (_ (integer) @int)
		(#eq? @res3 \"pow\")
		(#eq? @int \"0\")))
	"
)

(( 30 == $1 )) && (
	export QUICKFIX=/tmp/check30.qf
	echo "Running check number # 30 "
	info "Using underscore _ as class name"
	info "Naming a class _ is now deprecated"
	note "Query captures declared classes of name _."
	grep_tree "((class_declaration name: (name) @class) (#eq? @class \"_\"))"
)

(( 31 == $1 )) && (
	export QUICKFIX=/tmp/check31.qf
	echo "Running check number # 31 "
	info "Using trigger_error() with E_USER_ERROR"
	info "Calling trigger_error() with error_level being equal to E_USER_ERROR is now deprecated."
	note "Query captures trigger_error function calls with such 2nd argument."
	grep_tree "
	; Captures trigger_error function calls with such 2nd argument.
	(function_call_expression
		function: (name) @name
		arguments: (arguments (_) (_) @flags
		(#eq? @name \"trigger_error\")
		(#match? @flags \"E_USER_ERROR\")
		))
	"
)

(( 32 == $1 )) && (
	export QUICKFIX=/tmp/check32.qf
	echo "Running check number # 32 "
	info "The E_STRICT constant"
	info "the E_STRICT error level was removed, this constant is now deprecated."
	grep_constant E_STRICT
)

(( 33 == $1 )) && (
	export QUICKFIX=/tmp/check33.qf
	echo "Running check number # 33 "
	info "The CURLOPT_BINARYTRANSFER error level was removed, this constant is now deprecated."
	grep_constant CURLOPT_BINARYTRANSFER
)

(( 34 == $1 )) && (
	export QUICKFIX=/tmp/check34.qf
	echo "Running check number # 34 "
	info "The DatePeriod::__construct(string \$isostr, int \$options = 0) signature has been deprecated. Use DatePeriod::createFromISO8601String() instead."
	grep_constant DatePeriod SUNFUNCS_RET_TIMESTAMP SUNFUNCS_RET_STRING SUNFUNCS_RET_DOUBLE
)

(( 35 == $1 )) && (
	export QUICKFIX=/tmp/check35.qf
	echo "Running check number # 35 "
	info "Passing null or false to dba_key_split() is now deprecated. It would always return false in those cases."
	grep_fn_call dba_key_split
)

(( 36 == $1 )) && (
	export QUICKFIX=/tmp/check36.qf
	echo "Running check number # 36 "
	info "The DOM_PHP_ERR constant is now deprecated."
	grep_constant DOM_PHP_ERR
)

(( 37 == $1 )) && (
	export QUICKFIX=/tmp/check37.qf
	echo "Running check number # 37 "
	info "Passing invalid options to hash functions is now deprecated."
	note "Query captures hash function calls having 4th positional argument (options)."
	grep_tree "
	(function_call_expression
		function: (name) @name
		arguments: (arguments (_) (_) (_) (_))
		(#eq? @name \"hash\"))
	"
)

(( 38 == $1 )) && (
	export QUICKFIX=/tmp/check38.qf
	echo "Running check number # 38 "
	info "Calling intlcal_set() or IntlCalendar::set() with more than two arguments is deprecated. Use either IntlCalendar::setDate() or IntlCalendar::setDateTime() instead."
	grep_fn_call intlcal_set
	grep_constant IntlCalendar
)

(( 39 == $1 )) && (
	export QUICKFIX=/tmp/check39.qf
	echo "Running check number # 39 "
	info "Calling ldap_connect() with more than two arguments is deprecated. Use ldap_connect_wallet() instead."
	note "Query captures ldap_connect calls with 2 or more arguments."
	grep_tree "(function_call_expression function: (name) @name arguments: (arguments (_) (_)+) (#eq? @name \"ldap_connect\"))"
	note "Query captures ldap_exop calls with 5 or more arguments."
	grep_tree "(function_call_expression function: (name) @name arguments: (arguments (_) (_) (_) (_) (_)+) (#eq? @name \"ldap_exop\"))"
)

(( 40 == $1 )) && (
	export QUICKFIX=/tmp/check40.qf
	echo "Running check number # 40 "
	info "The mysqli_ping() function and mysqli::ping() method are now deprecated as the reconnect feature was removed in PHP 8.2.0."
	info "The mysqli_kill() function and mysqli::kill() method are now deprecated. If this functionality is needed a SQL KILL command can be used instead."
	info "The mysqli_refresh() function and mysqli::refresh() method are now deprecated. If this functionality is needed a SQL FLUSH command can be used instead. All MYSQLI_REFRESH_* constants have been deprecated as well."
	info "Passing the mode parameter to mysqli_store_result() explicitly has been deprecated. As the MYSQLI_STORE_RESULT_COPY_DATA constant was only used in conjunction with this function it has also been deprecated."
	grep_fn_call mysqli_ping mysqli_kill mysqli_refresh mysqli_store_result
)

(( 41 == $1 )) && (
	export QUICKFIX=/tmp/check41.qf
	echo "Running check number # 41 "
	info "The 2 arguments signature of pg_fetch_result(), pg_field_prtlen(), and pg_field_is_null() is now deprecated. Use the 3 arguments signature with row set to null instead."
	grep_fn_call_2args pg_fetch_result pg_field_prtlen pg_field_is_null
)

(( 42 == $1 )) && (
	export QUICKFIX=/tmp/check42.qf
	echo "Running check number # 42 "
	info "lcg_value() is now deprecated, as the function is broken in multiple ways. Use Random\Randomizer::getFloat() instead."
	grep_fn_call lcg_value
)

(( 43 == $1 )) && (
	export QUICKFIX=/tmp/check43.qf
	echo "Running check number # 43 "
	info "Calling ReflectionMethod::__construct() with one arguments is deprecated. Use ReflectionMethod::createFromMethodName() instead."
	grep_constant ReflectionMethod
)

(( 44 == $1 )) && (
	export QUICKFIX=/tmp/check44.qf
	echo "Running check number # 44 "
	info "Calling session_set_save_handler() with more than two arguments is deprecated. Use the two arguments signature instead."
	note "Query finds function calls of name session_set_save_handler with thre or more arguments"
	grep_tree "(function_call_expression function: (name) @name arguments: (arguments (_) (_) (_)+) (#eq? @name \"session_set_save_handler\"))"
)

(( 45 == $1 )) && (
	export QUICKFIX=/tmp/check45.qf
	echo "Running check number # 45 "
	info "The SplFixedArray::__wakeup() method is now deprecated, as it implements SplFixedArray::__serialize() and SplFixedArray::__unserialize() which need to be overwritten instead."
	info "Using the default value for the escape parameter for the SplFileObject::setCsvControl(), SplFileObject::fputcsv(), and SplFileObject::fgetcsv() is now deprecated. It must be passed explicitly either positionally or via named arguments. This does not apply to SplFileObject::fputcsv() and SplFileObject::fgetcsv() if SplFileObject::setCsvControl() was used to set a new default value."
	grep_constant SplFixedArray SplFileObject
)

(( 46 == $1 )) && (
	export QUICKFIX=/tmp/check46.qf
	echo "Running check number # 46 "
	info "Calling stream_context_set_option() with two arguments is deprecated. Use stream_context_set_options() instead."
	grep_fn_call_2args stream_context_set_option
)

(( 47 == $1 )) && (
	export QUICKFIX=/tmp/check47.qf
	echo "Running check number # 47 "
	info "Unserializing strings using the uppercase S tag with unserialize() is deprecated."
	grep_fn_call unserialize
)

(( 48 == $1 )) && (
	export QUICKFIX=/tmp/check48.qf
	echo "Running check number # 48 "
	info "Using the default value for the escape parameter for the fputcsv(), fgetcsv(), and str_getcsv() is now deprecated. It must be passed explicitly either positionally or via named arguments."
	grep_fn_call fputcsv fgetcsv str_getcsv
)

(( 49 == $1 )) && (
	export QUICKFIX=/tmp/check49.qf
	echo "Running check number # 49 "
	info "The xml_set_object() function has been deprecated."
	grep_fn_call xml_set_object
)

(( 50 == $1 )) && (
	export QUICKFIX=/tmp/check50.qf
	echo "Running check number # 50 "
	header "Removed extensions"
	info "PSpell extension is removed - https://www.php.net/manual/en/book.pspell.php"
	greplike_fn_call pspell_
	greplike_constant PSPEL
)

(( 51 == $1 )) && (
	export QUICKFIX=/tmp/check51.qf
	echo "Running check number # 51 "
	info "IMAP extension is removed"
	greplike_fn_call imap_
)

(( 52 == $1 )) && (
	export QUICKFIX=/tmp/check52.qf
	echo "Running check number # 52 "
	header "New Global Constants"
	grep_constant \
		PHP_OUTPUT_HANDLER_PROCESSED \
		PHP_SBINDIR \
		CURL_HTTP_VERSION_3 \
		CURL_HTTP_VERSION_3ONLY \
		CURL_TCP_KEEPCNT \
		CURLOPT_PREREQFUNCTION \
		CURL_PREREQFUNC_OK \
		CURL_PREREQFUNC_ABORT \
		CURLOPT_SERVER_RESPONSE_TIMEOUT \
		CURLOPT_DEBUGFUNCTION \
		CURLINFO_TEXT \
		CURLINFO_HEADER_IN \
		CURLINFO_DATA_IN \
		CURLINFO_DATA_OUT \
		CURLINFO_SSL_DATA_OUT \
		CURLINFO_SSL_DATA_IN \
		CURLINFO_POSTTRANSFER_TIME_T \
		PATTERN \
		PROPERTY_IDS_UNARY_OPERATOR \
		PROPERTY_ID_COMPAT_MATH_START \
		PROPERTY_ID_COMPAT_MATH_CONTINUE \
		LDAP_OPT_X_TLS_PROTOCOL_MAX \
		LDAP_OPT_X_TLS_PROTOCOL_TLS1_3 \
		LIBXML_RECOVER \
		LIBXML_NO_XXE \
		LIBXML_NOENT \
		MYSQLI_TYPE_VECTOR \
		X509_PURPOSE_OCSP_HELPER \
		X509_PURPOSE_TIMESTAMP_SIGN \
		SIGCKPT \
		SIGCKPTEXIT \
		WEXITED \
		WSTOPPED \
		WNOWAIT \
		P_ALL \
		P_PID \
		P_PGID \
		P_PIDFD \
		P_UID \
		P_GID \
		P_SID \
		P_JAILID \
		PGSQL_TUPLES_CHUNK \
		POSIX_SC_CHILD_MAX \
		POSIX_SC_CLK_TCK \
		SO_EXCLUSIVEADDRUSE \
		SOCK_CONN_DGRAM \
		SOCK_DCCP \
		TCP_SYNCNT \
		SO_EXCLBIND \
		SO_NOSIGPIPE \
		SO_LINGER_SEC \
		IP_PORTRANGE \
		IP_PORTRANGE_DEFAULT \
		IP_PORTRANGE_HIGH \
		IP_PORTRANGE_LOW \
		SOCK_NONBLOCK \
		SOCK_CLOEXEC \
		SO_BINDTOIFINDEX \
		SODIUM_CRYPTO_AEAD_AEGIS128L_KEYBYTES \
		SODIUM_CRYPTO_AEAD_AEGIS128L_NSECBYTES \
		SODIUM_CRYPTO_AEAD_AEGIS128L_NPUBBYTES \
		SODIUM_CRYPTO_AEAD_AEGIS128L_ABYTES \
		SODIUM_CRYPTO_AEAD_AEGIS256_KEYBYTES \
		SODIUM_CRYPTO_AEAD_AEGIS256_NSECBYTES \
		SODIUM_CRYPTO_AEAD_AEGIS256_NPUBBYTES \
		SODIUM_CRYPTO_AEAD_AEGIS256_ABYTES \
		T_PUBLIC_SET \
		T_PROTECTED_SET \
		T_PRIVATE_SET \
		XML_OPTION_PARSE_HUGE
)

(( 53 == $1 )) && (
	export QUICKFIX=/tmp/check53.qf
	echo "Running check number # 53 "
	info "When using strcspn() with characters being the empty string, the length of the string is now returned instead of incorrectly stopping at the first null byte."
	grep_fn_call strcspn
)

(( 54 == $1 )) && (
	export QUICKFIX=/tmp/check54.qf
	echo "Running check number # 54 "
	info "The round() function now validates the value of the mode and throw a ValueError for invalid modes. Previously, invalid modes would have been interpreted as PHP_ROUND_HALF_UP."
	grep_fn_call_3args round
)

(( 55 == $1 )) && (
	export QUICKFIX=/tmp/check55.qf
	echo "Running check number # 55 "
	info "The str_getcsv() now throws ValueErrors when the separator and enclosure arguments are not one byte long, or if the escape argument is not one byte long nor the empty string. This aligns the behaviour to be identical to the one of fputcsv() and fgetcsv()."
	grep_fn_call str_getcsv
)

(( 56 == $1 )) && (
	export QUICKFIX=/tmp/check56.qf
	echo "Running check number # 56 "
	info "The php_uname() function now throws a ValueError if the mode is invalid."
	grep_fn_call php_uname
)

(( 57 == $1 )) && (
	export QUICKFIX=/tmp/check57.qf
	echo "Running check number # 57 "
	info "The \"allowed_classes\" option for unserialize() now throws TypeErrors and ValueErrors if it is not an array of class names."
	grep_fn_call_2args unserialize
)

(( 58 == $1 )) && (
	export QUICKFIX=/tmp/check58.qf
	echo "Running check number # 58 "
	info "PCTNTL has many changes. Consult migration84.incompatible if this query has matches. Likely no process forking is used."
	greplike_fn_call pcntl_
)

(( 60 == $1 )) && (
	export QUICKFIX=/tmp/check60.qf
	echo "Running check number # 60 "
	info "odbc_fetch_row() returns false when row is less than or equal to 0. A warning is now emitted in this case."
	grep_fn_call odbc_fetch_row
)
