Miva Empresa/Mia/Script Compiler v5.24 Release Notes ---------------------------------------------------- Bugs Fixed ---------- 3x configuration loading now correctly tracks line numbers in the configuration and the auth configuration files. 5599: Compiler: Compiler ignores variable names containing spaces 8969: Builtins: crypto: crypto_last_error does not always accurately report OpenSSL error messages 9734: Virtual Machine: autoincrement of uninitialized structure member in a tags throw an error inside an tag 20983: Packaging: Add AddTrust External CA Root certificate to trusted certificates 21012: Builtins: system: Add miva_setprocessname builtin 21026: Compiler: MvINCLUDE with INTERPRET = "off" on an empty file returns an incorrect compiler error 21035: Builtins: system: Add a miva_struct_merge and miva_struct_merge_ref builtin 21038: Builtins: system: Add a miva_csv_encode builtin 21104: Builtins: archive: tar_create should not fail on files it cannot read 21219: Virtual Machine: Functions that take an "index" parameter need to check for and reject negative indexes 21220: Builtins: file: Race condition in _bi_file_write when creating a new file 21291: Builtins: system: Add a miva_html_strip builtin 21292: Builtins: system: Add a miva_cdata_encode builtin 21320: Virtual Machine: Lock files are not touched during miva_sleep (or miva_async_sleep) 21431: Virtual Machine: EncodeJavaScriptString mistakenly escapes underscore characters 21462: Builtins: string: Add a indexofl and indexofli builtin 21512: Virtual Machine: MvCALL should be able to receive a certificate directly from a variable 21764: Compiler: Nested MvASYNCHRONOUS gives correct error, but additional incorrect error 21765: Builtins: system: Add a miva_array_filter and miva_array_filter_ref builtin 21818: Builtins: math: Add a miva_ieee754_normalize builtin 21842: Compiler: Combination of MvASSIGNARRAY & MvREFERENCEARRAY tags generate invalid assembler code 21854: PostgreSQL: Add support for PostgreSQL 21858: Virtual Machine: It should not be possible to create system variables through MivaScript 21859: Virtual Machine: All non special system variables should be ImmutableVariables 21876: MivaSQL: MivaSQL COUNT function returns an empty string when 0 records exist 21917: Compiler: Compiling a file that includes a recursive MvINCLUDE causes a SEGFAULT 22094: Virtual Machine: s.process_id and s.thread_id values should be consistent across platforms 22107: Miva Mia: Mia icon is "Miva 3" logo 22178: IIS Integration: IIS7 configuration schema file is incorrectly named, or documentation is incorrect New Builtin Functions --------------------- - miva_setprocessname( name ) Set the process name (where possible) and alters the s.process_name variable. Parameters: - name - Text to set the process name to. Return Value: - None. - miva_async_sleep( until, semfile, semlocation ) Sleep until the "until" time, or the modified time on the file described by semfile and semlocation is changed. Parameters: - until - time_t (seconds since 1-JAN-1970) set in the future, the time to sleep until. - semfile - file name to watch. - semlocation - location of the file to watch. "script" or "data", defaulting to "data" if any other value. - miva_csv_encode( text, delimiter ) Takes a string of text and a delimiter, and returns a string with appropriately doubled quotes or escaped delimiters, suitable for including in a CSV record. Parameters: - text - String to escape - delimiter - separation character (for example, a "," for a comma-separated list). Returns: - An appropriately escaped or quoted string, or a copy of the original string if no quotes or delimiters were found. - miva_html_strip( text, allowed_tags ) Remove HTML tags from a given string. Parameters: - text - String to remove HTML tags from. - allowed_tags - A comma-separated list of tags that will not be stripped from the string. Return value: Text with all HTML tags except those listed in allowed_tags removed. - miva_cdata_encode( text ) Create one or more CDATA tags with the provided text, splitting any data with "]]>" into two CDATA tags with "]]" at the end of one CDATA tag, and ">" as the first value of the next CDATA tag. Parameters: - text - String to encode Return value: Text quoted within one or more CDATA tags. - file_touch( file, location ) Updates the modification time of the specified file. Parameters: - file - File name. - location - File location. "script" or "data", defaulting to "data" if any other value. Return value: 0 on success, -1 on failure. - miva_struct_merge( source var, dest var ) Copy the structure members from source into dest, if the member does not exist in dest. See also miva_struct_merge_ref. Parameters: - source - Structure to copy into dest. - dest - Destination structure. Return value: None. - miva_struct_merge_ref( source var, dest var ) Make references of the structure members from source in dest, if the member does not exist in dest. Similar to miva_struct_merge, but makes references into original structure rather than copies. Parameters: - source - Structure to copy into dest. - dest - Destination structure. Return value: None. - indexofl( needle, haystack var, offset ) Search from the end of the haystack for needle, starting at the offset position. Parameters: - needle var - Value to search for. - haystack var - Text to search. - offset - integer offset to start at. Return value: Index of found value, or 0 if not found. - indexofli( needle, haystack var, offset ) Search without regard to case from the end of the haystack for needle, starting at the offset position. Parameters: - needle var - Value to search for. - haystack var - Text to search. - offset - integer offset to start at. Return value: Index of found value, or 0 if not found. - miva_array_filter( array var, offset, element var, filter_expression, output var ) Iterate through an array starting at a given offset, execute a filter expression against each element, and copy the member to a new output array. See also miva_array_filter_ref. Parameters: - array var - Source array of structures. - offset - index in the array to start filtering from. - element var - Name of a variable to reference in the filter expression. - filter_expression - Text of an expression to execute based on the individual array element. - output var - Output array of all structures that tested true in the filter expression. Return value: Count of output array elements. - miva_array_filter_ref( array var, offset, element var, filter_expression, output var ) Iterate through an array starting at a given offset, execute a filter expression against each element, and create a new member with references to the members in the output array. See also miva_array_filter. Parameters: - array var - Source array of structures. - offset - index in the array to start filtering from. - element var - Name of a variable to reference in the filter expression. - filter_expression - Text of an expression to execute based on the individual array element. - output var - Output array of all structures that tested true in the filter expression. Return value: Count of output array elements. - miva_ieee754_normalize( significant_digits, value ) Normalize the value to IEEE 754 specifications, to the given number of significant digits. Parameters: - significant_digits - Number of digits to normalize the value to. - value - Floating point value to normalize. Return value: The normalized value to the specified significant digits - rsa_load_publickey_engine( engine, key_id, rsa var ) Load an encryption key based on a key id. Parameters: - engine - Name of the encryption engine to use. - key_id - identifier of the key to load - rsa - RSA public key associated with the engine and key ID. Return value: - 1 on success, 0 on failure. - rsa_load_privatekey_engine( engine, key_id, rsa var ) Load an encryption key based on a key id. Parameters: - engine - Name of the encryption engine to use. - key_id - identifier of the key to load - rsa - RSA private key associated with the engine and key ID. Return value: - 1 on success, 0 on failure. - crypto_rand_set_rand_engine( engine ) Specify the random number generating engine to use. Parameters: - engine - Name of the random number generator engine to use. Return value: - 1 on success, 0 on failure. API Changes ----------- New Flags --------- MVF_MODE_EXISTING - Used in mvFile_Open "mode" parameter. Open an existing file, or return an error if the file does not exist. New API Functions ----------------- mvLinkBuffer_Concat_String_Nocopy Takes the passed string for concatenation, and assigns ownership of the string to the LinkBuffer (i.e., do not call mvProgram_Free on the memory). Parameters: - mvLinkBuffer linkbuffer: A previously allocated mvLinkBuffer. - const char *buffer: The data string to add to the end of the LinkBuffer string. - int buffer_length: The length of the passed-in data pointer. - int buffer_size: The allocated size of the passed-in data pointer. Return Value: None mvLinkBuffer_Concat_Int Takes the passed integer for concatenation to the end of the LinkBuffer. Parameters: - mvLinkBuffer linkbuffer: A previously allocated mvLinkBuffer. - int value: The integer value to to add the text representation of to the end of the LinkBuffer string. Return Value: None mvLinkBuffer_Concat_Double Takes the passed double for concatenation to the end of the LinkBuffer. Parameters: - mvLinkBuffer linkbuffer: A previously allocated mvLinkBuffer. - double value: The double value to to add the text representation of to the end of the LinkBuffer string. Return Value: None mvLinkBuffer_Concat_Variable Takes the passed mvVariable for concatenation to the end of the LinkBuffer. Parameters: - mvLinkBuffer linkbuffer: A previously allocated mvLinkBuffer. - mvVariable value: The mvVariable to append the value of to the end of the LinkBuffer string. Return Value: None mvProgram_SetProcessName Set the process name (on platforms that this is supported) and s.process_name to the given text. Parameters - mvProgram program: The current MivaVM. - const char *name: Text to set the process name to. - int name_length: Length of the text to set the process name to. Return Value: None mvFile_NormalizePath Return a normalized path respecting the passed location and that locations configured properties concerning following symbolic links, etc. Parameters - mvProgram program: The current MivaVM. - int location: Location of the file (one of MVF_SCRIPT, MVF_DATA, or MVF_COMMERCE, defined in mivapi.h). - const char *path: Path to normalize. - int *normalized_length: If not NULL, the address of an integer to put the length of the resulting normalized path into. - int *normalized_size: If not NULL, the address of an integer to put the allocated size of the resulting normalized path into. Return Value: char * to the normalized path. PostgreSQL ---------- A PostgreSQL connector is now available. FastCGI ------- A FastCGI implementation of the Miva Virtual Machine is now available. Language Changes ---------------- o MvCALL now accepts the CERTVALUE attribute, to allow inclusion of a certificate directly in the code, as opposed to being the contents of a file pointed to by the CERTFILE attribute. o MvASYNCHRONOUS Code within a and block will start to execute in a separate asynchronous task, and the task will exit when the block is reached. All output, even via , is discarded from the asynchronous task. Asynchronous tasks can not be started from within an asynchronous task. The number of asynchronous tasks allowed, the timeout time for an asynchronous task, and an absolute timeout for miva_async_sleep are all configurable. o New s.miva_config members: ssl_config - The location of the OpenSSL .cnf file. max_async_tasks - Maximum allowed asynchronous tasks (0 = unlimited) timeout_async - Timeout in seconds for an asynchronous task. timeout_async_sleep - Timeout in seconds for miva_async_sleep (if the semaphore file is not modified). o MvINCLUDE now takes the "INTERPRET" attribute. 'INTERPRET = "OFF"' will include the text of the included file as a literal, without interpreting or compiling html or Miva Script tags. 'INTERPRET = "ON"', the default if the attribute is omitted, will parse and compile the included file as before. o A new system variable s.thread_id exists. This will be unique across asynchronous tasks, and may or may not be the same value as the s.process_id. Configuration Changes --------------------- New configuration settings: Location of the OpenSSL .cnf file (type=text) MvCONFIG_SSL_CONFIG (env) openssl_config (3x) Maximum allowed asynchronous tasks (0 = unlimited) (type=numeric) MvCONFIG_MAX_ASYNCHRONOUS_TASKS (env) asynctimeout (3x) Timeout in seconds for miva_async_sleep (if the semaphore file is not modified). (type=numeric) MvCONFIG_TIMEOUT_ASYNCHRONOUS_SLEEP (env) asyncsleeptimeout (3x) Timeout in seconds for asynchronous tasks (0 = unlimited) (type=numeric) MvCONFIG_TIMEOUT_ASYNCHRONOUS (env) asynctimeout (3x)