diff --git a/.travis.yml b/.travis.yml index 2ea2baf70c229..27d36be5a7429 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,6 +16,7 @@ addons: - libsasl2-dev - libxpm-dev - libt1-dev + - libzip-dev notifications: email: diff --git a/INSTALL b/INSTALL index 958035fd60d4e..d2f4f42a99830 100644 --- a/INSTALL +++ b/INSTALL @@ -1,1916 +1,3 @@ - __________________________________________________________________ +For installation of PHP, please refer to the online documentation available at: -Installing PHP - __________________________________________________________________ - - * General Installation Considerations - * Installation on Unix systems - + Apache 2.x on Unix systems - + Lighttpd 1.4 on Unix systems - + Sun, iPlanet and Netscape servers on Sun Solaris - + CGI and command line setups - + HP-UX specific installation notes - + OpenBSD installation notes - + Solaris specific installation tips - + Debian GNU/Linux installation notes - * Installation on Mac OS X - + Using Packages - + Using the bundled PHP - + Compiling PHP on Mac OS X - * Installation of PECL extensions - + Introduction to PECL Installations - + Downloading PECL extensions - + Installing a PHP extension on Windows - + Compiling shared PECL extensions with the pecl command - + Compiling shared PECL extensions with phpize - + php-config - + Compiling PECL extensions statically into PHP - * Problems? - + Read the FAQ - + Other problems - + Bug reports - * Runtime Configuration - + The configuration file - + .user.ini files - + Where a configuration setting may be set - + How to change configuration settings - * Installation - __________________________________________________________________ - - __________________________________________________________________ - -Preface - - These installation instructions were generated from the HTML version of - the PHP Manual so formatting and linking have been altered. See the - online and updated version at: http://php.net/install.unix - __________________________________________________________________ - -General Installation Considerations - - Before starting the installation, first you need to know what do you - want to use PHP for. There are three main fields you can use PHP, as - described in the What can PHP do? section: - * Websites and web applications (server-side scripting) - * Command line scripting - * Desktop (GUI) applications - - For the first and most common form, you need three things: PHP itself, - a web server and a web browser. You probably already have a web - browser, and depending on your operating system setup, you may also - have a web server (e.g. Apache on Linux and MacOS X; IIS on Windows). - You may also rent webspace at a company. This way, you don't need to - set up anything on your own, only write your PHP scripts, upload it to - the server you rent, and see the results in your browser. - - In case of setting up the server and PHP on your own, you have two - choices for the method of connecting PHP to the server. For many - servers PHP has a direct module interface (also called SAPI). These - servers include Apache, Microsoft Internet Information Server, Netscape - and iPlanet servers. Many other servers have support for ISAPI, the - Microsoft module interface (OmniHTTPd for example). If PHP has no - module support for your web server, you can always use it as a CGI or - FastCGI processor. This means you set up your server to use the CGI - executable of PHP to process all PHP file requests on the server. - - If you are also interested to use PHP for command line scripting (e.g. - write scripts autogenerating some images for you offline, or processing - text files depending on some arguments you pass to them), you always - need the command line executable. For more information, read the - section about writing command line PHP applications. In this case, you - need no server and no browser. - - With PHP you can also write desktop GUI applications using the PHP-GTK - extension. This is a completely different approach than writing web - pages, as you do not output any HTML, but manage windows and objects - within them. For more information about PHP-GTK, please » visit the - site dedicated to this extension. PHP-GTK is not included in the - official PHP distribution. - - From now on, this section deals with setting up PHP for web servers on - Unix and Windows with server module interfaces and CGI executables. You - will also find information on the command line executable in the - following sections. - - PHP source code and binary distributions for Windows can be found at - » http://www.php.net/downloads.php. We recommend you to choose a - » mirror nearest to you for downloading the distributions. - __________________________________________________________________ - __________________________________________________________________ - -Installation on Unix systems - -Table of Contents - - * Apache 2.x on Unix systems - * Lighttpd 1.4 on Unix systems - * Sun, iPlanet and Netscape servers on Sun Solaris - * CGI and command line setups - * HP-UX specific installation notes - * OpenBSD installation notes - * Solaris specific installation tips - * Debian GNU/Linux installation notes - - This section will guide you through the general configuration and - installation of PHP on Unix systems. Be sure to investigate any - sections specific to your platform or web server before you begin the - process. - - As our manual outlines in the General Installation Considerations - section, we are mainly dealing with web centric setups of PHP in this - section, although we will cover setting up PHP for command line usage - as well. - - There are several ways to install PHP for the Unix platform, either - with a compile and configure process, or through various pre-packaged - methods. This documentation is mainly focused around the process of - compiling and configuring PHP. Many Unix like systems have some sort of - package installation system. This can assist in setting up a standard - configuration, but if you need to have a different set of features - (such as a secure server, or a different database driver), you may need - to build PHP and/or your web server. If you are unfamiliar with - building and compiling your own software, it is worth checking to see - whether somebody has already built a packaged version of PHP with the - features you need. - - Prerequisite knowledge and software for compiling: - * Basic Unix skills (being able to operate "make" and a C compiler) - * An ANSI C compiler - * A web server - * Any module specific components (such as GD, PDF libs, etc.) - - When building directly from Git sources or after custom modifications - you might also need: - * autoconf: 2.13+ (for PHP < 5.4.0), 2.59+ (for PHP >= 5.4.0) - * automake: 1.4+ - * libtool: 1.4.x+ (except 1.4.2) - * re2c: Version 0.13.4 or newer - * flex: Version 2.5.4 (for PHP <= 5.2) - * bison: Version 1.28 (preferred), 1.35, or 1.75 - - The initial PHP setup and configuration process is controlled by the - use of the command line options of the configure script. You could get - a list of all available options along with short explanations running - ./configure --help. Our manual documents the different options - separately. You will find the core options in the appendix, while the - different extension specific options are described on the reference - pages. - - When PHP is configured, you are ready to build the module and/or - executables. The command make should take care of this. If it fails and - you can't figure out why, see the Problems section. - __________________________________________________________________ - -Apache 2.x on Unix systems - - This section contains notes and hints specific to Apache 2.x installs - of PHP on Unix systems. - Warning - - We do not recommend using a threaded MPM in production with Apache 2. - Use the prefork MPM, which is the default MPM with Apache 2.0 and 2.2. - For information on why, read the related FAQ entry on using Apache2 - with a threaded MPM - - The » Apache Documentation is the most authoritative source of - information on the Apache 2.x server. More information about - installation options for Apache may be found there. - - The most recent version of Apache HTTP Server may be obtained from - » Apache download site, and a fitting PHP version from the above - mentioned places. This quick guide covers only the basics to get - started with Apache 2.x and PHP. For more information read the » Apache - Documentation. The version numbers have been omitted here, to ensure - the instructions are not incorrect. In the examples below, 'NN' should - be replaced with the specific version of Apache being used. - - There are currently two versions of Apache 2.x - there's 2.0 and 2.2. - While there are various reasons for choosing each, 2.2 is the current - latest version, and the one that is recommended, if that option is - available to you. However, the instructions here will work for either - 2.0 or 2.2. - 1. Obtain the Apache HTTP server from the location listed above, and - unpack it: -gzip -d httpd-2_x_NN.tar.gz -tar -xf httpd-2_x_NN.tar - - 2. Likewise, obtain and unpack the PHP source: -gunzip php-NN.tar.gz -tar -xf php-NN.tar - - 3. Build and install Apache. Consult the Apache install documentation - for more details on building Apache. -cd httpd-2_x_NN -./configure --enable-so -make -make install - - 4. Now you have Apache 2.x.NN available under /usr/local/apache2, - configured with loadable module support and the standard MPM - prefork. To test the installation use your normal procedure for - starting the Apache server, e.g.: -/usr/local/apache2/bin/apachectl start - - and stop the server to go on with the configuration for PHP: -/usr/local/apache2/bin/apachectl stop - - 5. Now, configure and build PHP. This is where you customize PHP with - various options, like which extensions will be enabled. Run - ./configure --help for a list of available options. In our example - we'll do a simple configure with Apache 2 and MySQL support. - If you built Apache from source, as described above, the below - example will match your path for apxs, but if you installed Apache - some other way, you'll need to adjust the path to apxs accordingly. - Note that some distros may rename apxs to apxs2. -cd ../php-NN -./configure --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql -make -make install - - If you decide to change your configure options after installation, - you'll need to re-run the configure, make, and make install steps. - You only need to restart apache for the new module to take effect. - A recompile of Apache is not needed. - Note that unless told otherwise, 'make install' will also install - PEAR, various PHP tools such as phpize, install the PHP CLI, and - more. - 6. Setup your php.ini -cp php.ini-development /usr/local/lib/php.ini - - You may edit your .ini file to set PHP options. If you prefer - having php.ini in another location, use - --with-config-file-path=/some/path in step 5. - If you instead choose php.ini-production, be certain to read the - list of changes within, as they affect how PHP behaves. - 7. Edit your httpd.conf to load the PHP module. The path on the right - hand side of the LoadModule statement must point to the path of the - PHP module on your system. The make install from above may have - already added this for you, but be sure to check. -LoadModule php7_module modules/libphp7.so - 8. Tell Apache to parse certain extensions as PHP. For example, let's - have Apache parse .php files as PHP. Instead of only using the - Apache AddType directive, we want to avoid potentially dangerous - uploads and created files such as exploit.php.jpg from being - executed as PHP. Using this example, you could have any - extension(s) parse as PHP by simply adding them. We'll add .php to - demonstrate. - - SetHandler application/x-httpd-php - - Or, if we wanted to allow .php, .php2, .php3, .php4, .php5, .php7, - and .phtml files to be executed as PHP, but nothing else, we'd use - this: - - SetHandler application/x-httpd-php - - And to allow .phps files to be handled by the php source filter, - and displayed as syntax-highlighted source code, use this: - - SetHandler application/x-httpd-php-source - - mod_rewrite may be used To allow any arbitrary .php file to be - displayed as syntax-highlighted source code, without having to - rename or copy it to a .phps file: -RewriteEngine On -RewriteRule (.*\.php)s$ $1 [H=application/x-httpd-php-source] - The php source filter should not be enabled on production systems, - where it may expose confidential or otherwise sensitive information - embedded in source code. - 9. Use your normal procedure for starting the Apache server, e.g.: -/usr/local/apache2/bin/apachectl start - - OR -service httpd restart - - Following the steps above you will have a running Apache2 web server - with support for PHP as a SAPI module. Of course there are many more - configuration options available Apache and PHP. For more information - type ./configure --help in the corresponding source tree. - - Apache may be built multithreaded by selecting the worker MPM, rather - than the standard prefork MPM, when Apache is built. This is done by - adding the following option to the argument passed to ./configure, in - step 3 above: - --with-mpm=worker - - This should not be undertaken without being aware of the consequences - of this decision, and having at least a fair understanding of the - implications. The Apache documentation regarding » MPM-Modules - discusses MPMs in a great deal more detail. - - Note: - - The Apache MultiViews FAQ discusses using multiviews with PHP. - - Note: - - To build a multithreaded version of Apache, the target system must - support threads. In this case, PHP should also be built with - experimental Zend Thread Safety (ZTS). Under this configuration, not - all extensions will be available. The recommended setup is to build - Apache with the default prefork MPM-Module. - __________________________________________________________________ - __________________________________________________________________ - -Lighttpd 1.4 on Unix systems - - This section contains notes and hints specific to Lighttpd 1.4 installs - of PHP on Unix systems. - - Please use the » Lighttpd trac to learn how to install Lighttpd - properly before continuing. - - Fastcgi is the preferred SAPI to connect PHP and Lighttpd. Fastcgi is - automagically enabled in php-cgi in PHP 5.3, but for older versions - configure PHP with --enable-fastcgi. To confirm that PHP has fastcgi - enabled, php -v should contain PHP 5.2.5 (cgi-fcgi) Before PHP 5.2.3, - fastcgi was enabled on the php binary (there was no php-cgi). - -Letting Lighttpd spawn php processes - - To configure Lighttpd to connect to php and spawn fastcgi processes, - edit lighttpd.conf. Sockets are preferred to connect to fastcgi - processes on the local system. - - Example #1 Partial lighttpd.conf -server.modules += ( "mod_fastcgi" ) - -fastcgi.server = ( ".php" => - (( - "socket" => "/tmp/php.socket", - "bin-path" => "/usr/local/bin/php-cgi", - "bin-environment" => ( - "PHP_FCGI_CHILDREN" => "16", - "PHP_FCGI_MAX_REQUESTS" => "10000" - ), - "min-procs" => 1, - "max-procs" => 1, - "idle-timeout" => 20 - )) -) - - The bin-path directive allows lighttpd to spawn fastcgi processes - dynamically. PHP will spawn children according to the PHP_FCGI_CHILDREN - environment variable. The "bin-environment" directive sets the - environment for the spawned processes. PHP will kill a child process - after the number of requests specified by PHP_FCGI_MAX_REQUESTS is - reached. The directives "min-procs" and "max-procs" should generally be - avoided with PHP. PHP manages its own children and opcode caches like - APC will only share among children managed by PHP. If "min-procs" is - set to something greater than 1, the total number of php responders - will be multiplied PHP_FCGI_CHILDREN (2 min-procs * 16 children gives - 32 responders). - -Spawning with spawn-fcgi - - Lighttpd provides a program called spawn-fcgi to ease the process of - spawning fastcgi processes easier. - -Spawning php-cgi - - It is possible to spawn processes without spawn-fcgi, though a bit of - heavy-lifting is required. Setting the PHP_FCGI_CHILDREN environment - var controls how many children PHP will spawn to handle incoming - requests. Setting PHP_FCGI_MAX_REQUESTS will determine how long (in - requests) each child will live. Here's a simple bash script to help - spawn php responders. - - Example #2 Spawning FastCGI Responders -#!/bin/sh - -# Location of the php-cgi binary -PHP=/usr/local/bin/php-cgi - -# PID File location -PHP_PID=/tmp/php.pid - -# Binding to an address -#FCGI_BIND_ADDRESS=10.0.1.1:10000 -# Binding to a domain socket -FCGI_BIND_ADDRESS=/tmp/php.sock - -PHP_FCGI_CHILDREN=16 -PHP_FCGI_MAX_REQUESTS=10000 - -env -i PHP_FCGI_CHILDREN=$PHP_FCGI_CHILDREN \ - PHP_FCGI_MAX_REQUESTS=$PHP_FCGI_MAX_REQUESTS \ - $PHP -b $FCGI_BIND_ADDRESS & - -echo $! > "$PHP_PID" - - -Connecting to remote FCGI instances - - Fastcgi instances can be spawned on multiple remote machines in order - to scale applications. - - Example #3 Connecting to remote php-fastcgi instances -fastcgi.server = ( ".php" => - (( "host" => "10.0.0.2", "port" => 1030 ), - ( "host" => "10.0.0.3", "port" => 1030 )) -) - __________________________________________________________________ - __________________________________________________________________ - -Sun, iPlanet and Netscape servers on Sun Solaris - - This section contains notes and hints specific to Sun Java System Web - Server, Sun ONE Web Server, iPlanet and Netscape server installs of PHP - on Sun Solaris. - - From PHP 4.3.3 on you can use PHP scripts with the NSAPI module to - generate custom directory listings and error pages. Additional - functions for Apache compatibility are also available. For support in - current web servers read the note about subrequests. - - You can find more information about setting up PHP for the Netscape - Enterprise Server (NES) here: - » http://benoit.noss.free.fr/php/install-php4.html - - To build PHP with Sun JSWS/Sun ONE WS/iPlanet/Netscape web servers, - enter the proper install directory for the --with-nsapi=[DIR] option. - The default directory is usually /opt/netscape/suitespot/. Please also - read /php-xxx-version/sapi/nsapi/nsapi-readme.txt. - - 1. Install the following packages from » http://www.sunfreeware.com/ - or another download site: - + autoconf-2.13 - + automake-1.4 - + bison-1_25-sol26-sparc-local - + flex-2_5_4a-sol26-sparc-local - + gcc-2_95_2-sol26-sparc-local - + gzip-1.2.4-sol26-sparc-local - + m4-1_4-sol26-sparc-local - + make-3_76_1-sol26-sparc-local - + mysql-3.23.24-beta (if you want mysql support) - + perl-5_005_03-sol26-sparc-local - + tar-1.13 (GNU tar) - 2. Make sure your path includes the proper directories - PATH=.:/usr/local/bin:/usr/sbin:/usr/bin:/usr/ccs/bin and make it - available to your system export PATH. - 3. gunzip php-x.x.x.tar.gz (if you have a .gz dist, otherwise go to - 4). - 4. tar xvf php-x.x.x.tar - 5. Change to your extracted PHP directory: cd ../php-x.x.x - 6. For the following step, make sure /opt/netscape/suitespot/ is where - your netscape server is installed. Otherwise, change to the correct - path and run: -./configure --with-mysql=/usr/local/mysql \ ---with-nsapi=/opt/netscape/suitespot/ \ ---enable-libgcc - 7. Run make followed by make install. - - After performing the base install and reading the appropriate readme - file, you may need to perform some additional configuration steps. - -Configuration Instructions for Sun/iPlanet/Netscape - - Firstly you may need to add some paths to the LD_LIBRARY_PATH - environment for the server to find all the shared libs. This can best - done in the start script for your web server. The start script is often - located in: /path/to/server/https-servername/start. You may also need - to edit the configuration files that are located in: - /path/to/server/https-servername/config/. - 1. Add the following line to mime.types (you can do that by the - administration server): -type=magnus-internal/x-httpd-php exts=php - - 2. Edit magnus.conf (for servers >= 6) or obj.conf (for servers < 6) - and add the following, shlib will vary depending on your system, it - will be something like /opt/netscape/suitespot/bin/libphp4.so. You - should place the following lines after mime types init. -Init fn="load-modules" funcs="php4_init,php4_execute,php4_auth_trans" shlib="/op -t/netscape/suitespot/bin/libphp4.so" -Init fn="php4_init" LateInit="yes" errorString="Failed to initialize PHP!" [php_ -ini="/path/to/php.ini"] - - (PHP >= 4.3.3) The php_ini parameter is optional but with it you - can place your php.ini in your web server config directory. - 3. Configure the default object in obj.conf (for virtual server - classes [version 6.0+] in their vserver.obj.conf): - -. -. -. -.#NOTE this next line should happen after all 'ObjectType' and before all 'AddLo -g' lines -Service fn="php4_execute" type="magnus-internal/x-httpd-php" [inikey=value inike -y=value ...] -. -. - - - (PHP >= 4.3.3) As additional parameters you can add some special - php.ini-values, for example you can set a - docroot="/path/to/docroot" specific to the context php4_execute is - called. For boolean ini-keys please use 0/1 as value, not - "On","Off",... (this will not work correctly), e.g. - zlib.output_compression=1 instead of zlib.output_compression="On" - 4. This is only needed if you want to configure a directory that only - consists of PHP scripts (same like a cgi-bin directory): - -ObjectType fn="force-type" type="magnus-internal/x-httpd-php" -Service fn=php4_execute [inikey=value inikey=value ...] - - - After that you can configure a directory in the Administration - server and assign it the style x-httpd-php. All files in it will - get executed as PHP. This is nice to hide PHP usage by renaming - files to .html. - 5. Setup of authentication: PHP authentication cannot be used with any - other authentication. ALL AUTHENTICATION IS PASSED TO YOUR PHP - SCRIPT. To configure PHP Authentication for the entire server, add - the following line to your default object: - -AuthTrans fn=php4_auth_trans -. -. -. - - - 6. To use PHP Authentication on a single directory, add the following: - -AuthTrans fn=php4_auth_trans - - - Note: - - The stacksize that PHP uses depends on the configuration of the web - server. If you get crashes with very large PHP scripts, it is - recommended to raise it with the Admin Server (in the section - "MAGNUS EDITOR"). - -CGI environment and recommended modifications in php.ini - - Important when writing PHP scripts is the fact that Sun JSWS/Sun ONE - WS/iPlanet/Netscape is a multithreaded web server. Because of that all - requests are running in the same process space (the space of the web - server itself) and this space has only one environment. If you want to - get CGI variables like PATH_INFO, HTTP_HOST etc. it is not the correct - way to try this in the old PHP way with getenv() or a similar way - (register globals to environment, $_ENV). You would only get the - environment of the running web server without any valid CGI variables! - - Note: - - Why are there (invalid) CGI variables in the environment? - - Answer: This is because you started the web server process from the - admin server which runs the startup script of the web server, you - wanted to start, as a CGI script (a CGI script inside of the admin - server!). This is why the environment of the started web server has - some CGI environment variables in it. You can test this by starting - the web server not from the administration server. Use the command - line as root user and start it manually - you will see there are no - CGI-like environment variables. - - Simply change your scripts to get CGI variables in the correct way for - PHP 4.x by using the superglobal $_SERVER. If you have older scripts - which use $HTTP_HOST, etc., you should turn on register_globals in - php.ini and change the variable order too (important: remove "E" from - it, because you do not need the environment here): -variables_order = "GPCS" -register_globals = On - -Special use for error pages or self-made directory listings (PHP >= 4.3.3) - - You can use PHP to generate the error pages for "404 Not Found" or - similar. Add the following line to the object in obj.conf for every - error page you want to overwrite: -Error fn="php4_execute" code=XXX script="/path/to/script.php" [inikey=value inik -ey=value...] - - where XXX is the HTTP error code. Please delete any other Error - directives which could interfere with yours. If you want to place a - page for all errors that could exist, leave the code parameter out. - Your script can get the HTTP status code with $_SERVER['ERROR_TYPE']. - - Another possibility is to generate self-made directory listings. Just - create a PHP script which displays a directory listing and replace the - corresponding default Service line for type="magnus-internal/directory" - in obj.conf with the following: -Service fn="php4_execute" type="magnus-internal/directory" script="/path/to/scri -pt.php" [inikey=value inikey=value...] - - For both error and directory listing pages the original URI and - translated URI are in the variables $_SERVER['PATH_INFO'] and - $_SERVER['PATH_TRANSLATED']. - -Note about nsapi_virtual() and subrequests (PHP >= 4.3.3) - - The NSAPI module now supports the nsapi_virtual() function (alias: - virtual()) to make subrequests on the web server and insert the result - in the web page. This function uses some undocumented features from the - NSAPI library. On Unix the module automatically looks for the needed - functions and uses them if available. If not, nsapi_virtual() is - disabled. - - Note: - - But be warned: Support for nsapi_virtual() is EXPERIMENTAL!!! - __________________________________________________________________ - __________________________________________________________________ - -CGI and command line setups - - By default, PHP is built as both a CLI and CGI program, which can be - used for CGI processing. If you are running a web server that PHP has - module support for, you should generally go for that solution for - performance reasons. However, the CGI version enables users to run - different PHP-enabled pages under different user-ids. - Warning - - A server deployed in CGI mode is open to several possible - vulnerabilities. Please read our CGI security section to learn how to - defend yourself from such attacks. - -Testing - - If you have built PHP as a CGI program, you may test your build by - typing make test. It is always a good idea to test your build. This way - you may catch a problem with PHP on your platform early instead of - having to struggle with it later. - -Using Variables - - Some server supplied environment variables are not defined in the - current » CGI/1.1 specification. Only the following variables are - defined there: AUTH_TYPE, CONTENT_LENGTH, CONTENT_TYPE, - GATEWAY_INTERFACE, PATH_INFO, PATH_TRANSLATED, QUERY_STRING, - REMOTE_ADDR, REMOTE_HOST, REMOTE_IDENT, REMOTE_USER, REQUEST_METHOD, - SCRIPT_NAME, SERVER_NAME, SERVER_PORT, SERVER_PROTOCOL, and - SERVER_SOFTWARE. Everything else should be treated as 'vendor - extensions'. - __________________________________________________________________ - __________________________________________________________________ - -HP-UX specific installation notes - - This section contains notes and hints specific to installing PHP on - HP-UX systems. - - There are two main options for installing PHP on HP-UX systems. Either - compile it, or install a pre-compiled binary. - - Official pre-compiled packages are located here: - » http://software.hp.com/ - - Until this manual section is rewritten, the documentation about - compiling PHP (and related extensions) on HP-UX systems has been - removed. For now, consider reading the following external resource: - » Building Apache and PHP on HP-UX 11.11 - __________________________________________________________________ - __________________________________________________________________ - -OpenBSD installation notes - - This section contains notes and hints specific to installing PHP on - » OpenBSD 3.6. - -Using Binary Packages - - Using binary packages to install PHP on OpenBSD is the recommended and - simplest method. The core package has been separated from the various - modules, and each can be installed and removed independently from the - others. The files you need can be found on your OpenBSD CD or on the - FTP site. - - The main package you need to install is php4-core-4.3.8.tgz, which - contains the basic engine (plus gettext and iconv). Next, take a look - at the module packages, such as php4-mysql-4.3.8.tgz or - php4-imap-4.3.8.tgz. You need to use the phpxs command to activate and - deactivate these modules in your php.ini. - - Example #1 OpenBSD Package Install Example -# pkg_add php4-core-4.3.8.tgz -# /usr/local/sbin/phpxs -s -# cp /usr/local/share/doc/php4/php.ini-recommended /var/www/conf/php.ini - (add in mysql) -# pkg_add php4-mysql-4.3.8.tgz -# /usr/local/sbin/phpxs -a mysql - (add in imap) -# pkg_add php4-imap-4.3.8.tgz -# /usr/local/sbin/phpxs -a imap - (remove mysql as a test) -# pkg_delete php4-mysql-4.3.8 -# /usr/local/sbin/phpxs -r mysql - (install the PEAR libraries) -# pkg_add php4-pear-4.3.8.tgz - - Read the » packages(7) manual page for more information about binary - packages on OpenBSD. - -Using Ports - - You can also compile up PHP from source using the » ports tree. - However, this is only recommended for users familiar with OpenBSD. The - PHP 4 port is split into two sub-directories: core and extensions. The - extensions directory generates sub-packages for all of the supported - PHP modules. If you find you do not want to create some of these - modules, use the no_* FLAVOR. For example, to skip building the imap - module, set the FLAVOR to no_imap. - -Common Problems - - * The default install of Apache runs inside a » chroot(2) jail, which - will restrict PHP scripts to accessing files under /var/www. You - will therefore need to create a /var/www/tmp directory for PHP - session files to be stored, or use an alternative session backend. - In addition, database sockets need to be placed inside the jail or - listen on the localhost interface. If you use network functions, - some files from /etc such as /etc/resolv.conf and /etc/services - will need to be moved into /var/www/etc. The OpenBSD PEAR package - automatically installs into the correct chroot directories, so no - special modification is needed there. More information on the - OpenBSD Apache is available in the » OpenBSD FAQ. - * The OpenBSD 3.6 package for the » gd extension requires XFree86 to - be installed. If you do not wish to use some of the font features - that require X11, install the php4-gd-4.3.8-no_x11.tgz package - instead. - -Older Releases - - Older releases of OpenBSD used the FLAVORS system to compile up a - statically linked PHP. Since it is hard to generate binary packages - using this method, it is now deprecated. You can still use the old - stable ports trees if you wish, but they are unsupported by the OpenBSD - team. If you have any comments about this, the current maintainer for - the port is Anil Madhavapeddy (avsm at openbsd dot org). - __________________________________________________________________ - __________________________________________________________________ - -Solaris specific installation tips - - This section contains notes and hints specific to installing PHP on - Solaris systems. - -Required software - - Solaris installs often lack C compilers and their related tools. Read - this FAQ for information on why using GNU versions for some of these - tools is necessary. - - For unpacking the PHP distribution you need - * tar - * gzip or - * bzip2 - - For compiling PHP you need - * gcc (recommended, other C compilers may work) - * make - * GNU sed - - For building extra extensions or hacking the code of PHP you might also - need - * flex (up to PHP 5.2) - * re2c - * bison - * m4 - * autoconf - * automake - - In addition, you will need to install (and possibly compile) any - additional software specific to your configuration, such as Oracle or - MySQL. - -Using Packages - - You can simplify the Solaris install process by using pkgadd to install - most of your needed components. The Image Packaging System (IPS) for - Solaris 11 Express also contains most of the required components for - installation using the pkg command. - __________________________________________________________________ - __________________________________________________________________ - -Debian GNU/Linux installation notes - - This section contains notes and hints specific to installing PHP on - » Debian GNU/Linux. - Warning - - Unofficial builds from third-parties are not supported here. Any bugs - should be reported to the Debian team unless they can be reproduced - using the latest builds from our » download area. - - While the instructions for building PHP on Unix apply to Debian as - well, this manual page contains specific information for other options, - such as using either the apt-get or aptitude commands. This manual page - uses these two commands interchangeably. - -Using APT - - First, note that other related packages may be desired like - libapache2-mod-php7 to integrate with Apache 2, and php-pear for PEAR. - - Second, before installing a package, it's wise to ensure the package - list is up to date. Typically, this is done by running the command - apt-get update. - - Example #1 Debian Install Example with Apache 2 -# apt-get install php7-common libapache2-mod-php7 php7-cli - - APT will automatically install the PHP 7 module for Apache 2 and all of - its dependencies, and then activate it. Apache should be restarted in - order for the changes take place. For example: - - Example #2 Stopping and starting Apache once PHP is installed -# /etc/init.d/apache2 stop -# /etc/init.d/apache2 start - -Better control of configuration - - In the last section, PHP was installed with only core modules. It's - very likely that additional modules will be desired, such as MySQL, - cURL, GD, etc. These may also be installed via the apt-get command. - - Example #3 Methods for listing additional PHP 7 packages -# apt-cache search php7 -# aptitude search php7 -# aptitude search php7 |grep -i mysql - - The examples will show a lot of packages including several PHP specific - ones like php7-cgi, php7-cli and php7-dev. Determine which are needed - and install them like any other with either apt-get or aptitude. And - because Debian performs dependency checks, it'll prompt for those so - for example to install MySQL and cURL: - - Example #4 Install PHP with MySQL, cURL -# apt-get install php7-mysql php7-curl - - APT will automatically add the appropriate lines to the different - php.ini related files like /etc/php7/apache2/php.ini, - /etc/php7/conf.d/pdo.ini, etc. and depending on the extension will add - entries similar to extension=foo.so. However, restarting the web server - (like Apache) is required before these changes take affect. - -Common Problems - - * If the PHP scripts are not parsing via the web server, then it's - likely that PHP was not added to the web server's configuration - file, which on Debian may be /etc/apache2/apache2.conf or similar. - See the Debian manual for further details. - * If an extension was seemingly installed yet the functions are - undefined, be sure that the appropriate ini file is being loaded - and/or the web server was restarted after installation. - * There are two basic commands for installing packages on Debian (and - other linux variants): apt-get and aptitude. However, explaining - the subtle differences between these commands goes beyond the scope - of this manual. - __________________________________________________________________ - __________________________________________________________________ - __________________________________________________________________ - -Installation on Mac OS X - -Table of Contents - - * Using Packages - * Using the bundled PHP - * Compiling PHP on Mac OS X - - This section contains notes and hints specific to installing PHP on Mac - OS X. PHP is bundled with Macs, and compiling is similar to the Unix - installation guide. - __________________________________________________________________ - -Using Packages - - There are a few pre-packaged and pre-compiled versions of PHP for Mac - OS X. This can help in setting up a standard configuration, but if you - need to have a different set of features (such as a secure server, or a - different database driver), you may need to build PHP and/or your web - server yourself. If you are unfamiliar with building and compiling your - own software, it's worth checking whether somebody has already built a - packaged version of PHP with the features you need. - - The following resources offer easy to install packages and precompiled - binaries for PHP on Mac OS: - - * MacPorts: » http://www.macports.org/ - * Entropy: » http://www.entropy.ch/software/macosx/php/ - * Fink: » http://www.finkproject.org/ - * Homebrew: » http://github.com/mxcl/homebrew - __________________________________________________________________ - __________________________________________________________________ - -Using the bundled PHP - - PHP has come standard with Macs since OS X version 10.0.0. Enabling PHP - with the default web server requires uncommenting a few lines in the - Apache configuration file httpd.conf whereas the CGI and/or CLI are - enabled by default (easily accessible via the Terminal program). - - Enabling PHP using the instructions below is meant for quickly setting - up a local development environment. It's highly recommended to always - upgrade PHP to the newest version. Like most live software, newer - versions are created to fix bugs and add features and PHP being is no - different. See the appropriate MAC OS X installation documentation for - further details. The following instructions are geared towards a - beginner with details provided for getting a default setup to work. All - users are encouraged to compile, or install a new packaged version. - - The standard installation type is using mod_php, and enabling the - bundled mod_php on Mac OS X for the Apache web server (the default web - server, that is accessible via System Preferences) involves the - following steps: - - 1. Locate and open the Apache configuration file. By default, the - location is as follows: /private/etc/apache2/httpd.conf Using - Finder or Spotlight to find this file may prove difficult as by - default it's private and owned by the root user. - - Note: One way to open this is by using a Unix based text editor in - the Terminal, for example nano, and because the file is owned by - root we'll use the sudo command to open it (as root) so for example - type the following into the Terminal Application (after, it will - prompt for a password): sudo nano /private/etc/apache2/httpd.conf - Noteworthy nano commands: ^w (search), ^o (save), and ^x (exit) - where ^ represents the Ctrl key. - - Note: Versions of Mac OS X prior to 10.5 were bundled with older - versions of PHP and Apache. As such, the Apache configuration file - on legacy machines may be /etc/httpd/httpd.conf. - 2. With a text editor, uncomment the lines (by removing the #) that - look similar to the following (these two lines are often not - together, locate them both in the file): -# LoadModule php7_module libexec/httpd/libphp7.so - -# AddModule mod_php7.c - - Notice the location/path. When building PHP in the future, the - above files should be replaced or commented out. - 3. Be sure the desired extensions will parse as PHP (examples: .php - .html and .inc) - Due to the following statement already existing in httpd.conf (as - of Mac Panther), once PHP is enabled the .php files will - automatically parse as PHP. - - # If php is turned on, we respect .php and .phps files. - AddType application/x-httpd-php .php - AddType application/x-httpd-php-source .phps - - # Since most users will want index.php to work we - # also automatically enable index.php - - DirectoryIndex index.html index.php - - - - Note: - Before OS X 10.5 (Leopard), PHP 4 was bundled instead of PHP 5 in - which case the above instructions will differ slightly by changing - 5's to 4's. - 4. Be sure the DirectoryIndex loads the desired default index file - This is also set in httpd.conf. Typically index.php and index.html - are used. By default index.php is enabled because it's also in the - PHP check shown above. Adjust accordingly. - 5. Set the php.ini location or use the default A typical default - location on Mac OS X is /usr/local/php/php.ini and a call to - phpinfo() will reveal this information. If a php.ini is not used, - PHP will use all default values. See also the related FAQ on - finding php.ini. - 6. Locate or set the DocumentRoot This is the root directory for all - the web files. Files in this directory are served from the web - server so the PHP files will parse as PHP before outputting them to - the browser. A typical default path is /Library/WebServer/Documents - but this can be set to anything in httpd.conf. Alternatively, the - default DocumentRoot for individual users is - /Users/yourusername/Sites - 7. Create a phpinfo() file - The phpinfo() function will display information about PHP. Consider - creating a file in the DocumentRoot with the following PHP code: - - 8. Restart Apache, and load the PHP file created above To restart, - either execute sudo apachectl graceful in the shell or stop/start - the "Personal Web Server" option in the OS X System Preferences. By - default, loading local files in the browser will have an URL like - so: http://localhost/info.php Or using the DocumentRoot in the user - directory is another option and would end up looking like: - http://localhost/~yourusername/info.php - - The CLI (or CGI in older versions) is appropriately named php and - likely exists as /usr/bin/php. Open up the terminal, read the command - line section of the PHP manual, and execute php -v to check the PHP - version of this PHP binary. A call to phpinfo() will also reveal this - information. - __________________________________________________________________ - __________________________________________________________________ - -Compiling PHP on Mac OS X - - Use the Unix installation guide to compile PHP on Mac OS X. - __________________________________________________________________ - __________________________________________________________________ - __________________________________________________________________ - -Installation of PECL extensions - -Table of Contents - - * Introduction to PECL Installations - * Downloading PECL extensions - * Installing a PHP extension on Windows - * Compiling shared PECL extensions with the pecl command - * Compiling shared PECL extensions with phpize - * php-config - * Compiling PECL extensions statically into PHP - __________________________________________________________________ - -Introduction to PECL Installations - - » PECL is a repository of PHP extensions that are made available to you - via the » PEAR packaging system. This section of the manual is intended - to demonstrate how to obtain and install PECL extensions. - - These instructions assume /your/phpsrcdir/ is the path to the PHP - source distribution, and that extname is the name of the PECL - extension. Adjust accordingly. These instructions also assume a - familiarity with the » pear command. The information in the PEAR manual - for the pear command also applies to the pecl command. - - To be useful, a shared extension must be built, installed, and loaded. - The methods described below provide you with various instructions on - how to build and install the extensions, but they do not automatically - load them. Extensions can be loaded by adding an extension directive. - To this php.ini file, or through the use of the dl() function. - - When building PHP modules, it's important to have known-good versions - of the required tools (autoconf, automake, libtool, etc.) See the - » Anonymous Git Instructions for details on the required tools, and - required versions. - __________________________________________________________________ - __________________________________________________________________ - -Downloading PECL extensions - - There are several options for downloading PECL extensions, such as: - * The pecl install extname command downloads the extensions code - automatically, so in this case there is no need for a separate - download. - * » http://pecl.php.net/ The PECL web site contains information about - the different extensions that are offered by the PHP Development - Team. The information available here includes: ChangeLog, release - notes, requirements and other similar details. - * pecl download extname PECL extensions that have releases listed on - the PECL web site are available for download and installation using - the » pecl command. Specific revisions may also be specified. - * SVN Most PECL extensions also reside in SVN. A web-based view may - be seen at » http://svn.php.net/viewvc/pecl/. To download straight - from SVN, the following sequence of commands may be used: - $ svn checkout http://svn.php.net/repository/pecl/extname/trunk - extname - * Windows downloads At this time the PHP project does not compile - Windows binaries for PECL extensions. However, to compile PHP under - Windows see the chapter titled building PHP for Windows. - __________________________________________________________________ - __________________________________________________________________ - -Installing a PHP extension on Windows - - On Windows, you have two ways to load a PHP extension: either compile - it into PHP, or load the DLL. Loading a pre-compiled extension is the - easiest and preferred way. - - To load an extension, you need to have it available as a ".dll" file on - your system. All the extensions are automatically and periodically - compiled by the PHP Group (see next section for the download). - - To compile an extension into PHP, please refer to building from source - documentation. - - To compile a standalone extension (aka a DLL file), please refer to - building from source documentation. If the DLL file is available - neither with your PHP distribution nor in PECL, you may have to compile - it before you can start using the extension. - -Where to find an extension? - - PHP extensions are usually called "php_*.dll" (where the star - represents the name of the extension) and they are located under the - "PHP\ext" ("PHP\extensions" in PHP 4) folder. - - PHP ships with the extensions most useful to the majority of - developers. They are called "core" extensions. - - However, if you need functionality not provided by any core extension, - you may still be able to find one in PECL. The PHP Extension Community - Library (PECL) is a repository for PHP Extensions, providing a - directory of all known extensions and hosting facilities for - downloading and development of PHP extensions. - - If you have developed an extension for your own uses, you might want to - think about hosting it on PECL so that others with the same needs can - benefit from your time. A nice side effect is that you give them a good - chance to give you feedback, (hopefully) thanks, bug reports and even - fixes/patches. Before you submit your extension for hosting on PECL, - please read http://pecl.php.net/package-new.php. - -Which extension to download? - - Many times, you will find several versions of each DLL: - * Different version numbers (at least the first two numbers should - match) - * Different thread safety settings - * Different processor architecture (x86, x64, ...) - * Different debugging settings - * etc. - - You should keep in mind that your extension settings should match all - the settings of the PHP executable you are using. The following PHP - script will tell you all about your PHP settings: - - Example #1 phpinfo() call - - - Or from the command line, run: -drive:\\path\to\php\executable\php.exe -i - -Loading an extension - - The most common way to load a PHP extension is to include it in your - php.ini configuration file. Please note that many extensions are - already present in your php.ini and that you only need to remove the - semicolon to activate them. -;extension=php_extname.dll - -extension=php_extname.dll - - However, some web servers are confusing because they do not use the - php.ini located alongside your PHP executable. To find out where your - actual php.ini resides, look for its path in phpinfo(): -Configuration File (php.ini) Path C:\WINDOWS - -Loaded Configuration File C:\Program Files\PHP\5.2\php.ini - - After activating an extension, save php.ini, restart the web server and - check phpinfo() again. The new extension should now have its own - section. - -Resolving problems - - If the extension does not appear in phpinfo(), you should check your - logs to learn where the problem comes from. - - If you are using PHP from the command line (CLI), the extension loading - error can be read directly on screen. - - If you are using PHP with a web server, the location and format of the - logs vary depending on your software. Please read your web server - documentation to locate the logs, as it does not have anything to do - with PHP itself. - - Common problems are the location of the DLL, the value of the " - extension_dir" setting inside php.ini and compile-time setting - mismatches. - - If the problem lies in a compile-time setting mismatch, you probably - didn't download the right DLL. Try downloading again the extension with - the right settings. Again, phpinfo() can be of great help. - __________________________________________________________________ - __________________________________________________________________ - -Compiling shared PECL extensions with the pecl command - - PECL makes it easy to create shared PHP extensions. Using the » pecl - command, do the following: - - $ pecl install extname - - This will download the source for extname, compile, and install - extname.so into your extension_dir. extname.so may then be loaded via - php.ini - - By default, the pecl command will not install packages that are marked - with the alpha or beta state. If no stable packages are available, you - may install a beta package using the following command: - - $ pecl install extname-beta - - You may also install a specific version using this variant: - - $ pecl install extname-0.1 - - Note: - - After enabling the extension in php.ini, restarting the web service - is required for the changes to be picked up. - __________________________________________________________________ - __________________________________________________________________ - -Compiling shared PECL extensions with phpize - - Sometimes, using the pecl installer is not an option. This could be - because you're behind a firewall, or it could be because the extension - you want to install is not available as a PECL compatible package, such - as unreleased extensions from SVN. If you need to build such an - extension, you can use the lower-level build tools to perform the build - manually. - - The phpize command is used to prepare the build environment for a PHP - extension. In the following sample, the sources for an extension are in - a directory named extname: - -$ cd extname -$ phpize -$ ./configure -$ make -# make install - - A successful install will have created extname.so and put it into the - PHP extensions directory. You'll need to and adjust php.ini and add an - extension=extname.so line before you can use the extension. - - If the system is missing the phpize command, and precompiled packages - (like RPM's) are used, be sure to also install the appropriate devel - version of the PHP package as they often include the phpize command - along with the appropriate header files to build PHP and its - extensions. - - Execute phpize --help to display additional usage information. - __________________________________________________________________ - __________________________________________________________________ - -php-config - - php-config is a simple shell script for obtaining information about the - installed PHP configuration. - - When compiling extensions, if you have multiple PHP versions installed, - you may specify for which installation you'd like to build by using the - --with-php-config option during configuration, specifying the path of - the respective php-config script. - - The list of command line options provided by the php-config script can - be queried anytime by running php-config with the -h switch: -Usage: /usr/local/bin/php-config [OPTION] -Options: - --prefix [...] - --includes [...] - --ldflags [...] - --libs [...] - --extension-dir [...] - --include-dir [...] - --php-binary [...] - --php-sapis [...] - --configure-options [...] - --version [...] - --vernum [...] - - CAPTION: Command line options - - Option Description - --prefix Directory prefix where PHP is installed, e.g. /usr/local - --includes List of -I options with all include files - --ldflags LD Flags which PHP was compiled with - --libs Extra libraries which PHP was compiled with - --extension-dir Directory where extensions are searched by default - --include-dir Directory prefix where header files are installed by - default - --php-binary Full path to php CLI or CGI binary - --php-sapis Show all SAPI modules available - --configure-options Configure options to recreate configuration of - current PHP installation - --version PHP version - --vernum PHP version as integer - __________________________________________________________________ - __________________________________________________________________ - -Compiling PECL extensions statically into PHP - - You might find that you need to build a PECL extension statically into - your PHP binary. To do this, you'll need to place the extension source - under the php-src/ext/ directory and tell the PHP build system to - regenerate its configure script. - -$ cd /your/phpsrcdir/ext -$ pecl download extname -$ gzip -d < extname.tgz | tar -xvf - -$ mv extname-x.x.x extname - - This will result in the following directory: - - /your/phpsrcdir/ext/extname - - From here, force PHP to rebuild the configure script, and then build - PHP as normal: - - $ cd /your/phpsrcdir - $ rm configure - $ ./buildconf --force - $ ./configure --help - $ ./configure --with-extname --enable-someotherext --with-foobar - $ make - $ make install - - Note: To run the 'buildconf' script you need autoconf 2.13 and - automake 1.4+ (newer versions of autoconf may work, but are not - supported). - - Whether --enable-extname or --with-extname is used depends on the - extension. Typically an extension that does not require external - libraries uses --enable. To be sure, run the following after buildconf: - - $ ./configure --help | grep extname - __________________________________________________________________ - __________________________________________________________________ - __________________________________________________________________ - -Problems? - -Table of Contents - - * Read the FAQ - * Other problems - * Bug reports - __________________________________________________________________ - -Read the FAQ - - Some problems are more common than others. The most common ones are - listed in the PHP FAQ, part of this manual. - __________________________________________________________________ - __________________________________________________________________ - -Other problems - - If you are still stuck, someone on the PHP installation mailing list - may be able to help you. You should check out the archive first, in - case someone already answered someone else who had the same problem as - you. The archives are available from the support page on - » http://www.php.net/support.php. To subscribe to the PHP installation - mailing list, send an empty mail to - » php-install-subscribe@lists.php.net. The mailing list address is - » php-install@lists.php.net. - - If you want to get help on the mailing list, please try to be precise - and give the necessary details about your environment (which operating - system, what PHP version, what web server, if you are running PHP as - CGI or a server module, safe mode, etc.), and preferably enough code to - make others able to reproduce and test your problem. - __________________________________________________________________ - __________________________________________________________________ - -Bug reports - - If you think you have found a bug in PHP, please report it. The PHP - developers probably don't know about it, and unless you report it, - chances are it won't be fixed. You can report bugs using the - bug-tracking system at » http://bugs.php.net/. Please do not send bug - reports in mailing list or personal letters. The bug system is also - suitable to submit feature requests. - - Read the » How to report a bug document before submitting any bug - reports! - __________________________________________________________________ - __________________________________________________________________ - __________________________________________________________________ - -Runtime Configuration - -Table of Contents - - * The configuration file - * .user.ini files - * Where a configuration setting may be set - * How to change configuration settings - __________________________________________________________________ - -The configuration file - - The configuration file (php.ini) is read when PHP starts up. For the - server module versions of PHP, this happens only once when the web - server is started. For the CGI and CLI versions, it happens on every - invocation. - - php.ini is searched for in these locations (in order): - * SAPI module specific location (PHPIniDir directive in Apache 2, -c - command line option in CGI and CLI, php_ini parameter in NSAPI, - PHP_INI_PATH environment variable in THTTPD) - * The PHPRC environment variable. Before PHP 5.2.0, this was checked - after the registry key mentioned below. - * As of PHP 5.2.0, the location of the php.ini file can be set for - different versions of PHP. The following registry keys are examined - in order: [HKEY_LOCAL_MACHINE\SOFTWARE\PHP\x.y.z], - [HKEY_LOCAL_MACHINE\SOFTWARE\PHP\x.y] and - [HKEY_LOCAL_MACHINE\SOFTWARE\PHP\x], where x, y and z mean the PHP - major, minor and release versions. If there is a value for - IniFilePath in any of these keys, the first one found will be used - as the location of the php.ini (Windows only). - * [HKEY_LOCAL_MACHINE\SOFTWARE\PHP], value of IniFilePath (Windows - only). - * Current working directory (except CLI). - * The web server's directory (for SAPI modules), or directory of PHP - (otherwise in Windows). - * Windows directory (C:\windows or C:\winnt) (for Windows), or - --with-config-file-path compile time option. - - If php-SAPI.ini exists (where SAPI is the SAPI in use, so, for example, - php-cli.ini or php-apache.ini), it is used instead of php.ini. The SAPI - name can be determined with php_sapi_name(). - - Note: - - The Apache web server changes the directory to root at startup, - causing PHP to attempt to read php.ini from the root filesystem if - it exists. - - The php.ini directives handled by extensions are documented on the - respective pages of the extensions themselves. A list of the core - directives is available in the appendix. Not all PHP directives are - necessarily documented in this manual: for a complete list of - directives available in your PHP version, please read your well - commented php.ini file. Alternatively, you may find » the latest - php.ini from Git helpful too. - - Example #1 php.ini example -; any text on a line after an unquoted semicolon (;) is ignored -[php] ; section markers (text within square brackets) are also ignored -; Boolean values can be set to either: -; true, on, yes -; or false, off, no, none -register_globals = off -track_errors = yes - -; you can enclose strings in double-quotes -include_path = ".:/usr/local/lib/php" - -; backslashes are treated the same as any other character -include_path = ".;c:\php\lib" - - Since PHP 5.1.0, it is possible to refer to existing .ini variables - from within .ini files. Example: open_basedir = ${open_basedir} - ":/new/dir". - __________________________________________________________________ - __________________________________________________________________ - -.user.ini files - - Since PHP 5.3.0, PHP includes support for .htaccess-style INI files on - a per-directory basis. These files are processed only by the - CGI/FastCGI SAPI. This functionality obsoletes the PECL htscanner - extension. If you are using Apache, use .htaccess files for the same - effect. - - In addition to the main php.ini file, PHP scans for INI files in each - directory, starting with the directory of the requested PHP file, and - working its way up to the current document root (as set in - $_SERVER['DOCUMENT_ROOT']). In case the PHP file is outside the - document root, only its directory is scanned. - - Only INI settings with the modes PHP_INI_PERDIR and PHP_INI_USER will - be recognized in .user.ini-style INI files. - - Two new INI directives, user_ini.filename and user_ini.cache_ttl - control the use of user INI files. - - user_ini.filename sets the name of the file PHP looks for in each - directory; if set to an empty string, PHP doesn't scan at all. The - default is .user.ini. - - user_ini.cache_ttl controls how often user INI files are re-read. The - default is 300 seconds (5 minutes). - __________________________________________________________________ - __________________________________________________________________ - -Where a configuration setting may be set - - These modes determine when and where a PHP directive may or may not be - set, and each directive within the manual refers to one of these modes. - For example, some settings may be set within a PHP script using - ini_set(), whereas others may require php.ini or httpd.conf. - - For example, the output_buffering setting is PHP_INI_PERDIR therefore - it may not be set using ini_set(). However, the display_errors - directive is PHP_INI_ALL therefore it may be set anywhere, including - with ini_set(). - - CAPTION: Definition of PHP_INI_* modes - - Mode Meaning - PHP_INI_USER Entry can be set in user scripts (like with ini_set()) or - in the Windows registry. Since PHP 5.3, entry can be set in .user.ini - PHP_INI_PERDIR Entry can be set in php.ini, .htaccess, httpd.conf or - .user.ini (since PHP 5.3) - PHP_INI_SYSTEM Entry can be set in php.ini or httpd.conf - PHP_INI_ALL Entry can be set anywhere - __________________________________________________________________ - __________________________________________________________________ - -How to change configuration settings - -Running PHP as an Apache module - - When using PHP as an Apache module, you can also change the - configuration settings using directives in Apache configuration files - (e.g. httpd.conf) and .htaccess files. You will need "AllowOverride - Options" or "AllowOverride All" privileges to do so. - - There are several Apache directives that allow you to change the PHP - configuration from within the Apache configuration files. For a listing - of which directives are PHP_INI_ALL, PHP_INI_PERDIR, or PHP_INI_SYSTEM, - have a look at the List of php.ini directives appendix. - - php_value name value - Sets the value of the specified directive. Can be used only with - PHP_INI_ALL and PHP_INI_PERDIR type directives. To clear a - previously set value use none as the value. - - Note: Don't use php_value to set boolean values. php_flag (see - below) should be used instead. - - php_flag name on|off - Used to set a boolean configuration directive. Can be used only - with PHP_INI_ALL and PHP_INI_PERDIR type directives. - - php_admin_value name value - Sets the value of the specified directive. This can not be used - in .htaccess files. Any directive type set with php_admin_value - can not be overridden by .htaccess or ini_set(). To clear a - previously set value use none as the value. - - php_admin_flag name on|off - Used to set a boolean configuration directive. This can not be - used in .htaccess files. Any directive type set with - php_admin_flag can not be overridden by .htaccess or ini_set(). - - Example #1 Apache configuration example - - php_value include_path ".:/usr/local/lib/php" - php_admin_flag engine on - - - php_value include_path ".:/usr/local/lib/php" - php_admin_flag engine on - - - Caution - - PHP constants do not exist outside of PHP. For example, in httpd.conf - you can not use PHP constants such as E_ALL or E_NOTICE to set the - error_reporting directive as they will have no meaning and will - evaluate to 0. Use the associated bitmask values instead. These - constants can be used in php.ini - -Changing PHP configuration via the Windows registry - - When running PHP on Windows, the configuration values can be modified - on a per-directory basis using the Windows registry. The configuration - values are stored in the registry key HKLM\SOFTWARE\PHP\Per Directory - Values, in the sub-keys corresponding to the path names. For example, - configuration values for the directory c:\inetpub\wwwroot would be - stored in the key HKLM\SOFTWARE\PHP\Per Directory - Values\c\inetpub\wwwroot. The settings for the directory would be - active for any script running from this directory or any subdirectory - of it. The values under the key should have the name of the PHP - configuration directive and the string value. PHP constants in the - values are not parsed. However, only configuration values changeable in - PHP_INI_USER can be set this way, PHP_INI_PERDIR values can not. - -Other interfaces to PHP - - Regardless of how you run PHP, you can change certain values at runtime - of your scripts through ini_set(). See the documentation on the - ini_set() page for more information. - - If you are interested in a complete list of configuration settings on - your system with their current values, you can execute the phpinfo() - function, and review the resulting page. You can also access the values - of individual configuration directives at runtime using ini_get() or - get_cfg_var(). - __________________________________________________________________ - __________________________________________________________________ - __________________________________________________________________ - -Installation - - This section holds common questions about the way to install PHP. PHP - is available for almost any OS (except maybe for MacOS before OSX), and - almost any web server. - - To install PHP, follow the instructions in Installing PHP. - 1. Why shouldn't I use Apache2 with a threaded MPM in a production - environment? - 2. Unix/Windows: Where should my php.ini file be located? - 3. Unix: I installed PHP, but every time I load a document, I get the - message 'Document Contains No Data'! What's going on here? - 4. Unix: I installed PHP using RPMS, but Apache isn't processing the - PHP pages! What's going on here? - 5. Unix: I patched Apache with the FrontPage extensions patch, and - suddenly PHP stopped working. Is PHP incompatible with the Apache - FrontPage extensions? - 6. Unix/Windows: I have installed PHP, but when I try to access a PHP - script file via my browser, I get a blank screen. - 7. Unix/Windows: I have installed PHP, but when try to access a PHP - script file via my browser, I get a server 500 error. - 8. Some operating systems: I have installed PHP without errors, but - when I try to start Apache I get undefined symbol errors: - [mybox:user /src/php7] root# apachectl configtest apachectl: - /usr/local/apache/bin/httpd Undefined symbols: _compress - _uncompress - 9. Windows: I have installed PHP, but when I try to access a PHP - script file via my browser, I get the error: cgi error: The - specified CGI application misbehaved by not returning a complete - set of HTTP headers. The headers it did return are: - 10. Windows: I've followed all the instructions, but still can't get - PHP and IIS to work together! - 11. When running PHP as CGI with IIS, OmniHTTPD or Xitami, I get - the following error: Security Alert! PHP CGI cannot be accessed - directly.. - 12. How do I know if my php.ini is being found and read? It seems like - it isn't as my changes aren't being implemented. - 13. How do I add my PHP directory to the PATH on Windows? - 14. How do I make the php.ini file available to PHP on windows? - 15. Is it possible to use Apache content negotiation (MultiViews - option) with PHP? - 16. Is PHP limited to process GET and POST request methods only? - - Why shouldn't I use Apache2 with a threaded MPM in a production - environment? - PHP is glue. It is the glue used to build cool web applications - by sticking dozens of 3rd-party libraries together and making it - all appear as one coherent entity through an intuitive and easy - to learn language interface. The flexibility and power of PHP - relies on the stability and robustness of the underlying - platform. It needs a working OS, a working web server and - working 3rd-party libraries to glue together. When any of these - stop working PHP needs ways to identify the problems and fix - them quickly. When you make the underlying framework more - complex by not having completely separate execution threads, - completely separate memory segments and a strong sandbox for - each request to play in, further weaknesses are introduced into - PHP's system. - - If you want to use a threaded MPM, look at a FastCGI - configuration where PHP is running in its own memory space. - - Unix/Windows: Where should my php.ini file be located? - By default on Unix it should be in /usr/local/lib which is - /lib. Most people will want to change this at - compile-time with the --with-config-file-path flag. You would, - for example, set it with something like: - ---with-config-file-path=/etc - - And then you would copy php.ini-development from the - distribution to /etc/php.ini and edit it to make any local - changes you want. - ---with-config-file-scan-dir=PATH - - On Windows the default path for the php.ini file is the Windows - directory. If you're using the Apache webserver, php.ini is - first searched in the Apaches install directory, e.g. c:\program - files\apache group\apache. This way you can have different - php.ini files for different versions of Apache on the same - machine. - - See also the chapter about the configuration file. - - Unix: I installed PHP, but every time I load a document, I get the - message 'Document Contains No Data'! What's going on here? - This probably means that PHP is having some sort of problem and - is core-dumping. Look in your server error log to see if this is - the case, and then try to reproduce the problem with a small - test case. If you know how to use 'gdb', it is very helpful when - you can provide a backtrace with your bug report to help the - developers pinpoint the problem. If you are using PHP as an - Apache module try something like: - - + Stop your httpd processes - + gdb httpd - + Stop your httpd processes - + > run -X -f /path/to/httpd.conf - + Then fetch the URL causing the problem with your browser - + > run -X -f /path/to/httpd.conf - + If you are getting a core dump, gdb should inform you of this - now - + type: bt - + You should include your backtrace in your bug report. This - should be submitted to » http://bugs.php.net/ - - If your script uses the regular expression functions - (preg_match() and friends), you should make sure that you - compiled PHP and Apache with the same regular expression - package. This should happen automatically with PHP and Apache - 1.3.x - - Unix: I installed PHP using RPMS, but Apache isn't processing the PHP - pages! What's going on here? - Assuming you installed both Apache and PHP from RPM packages, - you need to uncomment or add some or all of the following lines - in your httpd.conf file: - -# Extra Modules -AddModule mod_php.c -AddModule mod_perl.c - -# Extra Modules -LoadModule php_module modules/mod_php.so -LoadModule php7_module modules/libphp7.so -LoadModule perl_module modules/libperl.so - - And add: - -AddType application/x-httpd-php .php - - ... to the global properties, or to the properties of the - VirtualDomain you want to have PHP support added to. - - Unix: I patched Apache with the FrontPage extensions patch, and - suddenly PHP stopped working. Is PHP incompatible with the - Apache FrontPage extensions? - No, PHP works fine with the FrontPage extensions. The problem is - that the FrontPage patch modifies several Apache structures, - that PHP relies on. Recompiling PHP (using 'make clean ; make') - after the FP patch is applied would solve the problem. - - Unix/Windows: I have installed PHP, but when I try to access a PHP - script file via my browser, I get a blank screen. - Do a 'view source' in the web browser and you will probably find - that you can see the source code of your PHP script. This means - that the web server did not send the script to PHP for - interpretation. Something is wrong with the server configuration - - double check the server configuration against the PHP - installation instructions. - - Unix/Windows: I have installed PHP, but when try to access a PHP script - file via my browser, I get a server 500 error. - Something went wrong when the server tried to run PHP. To get to - see a sensible error message, from the command line, change to - the directory containing the PHP executable (php.exe on Windows) - and run php -i. If PHP has any problems running, then a suitable - error message will be displayed which will give you a clue as to - what needs to be done next. If you get a screen full of HTML - codes (the output of the phpinfo() function) then PHP is - working, and your problem may be related to your server - configuration which you should double check. - - Some operating systems: I have installed PHP without errors, but when I - try to start Apache I get undefined symbol errors: - -[mybox:user /src/php7] root# apachectl configtest - apachectl: /usr/local/apache/bin/httpd Undefined symbols: - _compress - _uncompress - - This has actually nothing to do with PHP, but with the MySQL - client libraries. Some need --with-zlib , others do not. This is - also covered in the MySQL FAQ. - - Windows: I have installed PHP, but when I try to access a PHP script - file via my browser, I get the error: - -cgi error: - The specified CGI application misbehaved by not - returning a complete set of HTTP headers. - The headers it did return are: - - This error message means that PHP failed to output anything at - all. To get to see a sensible error message, from the command - line, change to the directory containing the PHP executable - (php.exe on Windows) and run php -i. If PHP has any problems - running, then a suitable error message will be displayed which - will give you a clue as to what needs to be done next. If you - get a screen full of HTML codes (the output of the phpinfo() - function) then PHP is working. - - Once PHP is working at the command line, try accessing the - script via the browser again. If it still fails then it could be - one of the following: - - + File permissions on your PHP script, php.exe, php7ts.dll, - php.ini or any PHP extensions you are trying to load are such - that the anonymous internet user ISUR_ cannot - access them. - + The script file does not exist (or possibly isn't where you - think it is relative to your web root directory). Note that - for IIS you can trap this error by ticking the 'check file - exists' box when setting up the script mappings in the - Internet Services Manager. If a script file does not exist - then the server will return a 404 error instead. There is also - the additional benefit that IIS will do any authentication - required for you based on the NTLanMan permissions on your - script file. - - Windows: I've followed all the instructions, but still can't get PHP - and IIS to work together! - Make sure any user who needs to run a PHP script has the rights - to run php.exe! IIS uses an anonymous user which is added at the - time IIS is installed. This user needs rights to php.exe. Also, - any authenticated user will also need rights to execute php.exe. - And for IIS4 you need to tell it that PHP is a script engine. - Also, you will want to read this faq. - - When running PHP as CGI with IIS, OmniHTTPD or Xitami, I get the - following error: Security Alert! PHP CGI cannot be accessed - directly.. - You must set the cgi.force_redirect directive to 0. It defaults - to 1 so be sure the directive isn't commented out (with a ;). - Like all directives, this is set in php.ini - - Because the default is 1, it's critical that you're 100% sure - that the correct php.ini file is being read. Read this faq for - details. - - How do I know if my php.ini is being found and read? It seems like it - isn't as my changes aren't being implemented. - To be sure your php.ini is being read by PHP, make a call to - phpinfo(). Near the top, there will be a listing called - Configuration File (php.ini). This will tell you where PHP is - looking for php.ini and whether or not it's being read. If just - a directory PATH exists, then it's not being read, and you - should put your php.ini in that directory. If php.ini is - included within the PATH, it is being read. - - If php.ini is being read and you're running PHP as a module, - then be sure to restart your web server after making changes to - php.ini - - See also php_ini_loaded_file(). - - How do I add my PHP directory to the PATH on Windows? - On Windows NT+ and Windows Server 2000+: - - + Go to Control Panel and open the System icon (Start -> - Settings -> Control Panel -> System, or just Start -> Control - Panel -> System for Windows XP/2003+) - + Go to the Advanced tab - + Click on the 'Environment Variables' button - + Look into the 'System Variables' pane - + Find the Path entry (you may need to scroll to find it) - + Double click on the Path entry - + Enter your PHP directory at the end, including ';' before - (e.g. ;C:\php) - + Press OK - - On Windows 98/Me you need to edit the autoexec.bat file: - - + Open the Notepad (Start -> Run and enter notepad) - + Open the C:\autoexec.bat file - + Locate the line with PATH=C:\WINDOWS;C:\WINDOWS\COMMAND;..... - and add: ;C:\php to the end of the line - + Save the file and restart your computer - - Note: Be sure to reboot after following the steps above to ensure - that the PATH changes are applied. - - The PHP manual used to promote the copying of files into the - Windows system directory, this is because this directory - (C:\Windows, C:\WINNT, etc.) is by default in the systems PATH. - Copying files into the Windows system directory has long since - been deprecated and may cause problems. - - How do I make the php.ini file available to PHP on windows? - There are several ways of doing this. If you are using Apache, - read their installation specific instructions (Apache 1, Apache - 2), otherwise you must set the PHPRC environment variable: - - On Windows NT, 2000, XP and 2003: - - + Go to Control Panel and open the System icon (Start -> - Settings -> Control Panel -> System, or just Start -> Control - Panel -> System for Windows XP/2003) - + Go to the Advanced tab - + Click on the 'Environment Variables' button - + Look into the 'System variables' pane - + Click on 'New' and enter 'PHPRC' as the variable name and the - directory where php.ini is located as the variable value (e.g. - C:\php) - + Press OK and restart your computer - - On Windows 98/Me you need to edit the autoexec.bat file: - - + Open the Notepad (Start -> Run and enter notepad) - + Open the C:\autoexec.bat file - + Add a new line to the end of the file: set PHPRC=C:\php - (replace C:\php with the directory where php.ini is located). - Please note that the path cannot contain spaces. For instance, - if you have installed PHP in C:\Program Files\PHP, you would - enter C:\PROGRA~1\PHP instead. - + Save the file and restart your computer - - Is it possible to use Apache content negotiation (MultiViews option) - with PHP? - If links to PHP files include extension, everything works - perfect. This FAQ is only for the case when links to PHP files - don't include extension and you want to use content negotiation - to choose PHP files from URL with no extension. In this case, - replace the line AddType application/x-httpd-php .php with: - -AddHandler php7-script php -AddType text/html php - - This solution doesn't work for Apache 1 as PHP module doesn't - catch php-script. - - Is PHP limited to process GET and POST request methods only? - No, it is possible to handle any request method, e.g. CONNECT. - Proper response status can be sent with header(). If only GET - and POST methods should be handled, it can be achieved with this - Apache configuration: - - -Deny from all - + http://php.net/install diff --git a/Makefile.global b/Makefile.global index 6b49f3844fcc6..096edb619d696 100644 --- a/Makefile.global +++ b/Makefile.global @@ -115,7 +115,7 @@ clean: find . -name \*.la -o -name \*.a | xargs rm -f find . -name \*.so | xargs rm -f find . -name .libs -a -type d|xargs rm -rf - rm -f libphp$(PHP_MAJOR_VERSION).la $(SAPI_CLI_PATH) $(SAPI_CGI_PATH) $(SAPI_MILTER_PATH) $(SAPI_LITESPEED_PATH) $(SAPI_FPM_PATH) $(OVERALL_TARGET) modules/* libs/* + rm -f libphp$(PHP_MAJOR_VERSION).la $(SAPI_CLI_PATH) $(SAPI_CGI_PATH) $(SAPI_LITESPEED_PATH) $(SAPI_FPM_PATH) $(OVERALL_TARGET) modules/* libs/* distclean: clean rm -f Makefile config.cache config.log config.status Makefile.objects Makefile.fragments libtool main/php_config.h main/internal_functions_cli.c main/internal_functions.c stamp-h buildmk.stamp Zend/zend_dtrace_gen.h Zend/zend_dtrace_gen.h.bak Zend/zend_config.h TSRM/tsrm_config.h @@ -137,7 +137,7 @@ prof-clean: find . -name \*.lo -o -name \*.o | xargs rm -f find . -name \*.la -o -name \*.a | xargs rm -f find . -name \*.so | xargs rm -f - rm -f libphp$(PHP_MAJOR_VERSION).la $(SAPI_CLI_PATH) $(SAPI_CGI_PATH) $(SAPI_MILTER_PATH) $(SAPI_LITESPEED_PATH) $(SAPI_FPM_PATH) $(OVERALL_TARGET) modules/* libs/* + rm -f libphp$(PHP_MAJOR_VERSION).la $(SAPI_CLI_PATH) $(SAPI_CGI_PATH) $(SAPI_LITESPEED_PATH) $(SAPI_FPM_PATH) $(OVERALL_TARGET) modules/* libs/* prof-use: CCACHE_DISABLE=1 $(MAKE) PROF_FLAGS=-fprofile-use all diff --git a/NEWS b/NEWS index e5bc24d8a01b0..201f1209acc91 100644 --- a/NEWS +++ b/NEWS @@ -1,647 +1,90 @@ PHP NEWS ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| -?? ??? ????, PHP 7.2.0RC4 +?? ??? ????, PHP 7.3.0alpha1 -- Core +- Core: + . Redesigned the old ext_skel program written in PHP, run: + 'php ext_skel.php' for all options. This means there is no dependencies + thrus making it work on Windows out of the box. (Kalle) + . Removed support for BeOS. (Kalle) + . Fixed bug #75031 (support append mode in temp/memory streams). (adsr) + . Fixed bug #74860 (Uncaught exceptions not being formatted properly when + error_log set to "syslog"). (Philip Prindeville) . Fixed bug #75220 (Segfault when calling is_callable on parent). (andrewnester) -- Date: - . Fixed bug #75222 (DateInterval microseconds property always 0). (jhdxr) - -- litespeed: - . Fixed bug #75248 (Binary directory doesn't get created when building - only litespeed SAPI). (petk) - . Fixed bug #75251 (Missing program prefix and suffix). (petk) - -- Opcache - . Fixed bug #75255 (Request hangs and not finish). (Dmitry) - -28 Sep 2017, PHP 7.2.0RC3 - -- Core - . Fixed bug #75241 (Null pointer dereference in zend_mm_alloc_small()). - (Laruence) - . Fixed bug #74878 (Data race in ZTS builds). (Nikita, Dmitry) - . Fixed bug #75236 (infinite loop when printing an error-message). (Andrea) - . Fixed bug #75252 (Incorrect token formatting on two parse errors in one - request). (Nikita) - -- FPM: - . Fixed bug #75212 (php_value acts like php_admin_value). (Remi) - -- MySQLi: - . Fixed bug #75018 (Data corruption when reading fields of bit type). (Anatol) - -- Opcache: - . Fixed bug #75230 (Invalid opcode 49/1/8 using opcache). (Laruence) - -- PCRE: - . Fixed bug ##75223 (PCRE JIT broken in 7.2). (Dmitry) - -- PDO_mysql: - . Fixed bug #75177 (Type 'bit' is fetched as unexpected string). (Anatol) - -- SPL: - . Fixed bug #73629 (SplDoublyLinkedList::setIteratorMode masks intern flags). - (J. Jeising, cmb) - -14 Sep 2017, PHP 7.2.0RC2 - -- Core: - . Fixed Bug #75142 (buildcheck.sh check for autoconf version needs to be updated - for v2.64). (zizzy at zizzy dot net, Remi) - - BCMath: - . Fixed bug #44995 (bcpowmod() fails if scale != 0). (cmb) - . Fixed bug #46781 (BC math handles minus zero incorrectly). (cmb) - . Fixed bug #54598 (bcpowmod() may return 1 if modulus is 1). (okano1220, cmb) - . Fixed bug #75178 (bcpowmod() misbehaves for non-integer base or modulus). (cmb) - -- CLI server: - . Fixed bug #70470 (Built-in server truncates headers spanning over TCP - packets). (bouk) + . Fixed bug #66364 (BCMath bcmul ignores scale parameter). (cmb) + . Implemented request #67855 (No way to get current scale in use). (Chris + Wright, cmb) + . Fixed bug #75164 (split_bc_num() is pointless). (cmb) + . Fixed bug #75169 (BCMath errors/warnings bypass PHP's error handling). (cmb) - Date: - . Fixed bug #75149 (redefinition of typedefs ttinfo and t1info). (Remi) - -- GD: - . Fixed bug #75139 (libgd/gd_interpolation.c:1786: suspicious if ?). (cmb) - -- Intl: - . Fixed bug #75193 (segfault in collator_convert_object_to_string). (Remi) - -- Gettext: - . Fixed bug #73730 (textdomain(null) throws in strict mode). (cmb) - -- Opcache - . Fixed incorect constant conditional jump elimination. (Dmitry) - -- OpenSSL - . Automatically load OpenSSL configuration file. (Jakub Zelenka) - -- SPL: - . Fixed bug #75155 (AppendIterator::append() is broken when appending another - AppendIterator). (Nikita) - . Fixed bug #75173 (incorrect behavior of AppendIterator::append in foreach loop). - (jhdxr) - -- Standard: - . Fixed bug #75152 (signed integer overflow in parse_iv). (Laruence) - . Fixed bug #75170 (mt_rand() bias on 64-bit machines). (Nikita) - -- ZIP: - . Fixed bug #75143 (new method setEncryptionName() seems not to exist - in ZipArchive). (Anatol) - -31 Aug 2017, PHP 7.2.0RC1 - -- Core: - . Fixed bug #75042 (run-tests.php issues with EXTENSION block). (John Boehr) - -- CURL: - . Fixed bug #75093 (OpenSSL support not detected). (Remi) - . Better fix for #74125 (use pkg-config instead of curl-config). (Remi) - -- GD: - . Fixed bug #75111 (Memory disclosure or DoS via crafted .bmp image). (cmb) - . Fixed bug #75124 (gdImageGrayScale() may produce colors). (cmb) - -- Intl: - . Fixed bug #75090 (IntlGregorianCalendar doesn't have constants from parent - class). (tpunt) - -- PCRE: - . Fixed bug #75089 (preg_grep() is not reporting PREG_BAD_UTF8_ERROR after - first input string). (Dmitry) - -- PDO_OCI: - . Fixed bug #74631 (PDO_PCO with PHP-FPM: OCI environment initialized - before PHP-FPM sets it up). (Ingmar Runge) - -- SQLite3: - . Update to Sqlite 3.20.1. (cmb) - -- Standard: - . Fixed bug #75097 (gethostname fails if your host name is 64 chars long). (Andrea) - -17 Aug 2017, PHP 7.2.0beta3 - -- Core: - . Fixed bug #75063 (Main CWD initialized with wrong codepage). (Anatol) - . Fixed bug #74725 (html_errors=1 breaks unhandled exceptions). (Andrea) - -- Date: - . Fixed bug #75002 (Null Pointer Dereference in timelib_time_clone). (Derick) - -- FTP: - . Added ftp_append() function. (blar) - -- JSON: - . Fixed bug #75185 (Buffer overflow in json_decode() with - JSON_INVALID_UTF8_IGNORE or JSON_INVALID). (Jakub Zelenka) - -- Mbstring: - . Fixed bug #75001 (Wrong reflection on mb_eregi_replace). (Fabien - Villepinte) - -- SQLite3: - . Updated to SQLite 3.20.0. (cmb) - -- SPL: - . Fixed bug #75049 (spl_autoload_unregister can't handle - spl_autoload_functions results). (Laruence) - . Added spl_object_id(). (Tyson Andre) - -- Standard: - . Fixed bug #75075 (unpack with X* causes infinity loop). (Laruence) - . Fixed bug #74103 (heap-use-after-free when unserializing invalid array - size). (Nikita) - . Fixed bug #75054 (A Denial of Service Vulnerability was found when - performing deserialization). (Nikita) - -- WDDX: - . Fixed bug #73793 (WDDX uses wrong decimal seperator). (cmb) - -- XMLRPC: - . Fixed bug #74975 (Incorrect xmlrpc serialization for classes with declared - properties). (blar) - -03 Aug 2017, PHP 7.2.0beta2 - -- Core: - . Implemented FR #74963 (Improved error message on fetching property of - non-object). (Laruence) - . Fixed bug #74947 (Segfault in scanner on INF number). (Laruence) - . Fixed bug #74954 (null deref and segfault in zend_generator_resume()). (Bob) - -- CLI: - . Fixed bug #74979 (Interactive shell opening instead of script execution - with -f flag). (Anatol) + . Implemented FR #74668: Add DateTime::createFromImmutable() method. + (majkl578, Rican7) + . Fixed bug #75222 (DateInterval microseconds property always 0). (jhdxr) - cURL: . Fixed bug #74125 (Fixed finding CURL on systems with multiarch support). (cebe) -- Intl: - . Fixed bug #74993 (Wrong reflection on some locale_* functions). (Sara) +- GD: + . Added support for WebP in imagecreatefromstring() (Andreas Treichel, cmb). + +- LDAP: + . Added ldap_exop_refresh helper for EXOP REFRESH operation with dds overlay. + (Come) + . Added full support for sending and parsing ldap controls (Come) + +- litespeed: + . Fixed bug #75248 (Binary directory doesn't get created when building + only litespeed SAPI). (petk) + . Fixed bug #75251 (Missing program prefix and suffix). (petk) - Mbstring: - . Fixed bug #69267 (mb_strtolower fails on titlecase characters). (Nikita) - . Fixed bug #71606 (Segmentation fault mb_strcut with HTML-ENTITIES encoding). - (cmb) - . Fixed bug #62934 (mb_convert_kana() does not convert iteration marks). + . Fixed bug #65544 (mb title case conversion-first word in quotation isn't + capitalized). (Nikita) + . Fixed bug #71298 (MB_CASE_TITLE misbehaves with curled apostrophe/quote. (Nikita) + . Fixed bug #73528 (Crash in zif_mb_send_mail). (Nikita) + . Fixed bug #74929 (mbstring functions version 7.1.1 are slow compared to 5.3 + on Windows). (Nikita) -- MySQLi: - . Fixed bug #74968 (PHP crashes when calling mysqli_result::fetch_object with - an abstract class). (Anatol) +- ODBC: + . Removed support for ODBCRouter. (Kalle) + . Removed support for Birdstep. (Kalle) -- OCI8: - . Expose oci_unregister_taf_callback() (Tianfang Yang) - -- Opcache: - . Fixed bug #74980 (Narrowing occurred during type inference). (Laruence) +- PDO_OCI: + . Fixed bug #74631 (PDO_PCO with PHP-FPM: OCI environment initialized + before PHP-FPM sets it up). (Ingmar Runge) -- OpenSSL: - . Fixed bug #74903 (openssl_pkcs7_encrypt() uses different EOL than before). - (Anatol) +- PDO SQLite + . Add support for additional open flags - phar: . Fixed bug #74991 (include_path has a 4096 char limit in some cases). (bwbroersma) -- Reflection: - . Fixed bug #74949 (null pointer dereference in _function_string). (Laruence) +- pgsql: + . Added new error constants for pg_result_error(): (Kalle) + - Requires Postgres 9.3 + - PGSQL_DIAG_SCHEMA_NAME + - PGSQL_DIAG_TABLE_NAME + - PGSQL_DIAG_COLUMN_NAME + - PGSQL_DIAG_DATATYPE_NAME + - PGSQL_DIAG_CONSTRAINT_NAME + - Requires Postgres 9.6 + - PGSQL_DIAG_SEVERITY_NONLOCALIZED - Session: - . Fixed bug #74892 (Url Rewriting (trans_sid) not working on urls that start - with "#"). (Andrew Nester) - . Fixed bug #74936 (session_cache_expire/cache_limiter/save_path() trigger a - warning in read mode). (morozov) . Fixed bug #74941 (session fails to start after having headers sent). (morozov) - . Fixed bug #74833 (SID constant created with wrong module number). (Anatol) - -- SimpleXML: - . Fixed bug #74950 (nullpointer deref in simplexml_element_getDocNamespaces). - (Laruence) - SPL: - . Fixed bug #74669 (Unserialize ArrayIterator broken). (Andrew Nester) . Fixed bug #74977 (Appending AppendIterator leads to segfault). (Andrew Nester) - . Fixed bug #75015 (Crash in recursive iterator destructors). (Julien) - -- Standard: - . Fixed bug #74851 (uniqid() without more_entropy performs badly). - (Emmanuel Dreyfus) - -20 Jul 2017, PHP 7.2.0beta1 - -- Core: - . Added new VM instuctions ISSET_ISEMPTY_CV and UNSET_CV. Previously they - were implemented as ISSET_ISEMPTY_VAR and UNSET_VAR variants with - ZEND_QUICK_SET flag. (Nikita, Dmitry) - . Fixed bug #74603 (PHP INI Parsing Stack Buffer Overflow Vulnerability). - (Stas) - . Fixed bug #74111 (Heap buffer overread (READ: 1) finish_nested_data from - unserialize). (Nikita) - . Fixed bug #74819 (wddx_deserialize() heap out-of-bound read via - php_parse_date()). (Derick) - . Fixed bug #49649 (unserialize() doesn't handle changes in property - visibility). (pmmaga) - . Fixed #74866 (extension_dir = "./ext" now use current directory for base). - (Francois Laupretre) - . Fixed bug #74923 (Crash when crawling through network share). (Anatol) - . Fixed bug #74913 (fixed incorrect poll.h include). (petk) - . Fixed bug #74906 (fixed incorrect errno.h include). (petk) - -- Date: - . Fixed bug #74852 (property_exists returns true on unknown DateInterval - property). (jhdxr) - -- DOM: - . Implement #74837 (Implement Countable for DomNodeList and DOMNamedNodeMap). - (Andreas Treichel) - -- EXIF: - . Implemented #65187 (exif_read_data/thumbnail: add support for stream - resource). (Kalle) - . Deprecated the read_exif_data() alias. (Kalle) - . Fixed bug #74428 (exif_read_data(): "Illegal IFD size" warning occurs with - correct exif format). (bradpiccho at gmail dot com, Kalle) - . Fixed bug #72819 (EXIF thumbnails not read anymore). (Kalle) - . Fixed bug #62523 (php crashes with segfault when exif_read_data called). - (Kalle) - . Fixed bug #50660 (exif_read_data(): Illegal IFD offset (works fine with - other exif readers). (skinny dot bravo at gmail dot com, Kalle) - -- GD: - . Fixed bug #74435 (Buffer over-read into uninitialized memory). (cmb) - -- IMAP: - . Fixed bug #72324 (imap_mailboxmsginfo() return wrong size). - (ronaldpoon at udomain dot com dot hk, Kalle) - -- JSON: - . Add JSON_INVALID_UTF8_IGNORE and JSON_INVALID_UTF8_SUBSTITUTE options for - json_encode and json_decode to ignore or replace invalid UTF-8 byte - sequences - it addresses request #65082. (Jakub Zelenka) - -- LDAP: - . Fixed passing an empty array to ldap_set_option for client or server controls. - -- Opcache: - . Added global optimisation passes based on data flow analysis using Single - Static Assignment (SSA) form: Sparse Conditional Constant Propagation (SCCP), - Dead Code Elimination (DCE), and removal of unused local variables - (Nikita, Dmitry) - -- OpenSSL: - . Add ssl security_level stream option to support OpenSSL security levels. - (Jakub Zelenka). - . Allow setting SNI cert and private key in separate files. (Jakub Zelenka) - . Fixed bug #74651 (negative-size-param (-1) in memcpy in zif_openssl_seal()). - (Stas) - -- PCRE: - . Fixed bug #74873 (Minor BC break: PCRE_JIT changes output of preg_match()). - (Dmitry) - -- Sodium: - . New cryptographic extension - -- SQLite3: - . Fixed bug #74883 (SQLite3::__construct() produces "out of memory" exception - with invalid flags). (Anatol) - -- ZIP: - . ZipArchive implements countable, added ZipArchive::count() method. (Remi) - . Fix segfault in php_stream_context_get_option call. (Remi) - -06 Jul 2017, PHP 7.2.0alpha3 - -- Core: - . Fixed bug #74780 (parse_url() broken when query string contains colon). + . Fixed bug #75173 (incorrect behavior of AppendIterator::append in foreach loop). (jhdxr) - . Fixed bug #74761 (Unary operator expected error on some systems). (petk) - . Allow loading PHP/Zend extensions by name in ini files (extension=). - (francois at tekwire dot net) - . Added object type annotation. (brzuchal) - . Fixed bug #74815 (crash with a combination of INI entries at startup). - (Anatol) - . Fixed bug #74836 (isset on zero-prefixed numeric indexes in array broken). - (Dmitry) - . Fixed bug #74101, bug #74614 (Unserialize Heap Use-After-Free (READ: 1) in - zval_get_type). (Nikita) - -- CLI: - . Fixed bug #74849 (Process is started as interactive shell in PhpStorm). - (Anatol) - -- LDAP: - . Implemented FR #69445 (Support for LDAP EXOP operations) - . Fixed support for LDAP_OPT_SERVER_CONTROLS and LDAP_OPT_CLIENT_CONTROLS in ldap_get_option - -- OpenSSL: - . Fixed bug #74798 (pkcs7_en/decrypt does not work if \x0a is used in content). - (Anatol) - -- SPL: - . Fixed bug #73471 (PHP freezes with AppendIterator). (jhdxr) - . Fixed bug #71412 (Incorrect arginfo for ArrayIterator::__construct). - (tysonandre775 at hotmail dot com) - -- Session: - . Fixed bug #74514 (5 session functions incorrectly warn when calling in - read-only/getter mode). (Yasuo) - -- Standard: - . Add support for extension name as argument to dl(). - (francois at tekwire dot net) - -- zlib: - . Fixed bug #73944 (dictionary option of inflate_init() does not work). - (wapmorgan) - . Expose inflate_get_status() and inflate_get_read_len() functions. - (Matthew Trescott) - -22 Jun 2017, PHP 7.2.0alpha2 - -- Core: - . Change PHP_OS_FAMILY value from "OSX" to "Darwin". (Sebastian, Kalle) - -- GD: - . Fixed bug #74744 (gd.h: stdarg.h include missing for va_list use in - gdErrorMethod). (rainer dot jung at kippdata dot de, cmb) - -- OCI8: - . Add TAF callback (PR #2459). (KoenigsKind) - . Fixed bug #74625 (Integer overflow in oci_bind_array_by_name). (Ingmar Runge) - -- OpenSSL: - . Fixed bug #74720 (pkcs7_en/decrypt does not work if \x1a is used in - content). (Anatol) - . Use TLS_ANY for default ssl:// and tls:// negotiation. (kelunik) - . Fix leak in openssl_spki_new(). (jelle at vdwaa dot nl) - . Added openssl_pkcs7_read() and pk7 parameter to openssl_pkcs7_verify(). - (jelle at vdwaa dot nl) - -- PDO_OCI: - . Fixed Bug #74537 (Align --with-pdo-oci configure option with --with-oci8 syntax). - (Tianfang Yang) - -- Standard: - . Compatibility with libargon2 versions 20161029 and 20160821. - (charlesportwoodii at erianna dot com) - . Fixed Bug #74737 (mysqli_get_client_info reflection info). - (mhagstrand at gmail dot com) - -- Streams: - . Default ssl/single_dh_use and ssl/honor_cipher_order to true. (kelunik) - -- SQLite3: - . Update to Sqlite 3.19.3. (cmb) - . Implement writing to blobs. (bohwaz at github dot com) - -08 Jun 2017, PHP 7.2.0alpha1 - -- Core: - . Added ZEND_COUNT, ZEND_GET_CLASS, ZEND_GET_CALLED_CLASS, ZEND_GET_TYPE, - ZEND_FUNC_NUM_ARGS, ZEND_FUNC_GET_ARGS instructions, to implement - corresponding builtin functions. (Dmitry) - . "Countable" interface is moved from SPL to Core. (Dmitry) - . Added ZEND_IN_ARRAY instruction, implementing optimized in_array() builtin - function, through hash lookup in flipped array. (Dmitry) - . Removed IS_TYPE_IMMUTABLE (it's the same as COPYABLE & !REFCOUNTED). (Dmitry) - . Removed the sql.safe_mode directive. (Kalle) - . Removed support for Netware. (Kalle) - . Renamed ReflectionClass::isIterateable() to ReflectionClass::isIterable() - (alias original name for BC). (Sara) - . Fixed bug #54535 (WSA cleanup executes before MSHUTDOWN). (Kalle) - . Implemented FR #69791 (Disallow mail header injections by extra headers) - (Yasuo) - . Implemented FR #49806 (proc_nice() for Windows). (Kalle) - . Fix pthreads detection when cross-compiling (ffontaine) - . Fixed memory leaks caused by exceptions thrown from destructors. (Bob, - Dmitry). - . Fixed bug #73215 (uniqid() should use better random source). (Yasuo) - . Fixed bug #73337 (try/catch not working with two exceptions inside a same - operation). (Dmitry) - . Implemented FR #72768 (Add ENABLE_VIRTUAL_TERMINAL_PROCESSING flag for - php.exe). (Michele Locati) - . Implemented "Convert numeric keys in object/array casts" RFC, fixes - bugs #53838, #61655, #66173, #70925, #72254, etc. (Andrea) - . Implemented "Deprecate and Remove Bareword (Unquoted) Strings" RFC. - (Rowan Collins) - . Raised minimum supported Windows versions to Windows 7/Server 2008 R2. - (Anatol) - . Implemented minor optimization in array_keys/array_values(). (Sara) - . Fixed bug #73969 (segfault in debug_print_backtrace). (andrewnester) - . Added PHP_OS_FAMILY constant to determine on which OS we are. (Jan Altensen) - . Fixed bug #73994 (arginfo incorrect for unpack). (krakjoe) - . Fixed bug #73973 (assertion error in debug_zval_dump). (andrewnester) - . Fixed bug #73987 (Method compatibility check looks to original - definition and not parent). (pmmaga) - . Fixed bug #73991 (JSON_OBJECT_AS_ARRAY not respected). (Sara) - . Fixed bug #74053 (Corrupted class entries on shutdown when a destructor - spawns another object). (jim at commercebyte dot com) - . Fixed bug #73971 (Filename got limited to MAX_PATH on Win32 when scan - directory). (Anatol) - . Fixed bug #74149 (static embed SAPI linkage error). (krakjoe) - . Fixed bug #72359, bug #72451, bug #73706, bug #71115 and others related - to interned strings handling in TS builds. (Anatol, Dmitry) - . Implemented "Trailing Commas In List Syntax" RFC for group use lists only. - (Sammy Kaye Powers) - . Fixed bug #74269 (It's possible to override trait property with different - loosely-equal value). (pmmaga) - . Fixed bug #61970 (Restraining __construct() access level in subclass gives - a fatal error). (pmmaga) - . Fixed bug #63384 (Cannot override an abstract method with an abstract - method). (pmmaga, wes) - . Fixed bug #74607 (Traits enforce different inheritance rules). (pmmaga) - . Fixed misparsing of abstract unix domain socket names. (Sara) - -- BCMath: - . Fixed bug #46564 (bcmod truncates fractionals). (liborm85) - -- Calendar: - . Fix integer overflows (Joshua Rogers) - -- CLI server: - . Fixed bug #60471 (Random "Invalid request (unexpected EOF)" using a router - script). (SammyK) - -- Date: - . Fixed bug #55407 (Impossible to prototype DateTime::createFromFormat). - (kelunik) - . Fixed bug #69587 (DateInterval properties and isset). (jhdxr) - . Fixed bug #74404 (Wrong reflection on DateTimeZone::getTransitions). - (krakjoe) - . Fixed bug #74080 (add constant for RFC7231 format datetime). (duncan3dc) - . Fixed bug #74639 (implement clone for DatePeriod and DateInterval). - (andrewnester) - . Implemented FR #71520 (Adding the DateTime constants to the - DateTimeInterface interface). (Majkl578) - -- Dba: - . Fixed bug #72885 (flatfile: dba_fetch() fails to read replaced entry). - (Anatol) - -- DOM: - . Fixed bug #67474 (getElementsByTagNameNS filter on default ns). (aboks) - . Fixed bug #54382 (getAttributeNodeNS doesn't get xmlns* attributes). - (aboks) - . Fixed bug #74004 (LIBXML_NOWARNING (etc) ignored by DOMDocument::loadHTML). - (somedaysummer) - -- EXIF: - . Added support for vendor specific tags for the following formats: - Samsung, DJI, Panasonic, Sony, Pentax, Minolta, Sigma/Foveon, AGFA, - Kyocera, Ricoh & Epson. (Kalle) - . Fixed bug #72682 (exif_read_data() fails to read all data for some - images). (Kalle) - . Fixed bug #71534 (Type confusion in exif_read_data() leading to heap - overflow in debug mode). (hlt99 at blinkenshell dot org, Kalle) - . Fixed bug #68547 (Exif Header component value check error). - (sjh21a at gmail dot com, Kalle) - . Fixed bug #66443 (Corrupt EXIF header: maximum directory nesting level - reached for some cameras). (Kalle) - . Fixed Redhat bug #1362571 (PHP not returning full results for - exif_read_data function). (Kalle) - -- FPM: - . Configuration to limit fpm slow log trace callers. (Sannis) - . Fixed bug #69865 (php-fpm does not close stderr when using syslog). - (Mike) - -- FTP: - . Fixed bug #74598 (ftp:// wrapper ignores context arg). (Sara) - . Implement MLSD for structured listing of directories. (blar) - -- GD: - . Implemented imageresolution as getter and setter (Christoph) - . Fixed bug #74343 (compile fails on solaris 11 with system gd2 library). - (krakjoe) - -- GMP: - . Fixed bug #70896 (gmp_fact() silently ignores non-integer input). (Sara) - -- hash: - . Fixed bug #73961 (environmental build dependency in hash sha3 source). - (krakjoe) - . Changed HashContext from resource to object. (Rouven Weßling, Sara) - . Disallowed usage of non-cryptographic hash functions with HMAC and PBKDF2. - (Andrey Andreev, Nikita) - -- intl: - . Fixed bug #74433 (wrong reflection for Normalizer methods). (villfa) - . Fixed bug #74439 (wrong reflection for Locale methods). (villfa) - . Fixed bug #74468 (wrong reflection on Collator::sortWithSortKeys). (villfa) - . Fixed bug #63790 (test using Spoofchecker which may be unavailable). (Sara) - -- Mbstring: - . Implemented request #66024 (mb_chr() and mb_ord()). (Masakielastic, Yasuo) - . Implemented request #65081 (mb_scrub()). (Masakielastic, Yasuo) - . Implemented request #69086 (enhancement for mb_convert_encoding() that - handles multibyte replacement char nicely). (Masakielastic, Yasuo) - . Added array input support to mb_convert_encoding(). (Yasuo) - . Added array input support to mb_check_encoding(). (Yasuo) - . Fixed bug #69079 (enhancement for mb_substitute_character). (masakielastic) - . Update to oniguruma version 6.3.0. (Remi) - -- Mcrypt: - . The deprecated mcrypt extension has been moved to PECL. (leigh) - -- MySQLi: - . Fixed bug #73949 (leak in mysqli_fetch_object). (krakjoe) - -- mysqlnd: - . Fixed bug #73800 (sporadic segfault with MYSQLI_OPT_INT_AND_FLOAT_NATIVE). - (vanviegen) - -- OpenSSL: - . Fixed bug #71519 (add serial hex to return value array). (xrobau) - -- PCRE: - . Added support for PCRE JIT fast path API. (dmitry) - . Fixed bug #61780 (Inconsistent PCRE captures in match results). (cmb) - -- PDO: - . Add "Sent SQL" to debug dump for emulated prepares. (Adam Baratz) - . Add parameter types for national character set strings. (Adam Baratz) - -- PDO_DBlib: - . Fixed bug #73234 (Emulated statements let value dictate parameter type). - (Adam Baratz) - . Fixed bug #73396 (bigint columns are returned as strings). (Adam Baratz) - . Expose DB-Library version as \PDO::DBLIB_ATTR_VERSION attribute on \PDO - instance. (Adam Baratz) - . Add test coverage for bug #72969. (Jeff Farr) - -- PDO_OCI: - . Fixed bug #54379 (PDO_OCI: UTF-8 output gets truncated). (gureedo / Oracle) - -- PDO_PgSQL: - . Fixed bug #73959 (lastInsertId fails to throw an exception for wrong - sequence name). (andrewnester) - -- PDO_Sqlite - . Switch to sqlite3_prepare_v2() and sqlite3_close_v2() functions (rasmus) - -- phar: - . Fixed bug #74383 (phar method parameters reflection correction). - (mhagstrand) - . Fixed bug #74196 (phar does not correctly handle names containing dots). - (mhagstrand) - . Fixed bug #74386 (Phar::__construct reflection incorrect). (villfa) - -- PHPDBG - . Added extended_value to opcode dump output. (Sara) - -- posix: - . Fixed bug #71219 (configure script incorrectly checks for ttyname_r). (atoh) - -- Session: - . Fixed bug #73461 (Prohibit session save handler recursion). (Yasuo) - . PR #2233 Removed register_globals related code and "!" can be used as $_SESSION key name. (Yasuo) - . Improved bug #73100 fix. 'user' save handler can only be set by session_set_save_handler() - . Fixed bug #69582 (session not readable by root in CLI). (EvgeniySpinov) - -- SOAP: - . Fixed bug #69137 (Peer verification fails when using a proxy with SoapClient) - (Keith Smiley) - -- SQLite3: - . Update to Sqlite 3.18.0. (cmb) - . Fixed bug #74413 (incorrect reflection for SQLite3::enableExceptions). - (krakjoe) - -- Standard: - . Add subject to mail log. (tomsommer) - . Fixed bug #31875 (get_defined_functions additional param to exclude - disabled functions). (willianveiga) - . Fixed bug #69442 (closing of fd incorrect when PTS enabled). (jaytaph) - . Fixed bug #72974 (imap is undefined service on AIX). (matthieu.sarter) - . Fixed bug #72979 (money_format stores wrong length AIX). (matthieu.sarter) - . Fixed bug #74300 (unserialize accepts two plus/minus signs for float number exponent part). - (xKerman) - . Fixed bug #74556 (stream_socket_get_name() returns '\0'). (Sara) - -- XML: - . Moved utf8_encode() and utf8_decode() to the Standard extension. (Andrea) - . Fixed bug #72135 (malformed XML causes fault) (edgarsandi) - -- xmlreader: - . Fixed bug #74457 (Wrong reflection on XMLReader::expand). (villfa) - -- XMLRPC: - . Use Zend MM for allocation in bundled libxmlrpc (Joe) - -- ZIP: - . Add support for encrypted archives. (Remi) - . Use of bundled libzip is deprecated, --with-libzip option is recommended. (Remi) - . Fixed Bug #73803 (Reflection of ZipArchive does not show public properties). (Remi) <<< NOTE: Insert NEWS from last stable release here prior to actual release! >>> diff --git a/README.GIT-RULES b/README.GIT-RULES index d7143e6b9d8cc..6ee3585931eed 100644 --- a/README.GIT-RULES +++ b/README.GIT-RULES @@ -74,7 +74,7 @@ The next few rules are more of a technical nature:: 1. All changes should first go to the lowest branch (i.e. 5.6) and then get merged up to all other branches. If a change is not needed for - later branches (i.e. fixes for features which where dropped from later + later branches (i.e. fixes for features which were dropped from later branches) an empty merge should be done. 2. All news updates intended for public viewing, such as new features, diff --git a/README.RELEASE_PROCESS b/README.RELEASE_PROCESS index 112d5036c2694..c735d5e2631d1 100644 --- a/README.RELEASE_PROCESS +++ b/README.RELEASE_PROCESS @@ -327,6 +327,28 @@ Please make sure that the mail to php-announce@ is its own completely separate e This is to make sure that replies to the announcement on php-general@ or internals@ will not accidentally hit the php-announce@ mailinglist. +Forking a new release branch +---------------------------- + +1. One week prior to cutting X.Y.0beta1, warn internals@ that your version's branch + is about to be cut, and that PHP-X.Y will be moving into feature freeze. + Try to be specific about when the branch will be cut. + Example: http://news.php.net/php.internals/99864 + +2. Just prior to cutting X.Y.0beta1, create the new branch locally. + Add a commit on master after the branch point clearing the NEWS file, and updating + main/php_versions.h and Zend/zend.h to update versions. + Example: https://github.com/php/php-src/commit/5230541ef59e0637d5522293a7d099bf18ce6af3 + Push the new branch and the commit just added to master. + +3. Immediately notify internals@ of the branch cut and advise the new merging order: + Example: http://news.php.net/php.internals/99903 + +4. Update php-web:git.php and wiki.php.net/vcs/gitworkflow to reflect the new branch: + Example: https://github.com/php/web-php/commit/74bcad4c770d95f21b7fbeeedbd76d943bb83f23 + +5. Notify nlopess@ to add PHP_X_Y tag to gcov.php.net + New Release Manager Checklist ----------------------------- diff --git a/TSRM/TODO b/TSRM/TODO deleted file mode 100644 index 82b4fedfde142..0000000000000 --- a/TSRM/TODO +++ /dev/null @@ -1,2 +0,0 @@ -- Improve the lock in ts_resource_ex() in order to cover less code. - This can probably be done by more careful hash table access diff --git a/TSRM/TSRM.c b/TSRM/TSRM.c index cde84377902a0..aff1cef84e208 100644 --- a/TSRM/TSRM.c +++ b/TSRM/TSRM.c @@ -110,11 +110,6 @@ static DWORD tls_key; # define tsrm_tls_set(what) TlsSetValue(tls_key, (void*)(what)) # define tsrm_tls_get() TlsGetValue(tls_key) -#elif defined(BETHREADS) -static int32 tls_key; -# define tsrm_tls_set(what) tls_set(tls_key, (void*)(what)) -# define tsrm_tls_get() (tsrm_tls_entry*)tls_get(tls_key) - #else # define tsrm_tls_set(what) # define tsrm_tls_get() NULL @@ -135,8 +130,6 @@ TSRM_API int tsrm_startup(int expected_threads, int expected_resources, int debu st_key_create(&tls_key, 0); #elif defined(TSRM_WIN32) tls_key = TlsAlloc(); -#elif defined(BETHREADS) - tls_key = tls_allocate(); #endif /* ensure singleton */ @@ -585,14 +578,8 @@ TSRM_API THREAD_T tsrm_thread_id(void) return pth_self(); #elif defined(PTHREADS) return pthread_self(); -#elif defined(NSAPI) - return systhread_current(); -#elif defined(PI3WEB) - return PIThread_getCurrent(); #elif defined(TSRM_ST) return st_thread_self(); -#elif defined(BETHREADS) - return find_thread(NULL); #endif }/*}}}*/ @@ -610,16 +597,8 @@ TSRM_API MUTEX_T tsrm_mutex_alloc(void) #elif defined(PTHREADS) mutexp = (pthread_mutex_t *)malloc(sizeof(pthread_mutex_t)); pthread_mutex_init(mutexp,NULL); -#elif defined(NSAPI) - mutexp = crit_init(); -#elif defined(PI3WEB) - mutexp = PIPlatform_allocLocalMutex(); #elif defined(TSRM_ST) mutexp = st_mutex_new(); -#elif defined(BETHREADS) - mutexp = (beos_ben*)malloc(sizeof(beos_ben)); - mutexp->ben = 0; - mutexp->sem = create_sem(1, "PHP sempahore"); #endif #ifdef THR_DEBUG printf("Mutex created thread: %d\n",mythreadid()); @@ -640,15 +619,8 @@ TSRM_API void tsrm_mutex_free(MUTEX_T mutexp) #elif defined(PTHREADS) pthread_mutex_destroy(mutexp); free(mutexp); -#elif defined(NSAPI) - crit_terminate(mutexp); -#elif defined(PI3WEB) - PISync_delete(mutexp); #elif defined(TSRM_ST) st_mutex_destroy(mutexp); -#elif defined(BETHREADS) - delete_sem(mutexp->sem); - free(mutexp); #endif } #ifdef THR_DEBUG @@ -674,17 +646,8 @@ TSRM_API int tsrm_mutex_lock(MUTEX_T mutexp) return -1; #elif defined(PTHREADS) return pthread_mutex_lock(mutexp); -#elif defined(NSAPI) - crit_enter(mutexp); - return 0; -#elif defined(PI3WEB) - return PISync_lock(mutexp); #elif defined(TSRM_ST) return st_mutex_lock(mutexp); -#elif defined(BETHREADS) - if (atomic_add(&mutexp->ben, 1) != 0) - return acquire_sem(mutexp->sem); - return 0; #endif }/*}}}*/ @@ -706,17 +669,8 @@ TSRM_API int tsrm_mutex_unlock(MUTEX_T mutexp) return -1; #elif defined(PTHREADS) return pthread_mutex_unlock(mutexp); -#elif defined(NSAPI) - crit_exit(mutexp); - return 0; -#elif defined(PI3WEB) - return PISync_unlock(mutexp); #elif defined(TSRM_ST) return st_mutex_unlock(mutexp); -#elif defined(BETHREADS) - if (atomic_add(&mutexp->ben, -1) != 1) - return release_sem(mutexp->sem); - return 0; #endif }/*}}}*/ diff --git a/TSRM/TSRM.h b/TSRM/TSRM.h index 39d4bcc752b8b..15ebcd7949e63 100644 --- a/TSRM/TSRM.h +++ b/TSRM/TSRM.h @@ -69,22 +69,9 @@ typedef int ts_rsrc_id; #elif defined(PTHREADS) # define THREAD_T pthread_t # define MUTEX_T pthread_mutex_t * -#elif defined(NSAPI) -# define THREAD_T SYS_THREAD -# define MUTEX_T CRITICAL -#elif defined(PI3WEB) -# define THREAD_T PIThread * -# define MUTEX_T PISync * #elif defined(TSRM_ST) # define THREAD_T st_thread_t # define MUTEX_T st_mutex_t -#elif defined(BETHREADS) -# define THREAD_T thread_id -typedef struct { - sem_id sem; - int32 ben; -} beos_ben; -# define MUTEX_T beos_ben * #endif #ifdef HAVE_SIGNAL_H diff --git a/TSRM/threads.m4 b/TSRM/threads.m4 index 57b46f251a873..efd8ee4e648e4 100644 --- a/TSRM/threads.m4 +++ b/TSRM/threads.m4 @@ -103,52 +103,47 @@ dnl -threads gcc (HP-UX) dnl AC_DEFUN([PTHREADS_CHECK],[ -if test "$beos_threads" = "1"; then - pthreads_working="yes" - ac_cv_pthreads_cflags="" -else - save_CFLAGS=$CFLAGS - save_LIBS=$LIBS - PTHREADS_ASSIGN_VARS - PTHREADS_CHECK_COMPILE - LIBS=$save_LIBS - CFLAGS=$save_CFLAGS +save_CFLAGS=$CFLAGS +save_LIBS=$LIBS +PTHREADS_ASSIGN_VARS +PTHREADS_CHECK_COMPILE +LIBS=$save_LIBS +CFLAGS=$save_CFLAGS - AC_CACHE_CHECK(for pthreads_cflags,ac_cv_pthreads_cflags,[ - ac_cv_pthreads_cflags= - if test "$pthreads_working" != "yes"; then - for flag in -kthread -pthread -pthreads -mthreads -Kthread -threads -mt -qthreaded; do - ac_save=$CFLAGS - CFLAGS="$CFLAGS $flag" - PTHREADS_CHECK_COMPILE - CFLAGS=$ac_save - if test "$pthreads_checked" = "yes"; then - ac_cv_pthreads_cflags=$flag - break - fi - done - fi - ]) +AC_CACHE_CHECK(for pthreads_cflags,ac_cv_pthreads_cflags,[ +ac_cv_pthreads_cflags= +if test "$pthreads_working" != "yes"; then + for flag in -kthread -pthread -pthreads -mthreads -Kthread -threads -mt -qthreaded; do + ac_save=$CFLAGS + CFLAGS="$CFLAGS $flag" + PTHREADS_CHECK_COMPILE + CFLAGS=$ac_save + if test "$pthreads_checked" = "yes"; then + ac_cv_pthreads_cflags=$flag + break + fi + done +fi +]) - AC_CACHE_CHECK(for pthreads_lib, ac_cv_pthreads_lib,[ - ac_cv_pthreads_lib= - if test "$pthreads_working" != "yes"; then - for lib in pthread pthreads c_r; do - ac_save=$LIBS - LIBS="$LIBS -l$lib" - PTHREADS_CHECK_COMPILE - LIBS=$ac_save - if test "$pthreads_checked" = "yes"; then - ac_cv_pthreads_lib=$lib - break - fi - done - fi - ]) +AC_CACHE_CHECK(for pthreads_lib, ac_cv_pthreads_lib,[ +ac_cv_pthreads_lib= +if test "$pthreads_working" != "yes"; then + for lib in pthread pthreads c_r; do + ac_save=$LIBS + LIBS="$LIBS -l$lib" + PTHREADS_CHECK_COMPILE + LIBS=$ac_save + if test "$pthreads_checked" = "yes"; then + ac_cv_pthreads_lib=$lib + break + fi + done +fi +]) - if test "x$ac_cv_pthreads_cflags" != "x" -o "x$ac_cv_pthreads_lib" != "x"; then - pthreads_working="yes" - fi +if test "x$ac_cv_pthreads_cflags" != "x" -o "x$ac_cv_pthreads_lib" != "x"; then + pthreads_working="yes" fi if test "$pthreads_working" = "yes"; then diff --git a/TSRM/tsrm.m4 b/TSRM/tsrm.m4 index 98aa2b8c91258..ea9f9a0da1064 100644 --- a/TSRM/tsrm.m4 +++ b/TSRM/tsrm.m4 @@ -77,19 +77,15 @@ sinclude(threads.m4) AC_DEFUN([TSRM_CHECK_PTHREADS],[ PTHREADS_CHECK + +if test "$pthreads_working" != "yes"; then + AC_MSG_ERROR(Your system seems to lack POSIX threads.) +fi -if test "$beos_threads" = "1"; then - AC_DEFINE(BETHREADS, 1, Whether to use native BeOS threads) -else - if test "$pthreads_working" != "yes"; then - AC_MSG_ERROR(Your system seems to lack POSIX threads.) - fi - - AC_DEFINE(PTHREADS, 1, Whether to use Pthreads) +AC_DEFINE(PTHREADS, 1, Whether to use Pthreads) - AC_MSG_CHECKING(for POSIX threads) - AC_MSG_RESULT(yes) -fi +AC_MSG_CHECKING(for POSIX threads) +AC_MSG_RESULT(yes) ]) AC_DEFUN([TSRM_THREADS_CHECKS],[ diff --git a/UPGRADING b/UPGRADING index d8d887f569881..de2dc910161a2 100644 --- a/UPGRADING +++ b/UPGRADING @@ -1,4 +1,4 @@ -PHP 7.2 UPGRADE NOTES +PHP 7.3 UPGRADE NOTES 1. Backward Incompatible Changes 2. New Features @@ -19,144 +19,29 @@ PHP 7.2 UPGRADE NOTES 1. Backward Incompatible Changes ======================================== -- Core: - . gettype() will now return "resource (closed)" instead of "unknown type" for - closed resources. - . is_object() will now return true for objects of class - __PHP_Incomplete_Class. - . Support for Netware operating systems has been removed. - . Casting arrays to objects (with (object) or settype()) will now convert - integer keys to string property names. This fixes the behaviour of previous - versions, where integer keys would become inaccessible properties with - integer names. - . Casting objects to arrays (with (array) or settype()), and retrieving - object properties in an array with get_object_vars(), will now convert - numeric string property names (that is, property names of the format - /^(0|(-?[1-9][0-9]*))$/ where PHP_INT_MIN <= n <= PHP_INT_MAX) to integer - keys. This fixes the behaviour of previous versions, where numeric string - property names would become inaccessible string keys. - . Unqualified references to undefined constants now generate a Warning instead - of a notice. They will generate an Error in a future version of PHP. - (https://wiki.php.net/rfc/deprecate-bareword-strings) - . Minimum supported Windows versions are Windows 7/Server 2008 R2. - . Initial trait property value compatibility check will no longer perform - any casts. (Bug #74269) - . "object" (in any case) can no longer be used as a class name. +Core: + . The ext_skel utility has been completely redesigned with new options and + some old options removed. This is now written in PHP and has no external + dependencies. + . Support for BeOS has been dropped. -- BCMath: - . The bcmod() function no longer truncates fractional numbers to integers. As - such, its behavior now follows fmod() rather than the `%` operator. For - example `bcmod('4', '3.5')` now returns '0.5' instead of '1'. +BCMath: + . All warnings thrown by BCMath functions are now using PHP's error handling. + Formerly some warnings have directly been written to stderr. + . bcmul() and bcpow() now return numbers with the requested scale. Formerly, + the returned numbers may have omitted trailing decimal zeroes. -- Hash: - . The hash_hmac(), hash_hmac_file(), hash_pbkdf2() and hash_init() (with - HASH_HMAC) functions no longer accept non-cryptographic hashes. - -- JSON - . The json_decode() option JSON_OBJECT_AS_ARRAY is used if the second - parameter (assoc) is null. Previously JSON_OBJECT_AS_ARRAY was always - ignored. - -- Session: - . Removed register_globals related code and "!" can be used as $_SESSION key name. - . Session is made to manage session status correctly and prevents invalid operations. - Only inappropriate codes are affected by this change. If you have problems with this, - it means you have problem in your code. - . Functions are made to set or return correct session status. - session_start(), session_status(), session_regenerate_id() - . Functions are made to return bool from null. These functions have void parameter - and void parameter is checked. - session_unset(), session_write_close()/session_commit(), session_abort(), - session_reset() - . Functions prohibit invalid operations with regard to session status and - HTTP header status, returns correct bool return value. - session_start(), session_set_cookie_params(), session_name(), session_module_name(), - session_set_save_handler(), session_regenerate_id(), session_cache_limiter(), - session_cache_expire(), session_unset(), session_destroy(), - session_write_close()/session_commit(), session_reset() - . INI value change by ini_set() returns update status correctly. Invalid INI modifications - are checked and made to fail. - session.name, session.save_path, session.cookie_lifetime, session.cookie_path, - session.cookie_domain, session.cookie_httponly, session.cookie_secure, - session.use_cookies, session.use_only_cookies, session.use_strict_mode, - session.referer_check, session.cache_limiter, session.cache_expire, - session.lazy_write, session.save_handler, session.serialize_handler, - session.gc_probability, session.gc_divior, session.gc_maxlifetime, - . Some E_ERRORs are changed to E_WARNING since session status is managed correctly. - session_start() - . Session no longer initialize $_SESSION for invalid and useless session. - session_start() - . When headers are already sent and try to set new INI values, session_name(), - session_module_name(), session_save_path(), session_cache_limiter() and - session_cache_expire() are no longer works. Older PHPs accepts new values even - if new values will not be effective. - This new corrected behavior may affect command line mode CLI scripts that manage - sessions. Use output buffer just like web applications to resolve problems on - CLI scripts. - -- Standard: - . Sequences generated by mt_rand() and rand() for a specific seed may differ - from PHP 7.1 on 64-bit machines. This change was necessary to resolve a - modulo bias bug in the implementation. +Standard: + . getimagesize() and related functions now report the mime type of BMP images + as image/bmp instead of image/x-ms-bmp, since the former has been registered + with the IANA (see RFC 7903). ======================================== 2. New Features ======================================== -- Core: - . It is now possible to remove argument type annotations when overriding an - inherited method. This complies with contravariance of method argument types - under the Liskov Substitution Principle. - (https://wiki.php.net/rfc/parameter-no-type-variance) - . It is now allowed to override an abstract method with another abstract - method in a child class. - (https://wiki.php.net/rfc/allow-abstract-function-override) - . A trailing comma in group use statements is now allowed. - (https://wiki.php.net/rfc/list-syntax-trailing-commas) - . The "object" type annotation is now supported. - (https://wiki.php.net/rfc/object-typehint) - -- DBA: - . Implemented support for the LMDB backend. - -- JSON: - . Added JSON_INVALID_UTF8_IGNORE and JSON_INVALID_UTF8_SUBSTITUTE options for - json_encode() and json_decode() to ignore and replace invalid UTF-8 byte - sequences, respectively. - -- OCI8: - . Added Oracle Database Transparent Application Failover (TAF) callback support. - -- PCRE: - . Added `J` modifier for setting PCRE_DUPNAMES. - . Added `PREG_UNMATCHED_AS_NULL` flag to allow distinguish between unmatched - subpatterns and empty matches by reporting NULL and "" (empty string), - respectively. - -- Sodium - . New cryptographic extension - -- SQLite3: - . Implemented writing to BLOBs. - -- Standard: - . Simplified password hashing API updated to support Argon2i hashes when PHP is compiled with libargon2 - (https://wiki.php.net/rfc/argon2_password_hash). - . proc_nice() is now supported on Windows platforms. - -- Zip: - . read/write encrypted archive, relying on libzip 1.2.0, - using new methods: - ZipArchive::setEncryptionName($name, $method [, $password]); - ZipArchive::setEncryptionIndex($index, $method [, $password]); - and new constants: - ZipArchive::EM_NONE - ZipArchive::EM_AES_128 - ZipArchive::EM_AES_192 - ZipArchive::EM_AES_256 - . accept 'password' from zip stream context - . ZipArchive implements countable, added ZipArchive::count() method. - +BCMath: + . bcscale() can now also be used as getter to retrieve the current scale in use. ======================================== 3. Changes in SAPI modules @@ -166,107 +51,17 @@ PHP 7.2 UPGRADE NOTES 4. Deprecated Functionality ======================================== -All the deprecated functionality listed in the following will be removed in -PHP 8.0. - -- Core: - . The track_errors ini directive has been deprecated. - . The __autoload() mechanism has been deprecated, use spl_autoload_register() - instead. - . The (unset) cast has been deprecated. This does not affect the unset($var) - language construct. - . The create_function() function has been deprecated, use anonymous functions - instead. - . The each() function has been deprecated, use a foreach loop instead. - . The $errcontext error handler argument has been deprecated. However, using - it does not trigger a deprecation warning for technical reasons. - -- EXIF: - . The read_exif_data() alias has been deprecated, use exif_read_data() instead. - -- GD: - . png2wbmp() and jpeg2wbmp() have been deprecated. - -- GMP: - . The gmp_random() function has been deprecated, use gmp_random_bits() or - gmp_random_range() instead. - -- Intl: - . INTL_IDNA_VARIANT_2003 has been deprecated; use INTL_IDNA_VARIANT_UTS46 - instead. - -- Mbstring: - . The mbstring.func_overload ini directive has been deprecated. - -- Standard: - . Calling parse_str() without the result argument has been deprecated. - . Calling assert() with a string argument has been deprecated, use an ordinary - expression instead. - -See also: https://wiki.php.net/rfc/deprecations_php_7_2 - ======================================== 5. Changed Functions ======================================== -- Standard: - . password_hash() can generate Argon2i hashes when the algorithm is set to PASSWORD_ARGON2I. - When using PASSWORD_ARGON2I, the following cost factors may be set: 'memory_cost', 'time_cost', - and 'threads'. These cost factors will default to 'PASSWORD_ARGON2_DEFAULT_MEMORY_COST', - 'PASSWORD_ARGON2_DEFAULT_TIME_COST', and 'PASSWORD_ARGON2_DEFAULT_THREADS' respectively if not set. - . password_verify() can verify Argon2i hashes. - . password_get_info() and password_needs_rehash() can accept Argon2i hashes. - . mail()/mb_send_mail() accept array $extra_header. Array parameter is checked against RFC 2822. - Array format is - $extra_headers = [ - 'Header-Name' => 'Header value', - 'Multiple' => ['One header', 'Another header'], - 'Multiline' = "FirstLine\r\n SecondLine", - ]; - . count() now raises a warning when an invalid parameter is passed. - Only arrays and objects implementing the Countable interface should be passed. - . pack() and unpack() now support float and double in both little and big endian. - . number_format() ensures zero values never contain a negative sign. - -- XML: - . utf8_encode() and utf8_decode() have been moved to the Standard extension - as string functions. - ======================================== 6. New Functions ======================================== -- Core: - . Added stream_isatty(). - . Added sapi_windows_vt100_support(). - -- DOM: - . DomNodeList implements Countable, added DomNodeList::count(). - . DOMNamedNodeMap implements Countable, added DOMNamedNodeMap::count(). - -- FTP: - . Added ftp_append(). - -- GD: - . Added imagesetclip() and imagegetclip(). - . Added imageopenpolygon(). - . Added imageresolution(). - . Added imagecreatefrombmp() and imagebmp(). - -- Hash: - . Added hash_hmac_algos(). - -- Mbstring: - . Added mb_chr() and mb_ord(). - . Added mb_scrub() that scrubs broken multibyte strings. - -- OCI8: - . Added oci_register_taf_callback() and oci_disable_taf_callback() for - Oracle Database TAF callback support. - -- Sockets: - . Added socket_addrinfo_lookup(), socket_addrinfo_connect(), - socket_addrinfo_bind() and socket_addrinfo_explain(). +Date: + . Added the DateTime::createFromImmutable() method, which mirrors + DateTimeImmutable::createFromMutable(). ======================================== 7. New Classes and Interfaces @@ -276,98 +71,47 @@ See also: https://wiki.php.net/rfc/deprecations_php_7_2 8. Removed Extensions and SAPIs ======================================== -- Mcrypt: - . The deprecated mcrypt extension has been moved to PECL. - . libmcrypt has not been maintained since 2007 and the continued use of this - extension is strongly discouraged. - . Users are advised to use alternatives such as OpenSSL or libsodium. - ======================================== 9. Other Changes to Extensions ======================================== -- EXIF: - . Added extended exif tag support for the following formats: - Samsung, DJI, Panasonic, Sony, Pentax, Minolta, Sigma/Foveon, - AGFA, Kyocera, Ricoh & Epson. - . exif_read_data() and exif_thumbnail() now supports a passed streams as their - first parameter. + FTP: + . Set default transfer mode to binary -- GD: - . Removed --enable-gd-native-ttf configuration option which was unused as - of PHP 5.5.0 anyway. - . imagegd() stores truecolor images as real truecolor images. Formerly, they - have been converted to palette. - . imageantialias() is now also available if compiled with a system libgd. + ODBC: + . Support for ODBCRouter has been removed. + . Support for Birdstep has been removed. -- Mbstring - . mb_check_encoding() accepts array parameter. Both key and value - encodings are checked recursively. - . mb_convert_encoding() accepts array parameter. Only value encodings - are converted recursively. - -- PDO_OCI: - . The '--with-pdo-oci' configure syntax no longer needs the vesion number of the - Oracle Instant Client. - -- pdo_sqlite - . Use sqlite3_prepare_v2() and sqlite3_close_v2() functions instead of their - legacy counterparts. + ZIP: + . Bunled libzip has been dropped, + system library is now required. ======================================== 10. New Global Constants ======================================== -- Core: - . PHP_FLOAT_DIG number of decimal digits, that can be rounded into a - float and back without precision loss - . PHP_FLOAT_EPSILON smallest representable positive number x, so then - x + 1.0 != 1.0 - . PHP_FLOAT_MIN min representable float number - . PHP_FLOAT_MAX max representable float number - . PHP_OS_FAMILY current operating system family - -- Fileinfo: - . FILEINFO_EXTENSION include list of possible file extensions - -- GD: - . IMG_EFFECT_MULTIPLY - . IMG_BMP - -- PCRE - . PREG_UNMATCHED_AS_NULL - -- Standard: - . PASSWORD_ARGON2_DEFAULT_MEMORY_COST - . PASSWORD_ARGON2_DEFAULT_TIME_COST - . PASSWORD_ARGON2_DEFAULT_THREADS - . PASSWORD_ARGON2I +PGSQL: + . Requires Postgres 9.3 + - PGSQL_DIAG_SCHEMA_NAME + - PGSQL_DIAG_TABLE_NAME + - PGSQL_DIAG_COLUMN_NAME + - PGSQL_DIAG_DATATYPE_NAME + - PGSQL_DIAG_CONSTRAINT_NAME + . Requires Postgres 9.6 + - PGSQL_DIAG_SEVERITY_NONLOCALIZED ======================================== 11. Changes to INI File Handling ======================================== -- sql.safe_mode +- birdstep.max_links . This INI directive has been removed. -- realpath_cache_size - . Set to 4096k by default - ======================================== 12. Windows Support ======================================== -- Support for VT100 console mode - - On systems starting with 10.0.10586, cmd.exe supports ANSI escape sequences. - The corresponding console mode is enabled by default on CLI on suitable - systems. As well, the function sapi_windows_vt100_support() is provided, - to control and query the corresponding information in the scripts. - ======================================== 13. Other Changes ======================================== -- Build system - - Autoconf minimal version is now 2.64. diff --git a/UPGRADING.INTERNALS b/UPGRADING.INTERNALS index 0772009bbe3e3..f505483562756 100644 --- a/UPGRADING.INTERNALS +++ b/UPGRADING.INTERNALS @@ -9,6 +9,7 @@ PHP 7.2 INTERNALS UPGRADE NOTES f. zend_arg_info.class_name removed g. ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX changed h. valid_symbol_table removed + i. array_init() and array_init_size() 2. Build system changes a. Unix build system changes @@ -48,6 +49,9 @@ PHP 7.2 INTERNALS UPGRADE NOTES h. valid_symbol_table is removed from executor_globals. Use EG(active) instead of removed EG(valid_symbol_table) + i. array_init() and array_init_size() are not functions anymore. + They don't return any values. + ======================== 2. Build system changes ======================== diff --git a/Zend/zend.c b/Zend/zend.c index d7e00e46b283d..014b9744d7a17 100644 --- a/Zend/zend.c +++ b/Zend/zend.c @@ -75,7 +75,7 @@ ZEND_API void (*zend_error_cb)(int type, const char *error_filename, const uint3 void (*zend_printf_to_smart_string)(smart_string *buf, const char *format, va_list ap); void (*zend_printf_to_smart_str)(smart_str *buf, const char *format, va_list ap); ZEND_API char *(*zend_getenv)(char *name, size_t name_len); -ZEND_API zend_string *(*zend_resolve_path)(const char *filename, int filename_len); +ZEND_API zend_string *(*zend_resolve_path)(const char *filename, size_t filename_len); void (*zend_on_timeout)(int seconds); @@ -130,7 +130,7 @@ static ZEND_INI_MH(OnUpdateAssertions) /* {{{ */ p = (zend_long *) (base+(size_t) mh_arg1); - val = zend_atol(ZSTR_VAL(new_value), (int)ZSTR_LEN(new_value)); + val = zend_atol(ZSTR_VAL(new_value), ZSTR_LEN(new_value)); if (stage != ZEND_INI_STAGE_STARTUP && stage != ZEND_INI_STAGE_SHUTDOWN && diff --git a/Zend/zend.h b/Zend/zend.h index 502eae760d25c..8ec3ec2c04b47 100644 --- a/Zend/zend.h +++ b/Zend/zend.h @@ -22,7 +22,7 @@ #ifndef ZEND_H #define ZEND_H -#define ZEND_VERSION "3.2.0-dev" +#define ZEND_VERSION "3.3.0-dev" #define ZEND_ENGINE_3 @@ -189,7 +189,7 @@ typedef struct _zend_utility_functions { void (*printf_to_smart_string_function)(smart_string *buf, const char *format, va_list ap); void (*printf_to_smart_str_function)(smart_str *buf, const char *format, va_list ap); char *(*getenv_function)(char *name, size_t name_len); - zend_string *(*resolve_path_function)(const char *filename, int filename_len); + zend_string *(*resolve_path_function)(const char *filename, size_t filename_len); } zend_utility_functions; typedef struct _zend_utility_values { @@ -269,7 +269,7 @@ extern ZEND_API int (*zend_stream_open_function)(const char *filename, zend_file extern void (*zend_printf_to_smart_string)(smart_string *buf, const char *format, va_list ap); extern void (*zend_printf_to_smart_str)(smart_str *buf, const char *format, va_list ap); extern ZEND_API char *(*zend_getenv)(char *name, size_t name_len); -extern ZEND_API zend_string *(*zend_resolve_path)(const char *filename, int filename_len); +extern ZEND_API zend_string *(*zend_resolve_path)(const char *filename, size_t filename_len); ZEND_API ZEND_COLD void zend_error(int type, const char *format, ...) ZEND_ATTRIBUTE_FORMAT(printf, 2, 3); ZEND_API ZEND_COLD void zend_throw_error(zend_class_entry *exception_ce, const char *format, ...) ZEND_ATTRIBUTE_FORMAT(printf, 2, 3); diff --git a/Zend/zend_API.c b/Zend/zend_API.c index 6ec350ebf2cef..2e8a99400021f 100644 --- a/Zend/zend_API.c +++ b/Zend/zend_API.c @@ -1084,15 +1084,6 @@ ZEND_API int zend_parse_method_parameters_ex(int flags, int num_args, zval *this } /* }}} */ -/* Argument parsing API -- andrei */ -ZEND_API int _array_init(zval *arg, uint32_t size ZEND_FILE_LINE_DC) /* {{{ */ -{ - ZVAL_NEW_ARR(arg); - _zend_hash_init(Z_ARRVAL_P(arg), size, ZVAL_PTR_DTOR, 0 ZEND_FILE_LINE_RELAY_CC); - return SUCCESS; -} -/* }}} */ - /* This function should be called after the constructor has been called * because it may call __set from the uninitialized object otherwise. */ ZEND_API void zend_merge_properties(zval *obj, HashTable *properties) /* {{{ */ diff --git a/Zend/zend_API.h b/Zend/zend_API.h index 865f5dd2914ed..c3220d268538b 100644 --- a/Zend/zend_API.h +++ b/Zend/zend_API.h @@ -390,12 +390,11 @@ ZEND_API char *zend_get_type_by_const(int type); #define DLEXPORT #endif -#define array_init(arg) _array_init((arg), 0 ZEND_FILE_LINE_CC) -#define array_init_size(arg, size) _array_init((arg), (size) ZEND_FILE_LINE_CC) +#define array_init(arg) ZVAL_ARR((arg), zend_new_array(0)) +#define array_init_size(arg, size) ZVAL_ARR((arg), zend_new_array(size)) #define object_init(arg) _object_init((arg) ZEND_FILE_LINE_CC) #define object_init_ex(arg, ce) _object_init_ex((arg), (ce) ZEND_FILE_LINE_CC) #define object_and_properties_init(arg, ce, properties) _object_and_properties_init((arg), (ce), (properties) ZEND_FILE_LINE_CC) -ZEND_API int _array_init(zval *arg, uint32_t size ZEND_FILE_LINE_DC); ZEND_API int _object_init(zval *arg ZEND_FILE_LINE_DC); ZEND_API int _object_init_ex(zval *arg, zend_class_entry *ce ZEND_FILE_LINE_DC); ZEND_API int _object_and_properties_init(zval *arg, zend_class_entry *ce, HashTable *properties ZEND_FILE_LINE_DC); @@ -762,6 +761,10 @@ ZEND_API ZEND_COLD void ZEND_FASTCALL zend_wrong_callback_error(zend_bool throw_ #define ZEND_PARSE_PARAMETERS_START(min_num_args, max_num_args) \ ZEND_PARSE_PARAMETERS_START_EX(0, min_num_args, max_num_args) +#define ZEND_PARSE_PARAMETERS_NONE() \ + ZEND_PARSE_PARAMETERS_START(0, 0) \ + ZEND_PARSE_PARAMETERS_END() + #define ZEND_PARSE_PARAMETERS_END_EX(failure) \ } while (0); \ if (UNEXPECTED(error_code != ZPP_ERROR_OK)) { \ @@ -828,7 +831,7 @@ ZEND_API ZEND_COLD void ZEND_FASTCALL zend_wrong_callback_error(zend_bool throw_ #define Z_PARAM_ARRAY_OR_OBJECT_EX(dest, check_null, separate) \ Z_PARAM_ARRAY_OR_OBJECT_EX2(dest, check_null, separate, separate) -#define Z_PARAM_ARRAY_OR_OBJECT(dest, check_null, separate) \ +#define Z_PARAM_ARRAY_OR_OBJECT(dest) \ Z_PARAM_ARRAY_OR_OBJECT_EX(dest, 0, 0) /* old "b" */ diff --git a/Zend/zend_closures.c b/Zend/zend_closures.c index 2e4e103fb51e6..c3c2ae3b3abfa 100644 --- a/Zend/zend_closures.c +++ b/Zend/zend_closures.c @@ -503,8 +503,7 @@ static HashTable *zend_closure_get_debug_info(zval *object, int *is_temp) /* {{{ *is_temp = 1; - ALLOC_HASHTABLE(debug_info); - zend_hash_init(debug_info, 8, NULL, ZVAL_PTR_DTOR, 0); + debug_info = zend_new_array(8); if (closure->func.type == ZEND_USER_FUNCTION && closure->func.op_array.static_variables) { HashTable *static_variables = closure->func.op_array.static_variables; diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index 0772bc4f1e94b..7813df396857a 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -3711,9 +3711,8 @@ static int zend_compile_func_in_array(znode *result, zend_ast_list *args) /* {{{ zend_bool ok = 1; zval *val, tmp; HashTable *src = Z_ARRVAL(array.u.constant); - HashTable *dst = emalloc(sizeof(HashTable)); + HashTable *dst = zend_new_array(zend_hash_num_elements(src)); - zend_hash_init(dst, zend_hash_num_elements(src), NULL, ZVAL_PTR_DTOR, 0); ZVAL_TRUE(&tmp); if (strict) { @@ -4239,8 +4238,7 @@ static void zend_compile_static_var_common(zend_ast *var_ast, zval *value, zend_ if (CG(active_op_array)->scope) { CG(active_op_array)->scope->ce_flags |= ZEND_HAS_STATIC_IN_METHODS; } - ALLOC_HASHTABLE(CG(active_op_array)->static_variables); - zend_hash_init(CG(active_op_array)->static_variables, 8, NULL, ZVAL_PTR_DTOR, 0); + CG(active_op_array)->static_variables = zend_new_array(8); } if (GC_REFCOUNT(CG(active_op_array)->static_variables) > 1) { diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c index ae9d00684d6f9..a4bdf03b21335 100644 --- a/Zend/zend_execute.c +++ b/Zend/zend_execute.c @@ -1698,8 +1698,7 @@ static zend_always_inline void zend_fetch_dimension_address(zval *result, zval * } if (EXPECTED(Z_TYPE_P(container) <= IS_FALSE)) { if (type != BP_VAR_UNSET) { - ZVAL_NEW_ARR(container); - zend_hash_init(Z_ARRVAL_P(container), 8, NULL, ZVAL_PTR_DTOR, 0); + array_init(container); goto fetch_from_array; } else { /* for read-mode only */ @@ -1902,7 +1901,7 @@ static zend_always_inline void zend_fetch_property_address(zval *result, zval *c zend_object *zobj = Z_OBJ_P(container); zval *retval; - if (EXPECTED(prop_offset != (uint32_t)ZEND_DYNAMIC_PROPERTY_OFFSET)) { + if (EXPECTED(IS_VALID_PROPERTY_OFFSET(prop_offset))) { retval = OBJ_PROP(zobj, prop_offset); if (EXPECTED(Z_TYPE_P(retval) != IS_UNDEF)) { ZVAL_INDIRECT(result, retval); @@ -2783,7 +2782,7 @@ static zend_never_inline zend_op_array* ZEND_FASTCALL zend_include_or_eval(zval zend_file_handle file_handle; zend_string *resolved_path; - resolved_path = zend_resolve_path(Z_STRVAL_P(inc_filename), (int)Z_STRLEN_P(inc_filename)); + resolved_path = zend_resolve_path(Z_STRVAL_P(inc_filename), Z_STRLEN_P(inc_filename)); if (resolved_path) { if (zend_hash_exists(&EG(included_files), resolved_path)) { goto already_compiled; diff --git a/Zend/zend_execute_API.c b/Zend/zend_execute_API.c index a619b3ccf32be..cd81eedbdda7a 100644 --- a/Zend/zend_execute_API.c +++ b/Zend/zend_execute_API.c @@ -1527,8 +1527,7 @@ ZEND_API zend_array *zend_rebuild_symbol_table(void) /* {{{ */ } zend_hash_extend(symbol_table, ex->func->op_array.last_var, 0); } else { - symbol_table = ex->symbol_table = emalloc(sizeof(zend_array)); - zend_hash_init(symbol_table, ex->func->op_array.last_var, NULL, ZVAL_PTR_DTOR, 0); + symbol_table = ex->symbol_table = zend_new_array(ex->func->op_array.last_var); if (!ex->func->op_array.last_var) { return symbol_table; } diff --git a/Zend/zend_hash.c b/Zend/zend_hash.c index c1ac05cc3db80..5f03ce86b04c4 100644 --- a/Zend/zend_hash.c +++ b/Zend/zend_hash.c @@ -74,7 +74,7 @@ static void _zend_is_inconsistent(const HashTable *ht, const char *file, int lin #define HASH_PROTECT_RECURSION(ht) \ if ((ht)->u.flags & HASH_FLAG_APPLY_PROTECTION) { \ - if (((ht)->u.flags & ZEND_HASH_APPLY_COUNT_MASK) >= (3 << 8)) { \ + if (((ht)->u.flags & ZEND_HASH_APPLY_COUNT_MASK) >= (3 << ZEND_HASH_APPLY_SHIFT)) {\ zend_error_noreturn(E_ERROR, "Nesting level too deep - recursive dependency?");\ } \ ZEND_HASH_INC_APPLY_COUNT(ht); \ @@ -170,11 +170,11 @@ static zend_always_inline void zend_hash_check_init(HashTable *ht, int packed) static const uint32_t uninitialized_bucket[-HT_MIN_MASK] = {HT_INVALID_IDX, HT_INVALID_IDX}; -ZEND_API void ZEND_FASTCALL _zend_hash_init(HashTable *ht, uint32_t nSize, dtor_func_t pDestructor, zend_bool persistent ZEND_FILE_LINE_DC) +static zend_always_inline void _zend_hash_init_int(HashTable *ht, uint32_t nSize, dtor_func_t pDestructor, zend_bool persistent, zend_bool bApplyProtection) { GC_REFCOUNT(ht) = 1; GC_TYPE_INFO(ht) = IS_ARRAY | (persistent ? 0 : (GC_COLLECTABLE << GC_FLAGS_SHIFT)); - ht->u.flags = (persistent ? HASH_FLAG_PERSISTENT : 0) | HASH_FLAG_APPLY_PROTECTION | HASH_FLAG_STATIC_KEYS; + ht->u.flags = (persistent ? HASH_FLAG_PERSISTENT : 0) | (bApplyProtection ? HASH_FLAG_APPLY_PROTECTION : 0) | HASH_FLAG_STATIC_KEYS; ht->nTableMask = HT_MIN_MASK; HT_SET_DATA_ADDR(ht, &uninitialized_bucket); ht->nNumUsed = 0; @@ -185,6 +185,18 @@ ZEND_API void ZEND_FASTCALL _zend_hash_init(HashTable *ht, uint32_t nSize, dtor_ ht->nTableSize = zend_hash_check_size(nSize); } +ZEND_API void ZEND_FASTCALL _zend_hash_init(HashTable *ht, uint32_t nSize, dtor_func_t pDestructor, zend_bool persistent) +{ + _zend_hash_init_int(ht, nSize, pDestructor, persistent, 1); +} + +ZEND_API HashTable* ZEND_FASTCALL _zend_new_array(uint32_t nSize ZEND_FILE_LINE_DC) +{ + HashTable *ht = emalloc(sizeof(HashTable)); + _zend_hash_init_int(ht, nSize, ZVAL_PTR_DTOR, 0, 1); + return ht; +} + static void ZEND_FASTCALL zend_hash_packed_grow(HashTable *ht) { HT_ASSERT_RC1(ht); @@ -233,12 +245,9 @@ ZEND_API void ZEND_FASTCALL zend_hash_to_packed(HashTable *ht) pefree(old_data, (ht)->u.flags & HASH_FLAG_PERSISTENT); } -ZEND_API void ZEND_FASTCALL _zend_hash_init_ex(HashTable *ht, uint32_t nSize, dtor_func_t pDestructor, zend_bool persistent, zend_bool bApplyProtection ZEND_FILE_LINE_DC) +ZEND_API void ZEND_FASTCALL _zend_hash_init_ex(HashTable *ht, uint32_t nSize, dtor_func_t pDestructor, zend_bool persistent, zend_bool bApplyProtection) { - _zend_hash_init(ht, nSize, pDestructor, persistent ZEND_FILE_LINE_RELAY_CC); - if (!bApplyProtection) { - ht->u.flags &= ~HASH_FLAG_APPLY_PROTECTION; - } + _zend_hash_init_int(ht, nSize, pDestructor, persistent, bApplyProtection); } ZEND_API void ZEND_FASTCALL zend_hash_extend(HashTable *ht, uint32_t nSize, zend_bool packed) @@ -2507,9 +2516,7 @@ ZEND_API HashTable* ZEND_FASTCALL zend_symtable_to_proptable(HashTable *ht) convert: { - HashTable *new_ht = emalloc(sizeof(HashTable)); - - zend_hash_init(new_ht, zend_hash_num_elements(ht), NULL, ZVAL_PTR_DTOR, 0); + HashTable *new_ht = zend_new_array(zend_hash_num_elements(ht)); ZEND_HASH_FOREACH_KEY_VAL(ht, num_key, str_key, zv) { if (!str_key) { @@ -2567,9 +2574,7 @@ ZEND_API HashTable* ZEND_FASTCALL zend_proptable_to_symtable(HashTable *ht, zend convert: { - HashTable *new_ht = emalloc(sizeof(HashTable)); - - zend_hash_init(new_ht, zend_hash_num_elements(ht), NULL, ZVAL_PTR_DTOR, 0); + HashTable *new_ht = zend_new_array(zend_hash_num_elements(ht)); ZEND_HASH_FOREACH_KEY_VAL(ht, num_key, str_key, zv) { do { diff --git a/Zend/zend_hash.h b/Zend/zend_hash.h index fc91dfb8c92ea..e362b5557b423 100644 --- a/Zend/zend_hash.h +++ b/Zend/zend_hash.h @@ -68,12 +68,15 @@ typedef zend_bool (*merge_checker_func_t)(HashTable *target_ht, zval *source_dat BEGIN_EXTERN_C() /* startup/shutdown */ -ZEND_API void ZEND_FASTCALL _zend_hash_init(HashTable *ht, uint32_t nSize, dtor_func_t pDestructor, zend_bool persistent ZEND_FILE_LINE_DC); -ZEND_API void ZEND_FASTCALL _zend_hash_init_ex(HashTable *ht, uint32_t nSize, dtor_func_t pDestructor, zend_bool persistent, zend_bool bApplyProtection ZEND_FILE_LINE_DC); +ZEND_API void ZEND_FASTCALL _zend_hash_init(HashTable *ht, uint32_t nSize, dtor_func_t pDestructor, zend_bool persistent); +ZEND_API void ZEND_FASTCALL _zend_hash_init_ex(HashTable *ht, uint32_t nSize, dtor_func_t pDestructor, zend_bool persistent, zend_bool bApplyProtection); ZEND_API void ZEND_FASTCALL zend_hash_destroy(HashTable *ht); ZEND_API void ZEND_FASTCALL zend_hash_clean(HashTable *ht); -#define zend_hash_init(ht, nSize, pHashFunction, pDestructor, persistent) _zend_hash_init((ht), (nSize), (pDestructor), (persistent) ZEND_FILE_LINE_CC) -#define zend_hash_init_ex(ht, nSize, pHashFunction, pDestructor, persistent, bApplyProtection) _zend_hash_init_ex((ht), (nSize), (pDestructor), (persistent), (bApplyProtection) ZEND_FILE_LINE_CC) + +#define zend_hash_init(ht, nSize, pHashFunction, pDestructor, persistent) \ + _zend_hash_init((ht), (nSize), (pDestructor), (persistent)) +#define zend_hash_init_ex(ht, nSize, pHashFunction, pDestructor, persistent, bApplyProtection) \ + _zend_hash_init_ex((ht), (nSize), (pDestructor), (persistent), (bApplyProtection)) ZEND_API void ZEND_FASTCALL zend_hash_real_init(HashTable *ht, zend_bool packed); ZEND_API void ZEND_FASTCALL zend_hash_packed_to_hash(HashTable *ht); @@ -250,6 +253,10 @@ ZEND_API zval* ZEND_FASTCALL zend_hash_minmax(const HashTable *ht, compare_func_ ZEND_API int ZEND_FASTCALL zend_hash_rehash(HashTable *ht); +#define zend_new_array(size) \ + _zend_new_array(size ZEND_FILE_LINE_CC) + +ZEND_API HashTable* ZEND_FASTCALL _zend_new_array(uint32_t size ZEND_FILE_LINE_DC); ZEND_API uint32_t zend_array_count(HashTable *ht); ZEND_API HashTable* ZEND_FASTCALL zend_array_dup(HashTable *source); ZEND_API void ZEND_FASTCALL zend_array_destroy(HashTable *ht); diff --git a/Zend/zend_ini.c b/Zend/zend_ini.c index 54ee1492229fc..b9212d6d8b750 100644 --- a/Zend/zend_ini.c +++ b/Zend/zend_ini.c @@ -658,7 +658,7 @@ ZEND_API ZEND_INI_MH(OnUpdateLong) /* {{{ */ p = (zend_long *) (base+(size_t) mh_arg1); - *p = zend_atol(ZSTR_VAL(new_value), (int)ZSTR_LEN(new_value)); + *p = zend_atol(ZSTR_VAL(new_value), ZSTR_LEN(new_value)); return SUCCESS; } /* }}} */ @@ -674,7 +674,7 @@ ZEND_API ZEND_INI_MH(OnUpdateLongGEZero) /* {{{ */ base = (char *) ts_resource(*((int *) mh_arg2)); #endif - tmp = zend_atol(ZSTR_VAL(new_value), (int)ZSTR_LEN(new_value)); + tmp = zend_atol(ZSTR_VAL(new_value), ZSTR_LEN(new_value)); if (tmp < 0) { return FAILURE; } diff --git a/Zend/zend_ini.h b/Zend/zend_ini.h index 41d38adcef7bd..7c4fa39025b6b 100644 --- a/Zend/zend_ini.h +++ b/Zend/zend_ini.h @@ -38,10 +38,10 @@ typedef struct _zend_ini_entry_def { void *mh_arg3; const char *value; void (*displayer)(zend_ini_entry *ini_entry, int type); - int modifiable; - uint32_t name_length; uint32_t value_length; + uint16_t name_length; + uint8_t modifiable; } zend_ini_entry_def; struct _zend_ini_entry { @@ -53,11 +53,13 @@ struct _zend_ini_entry { zend_string *value; zend_string *orig_value; void (*displayer)(zend_ini_entry *ini_entry, int type); - int modifiable; - int orig_modifiable; - int modified; int module_number; + + uint8_t modifiable; + uint8_t orig_modifiable; + uint8_t modified; + }; BEGIN_EXTERN_C() @@ -97,7 +99,7 @@ END_EXTERN_C() #define ZEND_INI_END() { NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 0} }; #define ZEND_INI_ENTRY3_EX(name, default_value, modifiable, on_modify, arg1, arg2, arg3, displayer) \ - { name, on_modify, arg1, arg2, arg3, default_value, displayer, modifiable, sizeof(name)-1, sizeof(default_value)-1 }, + { name, on_modify, arg1, arg2, arg3, default_value, displayer, sizeof(default_value)-1, sizeof(name)-1, modifiable }, #define ZEND_INI_ENTRY3(name, default_value, modifiable, on_modify, arg1, arg2, arg3) \ ZEND_INI_ENTRY3_EX(name, default_value, modifiable, on_modify, arg1, arg2, arg3, NULL) diff --git a/Zend/zend_object_handlers.c b/Zend/zend_object_handlers.c index df675a987d403..a11664ff0e0ec 100644 --- a/Zend/zend_object_handlers.c +++ b/Zend/zend_object_handlers.c @@ -35,6 +35,9 @@ #define DEBUG_OBJECT_HANDLERS 0 +#define ZEND_WRONG_PROPERTY_OFFSET 0 +#define ZEND_DYNAMIC_PROPERTY_OFFSET ((uint32_t)(-1)) + /* guard flags */ #define IN_GET (1<<0) #define IN_SET (1<<1) @@ -76,8 +79,7 @@ ZEND_API void rebuild_object_properties(zend_object *zobj) /* {{{ */ zend_property_info *prop_info; zend_class_entry *ce = zobj->ce; - ALLOC_HASHTABLE(zobj->properties); - zend_hash_init(zobj->properties, ce->default_properties_count, NULL, ZVAL_PTR_DTOR, 0); + zobj->properties = zend_new_array(ce->default_properties_count); if (ce->default_properties_count) { zend_hash_real_init(zobj->properties, 0); zobj->properties->nInternalPointer = 0; @@ -177,8 +179,7 @@ ZEND_API HashTable *zend_std_get_debug_info(zval *object, int *is_temp) /* {{{ * } } else if (Z_TYPE(retval) == IS_NULL) { *is_temp = 1; - ALLOC_HASHTABLE(ht); - zend_hash_init(ht, 0, NULL, ZVAL_PTR_DTOR, 0); + ht = zend_new_array(0); return ht; } @@ -582,13 +583,13 @@ zval *zend_std_read_property(zval *object, zval *member, int type, void **cache_ /* make zend_get_property_info silent if we have getter - we may want to use it */ property_offset = zend_get_property_offset(zobj->ce, Z_STR_P(member), (type == BP_VAR_IS) || (zobj->ce->__get != NULL), cache_slot); - if (EXPECTED(property_offset != ZEND_WRONG_PROPERTY_OFFSET)) { - if (EXPECTED(property_offset != ZEND_DYNAMIC_PROPERTY_OFFSET)) { - retval = OBJ_PROP(zobj, property_offset); - if (EXPECTED(Z_TYPE_P(retval) != IS_UNDEF)) { - goto exit; - } - } else if (EXPECTED(zobj->properties != NULL)) { + if (EXPECTED(IS_VALID_PROPERTY_OFFSET(property_offset))) { + retval = OBJ_PROP(zobj, property_offset); + if (EXPECTED(Z_TYPE_P(retval) != IS_UNDEF)) { + goto exit; + } + } else if (EXPECTED(IS_DYNAMIC_PROPERTY_OFFSET(property_offset))) { + if (EXPECTED(zobj->properties != NULL)) { retval = zend_hash_find(zobj->properties, Z_STR_P(member)); if (EXPECTED(retval)) goto exit; } @@ -688,13 +689,13 @@ ZEND_API void zend_std_write_property(zval *object, zval *member, zval *value, v property_offset = zend_get_property_offset(zobj->ce, Z_STR_P(member), (zobj->ce->__set != NULL), cache_slot); - if (EXPECTED(property_offset != ZEND_WRONG_PROPERTY_OFFSET)) { - if (EXPECTED(property_offset != ZEND_DYNAMIC_PROPERTY_OFFSET)) { - variable_ptr = OBJ_PROP(zobj, property_offset); - if (Z_TYPE_P(variable_ptr) != IS_UNDEF) { - goto found; - } - } else if (EXPECTED(zobj->properties != NULL)) { + if (EXPECTED(IS_VALID_PROPERTY_OFFSET(property_offset))) { + variable_ptr = OBJ_PROP(zobj, property_offset); + if (Z_TYPE_P(variable_ptr) != IS_UNDEF) { + goto found; + } + } else if (EXPECTED(IS_DYNAMIC_PROPERTY_OFFSET(property_offset))) { + if (EXPECTED(zobj->properties != NULL)) { if (UNEXPECTED(GC_REFCOUNT(zobj->properties) > 1)) { if (EXPECTED(!(GC_FLAGS(zobj->properties) & IS_ARRAY_IMMUTABLE))) { GC_REFCOUNT(zobj->properties)--; @@ -723,7 +724,7 @@ ZEND_API void zend_std_write_property(zval *object, zval *member, zval *value, v zend_std_call_setter(&tmp_object, member, value); (*guard) &= ~IN_SET; zval_ptr_dtor(&tmp_object); - } else if (EXPECTED(property_offset != ZEND_WRONG_PROPERTY_OFFSET)) { + } else if (EXPECTED(!IS_WRONG_PROPERTY_OFFSET(property_offset))) { goto write_std_property; } else { if (Z_STRVAL_P(member)[0] == '\0' && Z_STRLEN_P(member) != 0) { @@ -731,7 +732,7 @@ ZEND_API void zend_std_write_property(zval *object, zval *member, zval *value, v goto exit; } } - } else if (EXPECTED(property_offset != ZEND_WRONG_PROPERTY_OFFSET)) { + } else if (EXPECTED(!IS_WRONG_PROPERTY_OFFSET(property_offset))) { zval tmp; write_std_property: @@ -744,7 +745,7 @@ ZEND_API void zend_std_write_property(zval *object, zval *member, zval *value, v Z_ADDREF_P(value); } } - if (EXPECTED(property_offset != ZEND_DYNAMIC_PROPERTY_OFFSET)) { + if (EXPECTED(IS_VALID_PROPERTY_OFFSET(property_offset))) { ZVAL_COPY_VALUE(OBJ_PROP(zobj, property_offset), value); } else { if (!zobj->properties) { @@ -878,49 +879,47 @@ static zval *zend_std_get_property_ptr_ptr(zval *object, zval *member, int type, property_offset = zend_get_property_offset(zobj->ce, name, (zobj->ce->__get != NULL), cache_slot); - if (EXPECTED(property_offset != ZEND_WRONG_PROPERTY_OFFSET)) { - if (EXPECTED(property_offset != ZEND_DYNAMIC_PROPERTY_OFFSET)) { - retval = OBJ_PROP(zobj, property_offset); - if (UNEXPECTED(Z_TYPE_P(retval) == IS_UNDEF)) { - if (EXPECTED(!zobj->ce->__get) || - UNEXPECTED((*zend_get_property_guard(zobj, name)) & IN_GET)) { - ZVAL_NULL(retval); - /* Notice is thrown after creation of the property, to avoid EG(std_property_info) - * being overwritten in an error handler. */ - if (UNEXPECTED(type == BP_VAR_RW || type == BP_VAR_R)) { - zend_error(E_NOTICE, "Undefined property: %s::$%s", ZSTR_VAL(zobj->ce->name), ZSTR_VAL(name)); - } - } else { - /* we do have getter - fail and let it try again with usual get/set */ - retval = NULL; - } - } - } else { - if (EXPECTED(zobj->properties)) { - if (UNEXPECTED(GC_REFCOUNT(zobj->properties) > 1)) { - if (EXPECTED(!(GC_FLAGS(zobj->properties) & IS_ARRAY_IMMUTABLE))) { - GC_REFCOUNT(zobj->properties)--; - } - zobj->properties = zend_array_dup(zobj->properties); - } - if (EXPECTED((retval = zend_hash_find(zobj->properties, name)) != NULL)) { - if (UNEXPECTED(Z_TYPE_P(member) != IS_STRING)) { - zend_string_release(name); - } - return retval; - } - } + if (EXPECTED(IS_VALID_PROPERTY_OFFSET(property_offset))) { + retval = OBJ_PROP(zobj, property_offset); + if (UNEXPECTED(Z_TYPE_P(retval) == IS_UNDEF)) { if (EXPECTED(!zobj->ce->__get) || UNEXPECTED((*zend_get_property_guard(zobj, name)) & IN_GET)) { - if (UNEXPECTED(!zobj->properties)) { - rebuild_object_properties(zobj); - } - retval = zend_hash_update(zobj->properties, name, &EG(uninitialized_zval)); + ZVAL_NULL(retval); /* Notice is thrown after creation of the property, to avoid EG(std_property_info) * being overwritten in an error handler. */ if (UNEXPECTED(type == BP_VAR_RW || type == BP_VAR_R)) { zend_error(E_NOTICE, "Undefined property: %s::$%s", ZSTR_VAL(zobj->ce->name), ZSTR_VAL(name)); } + } else { + /* we do have getter - fail and let it try again with usual get/set */ + retval = NULL; + } + } + } else if (EXPECTED(IS_DYNAMIC_PROPERTY_OFFSET(property_offset))) { + if (EXPECTED(zobj->properties)) { + if (UNEXPECTED(GC_REFCOUNT(zobj->properties) > 1)) { + if (EXPECTED(!(GC_FLAGS(zobj->properties) & IS_ARRAY_IMMUTABLE))) { + GC_REFCOUNT(zobj->properties)--; + } + zobj->properties = zend_array_dup(zobj->properties); + } + if (EXPECTED((retval = zend_hash_find(zobj->properties, name)) != NULL)) { + if (UNEXPECTED(Z_TYPE_P(member) != IS_STRING)) { + zend_string_release(name); + } + return retval; + } + } + if (EXPECTED(!zobj->ce->__get) || + UNEXPECTED((*zend_get_property_guard(zobj, name)) & IN_GET)) { + if (UNEXPECTED(!zobj->properties)) { + rebuild_object_properties(zobj); + } + retval = zend_hash_update(zobj->properties, name, &EG(uninitialized_zval)); + /* Notice is thrown after creation of the property, to avoid EG(std_property_info) + * being overwritten in an error handler. */ + if (UNEXPECTED(type == BP_VAR_RW || type == BP_VAR_R)) { + zend_error(E_NOTICE, "Undefined property: %s::$%s", ZSTR_VAL(zobj->ce->name), ZSTR_VAL(name)); } } } @@ -949,28 +948,27 @@ static void zend_std_unset_property(zval *object, zval *member, void **cache_slo property_offset = zend_get_property_offset(zobj->ce, Z_STR_P(member), (zobj->ce->__unset != NULL), cache_slot); - if (EXPECTED(property_offset != ZEND_WRONG_PROPERTY_OFFSET)) { - if (EXPECTED(property_offset != ZEND_DYNAMIC_PROPERTY_OFFSET)) { - zval *slot = OBJ_PROP(zobj, property_offset); + if (EXPECTED(IS_VALID_PROPERTY_OFFSET(property_offset))) { + zval *slot = OBJ_PROP(zobj, property_offset); - if (Z_TYPE_P(slot) != IS_UNDEF) { - zval_ptr_dtor(slot); - ZVAL_UNDEF(slot); - if (zobj->properties) { - zobj->properties->u.v.flags |= HASH_FLAG_HAS_EMPTY_IND; - } - goto exit; - } - } else if (EXPECTED(zobj->properties != NULL)) { - if (UNEXPECTED(GC_REFCOUNT(zobj->properties) > 1)) { - if (EXPECTED(!(GC_FLAGS(zobj->properties) & IS_ARRAY_IMMUTABLE))) { - GC_REFCOUNT(zobj->properties)--; - } - zobj->properties = zend_array_dup(zobj->properties); + if (Z_TYPE_P(slot) != IS_UNDEF) { + zval_ptr_dtor(slot); + ZVAL_UNDEF(slot); + if (zobj->properties) { + zobj->properties->u.v.flags |= HASH_FLAG_HAS_EMPTY_IND; } - if (EXPECTED(zend_hash_del(zobj->properties, Z_STR_P(member)) != FAILURE)) { - goto exit; + goto exit; + } + } else if (EXPECTED(IS_DYNAMIC_PROPERTY_OFFSET(property_offset)) + && EXPECTED(zobj->properties != NULL)) { + if (UNEXPECTED(GC_REFCOUNT(zobj->properties) > 1)) { + if (EXPECTED(!(GC_FLAGS(zobj->properties) & IS_ARRAY_IMMUTABLE))) { + GC_REFCOUNT(zobj->properties)--; } + zobj->properties = zend_array_dup(zobj->properties); + } + if (EXPECTED(zend_hash_del(zobj->properties, Z_STR_P(member)) != FAILURE)) { + goto exit; } } else if (UNEXPECTED(EG(exception))) { goto exit; @@ -1524,13 +1522,13 @@ static int zend_std_has_property(zval *object, zval *member, int has_set_exists, property_offset = zend_get_property_offset(zobj->ce, Z_STR_P(member), 1, cache_slot); - if (EXPECTED(property_offset != ZEND_WRONG_PROPERTY_OFFSET)) { - if (EXPECTED(property_offset != ZEND_DYNAMIC_PROPERTY_OFFSET)) { - value = OBJ_PROP(zobj, property_offset); - if (Z_TYPE_P(value) != IS_UNDEF) { - goto found; - } - } else if (EXPECTED(zobj->properties != NULL) && + if (EXPECTED(IS_VALID_PROPERTY_OFFSET(property_offset))) { + value = OBJ_PROP(zobj, property_offset); + if (Z_TYPE_P(value) != IS_UNDEF) { + goto found; + } + } else if (EXPECTED(IS_DYNAMIC_PROPERTY_OFFSET(property_offset))) { + if (EXPECTED(zobj->properties != NULL) && (value = zend_hash_find(zobj->properties, Z_STR_P(member))) != NULL) { found: switch (has_set_exists) { diff --git a/Zend/zend_object_handlers.h b/Zend/zend_object_handlers.h index 819185320f242..656ff4881c006 100644 --- a/Zend/zend_object_handlers.h +++ b/Zend/zend_object_handlers.h @@ -27,8 +27,9 @@ struct _zend_property_info; #define ZEND_WRONG_PROPERTY_INFO \ ((struct _zend_property_info*)((zend_intptr_t)-1)) -#define ZEND_DYNAMIC_PROPERTY_OFFSET ((uint32_t)(-1)) -#define ZEND_WRONG_PROPERTY_OFFSET ((uint32_t)(-2)) +#define IS_VALID_PROPERTY_OFFSET(offset) ((int32_t)(offset) > 0) +#define IS_WRONG_PROPERTY_OFFSET(offset) ((int32_t)(offset) == 0) +#define IS_DYNAMIC_PROPERTY_OFFSET(offset) ((int32_t)(offset) < 0) /* The following rule applies to read_property() and read_dimension() implementations: If you return a zval which is not otherwise referenced by the extension or the engine's diff --git a/Zend/zend_objects.c b/Zend/zend_objects.c index d5c375f6edcfd..123e5db238ecd 100644 --- a/Zend/zend_objects.c +++ b/Zend/zend_objects.c @@ -197,8 +197,7 @@ ZEND_API void zend_objects_clone_members(zend_object *new_object, zend_object *o zend_string *key; if (!new_object->properties) { - ALLOC_HASHTABLE(new_object->properties); - zend_hash_init(new_object->properties, zend_hash_num_elements(old_object->properties), NULL, ZVAL_PTR_DTOR, 0); + new_object->properties = zend_new_array(zend_hash_num_elements(old_object->properties)); zend_hash_real_init(new_object->properties, 0); } else { zend_hash_extend(new_object->properties, new_object->properties->nNumUsed + zend_hash_num_elements(old_object->properties), 0); diff --git a/Zend/zend_operators.c b/Zend/zend_operators.c index 2054bbcee77b2..781a1825e97cf 100644 --- a/Zend/zend_operators.c +++ b/Zend/zend_operators.c @@ -80,12 +80,12 @@ static const unsigned char tolower_map[256] = { zend_binary_strncasecmp */ -ZEND_API int ZEND_FASTCALL zend_atoi(const char *str, int str_len) /* {{{ */ +ZEND_API int ZEND_FASTCALL zend_atoi(const char *str, size_t str_len) /* {{{ */ { int retval; if (!str_len) { - str_len = (int)strlen(str); + str_len = strlen(str); } retval = ZEND_STRTOL(str, NULL, 0); if (str_len>0) { @@ -108,12 +108,12 @@ ZEND_API int ZEND_FASTCALL zend_atoi(const char *str, int str_len) /* {{{ */ } /* }}} */ -ZEND_API zend_long ZEND_FASTCALL zend_atol(const char *str, int str_len) /* {{{ */ +ZEND_API zend_long ZEND_FASTCALL zend_atol(const char *str, size_t str_len) /* {{{ */ { zend_long retval; if (!str_len) { - str_len = (int)strlen(str); + str_len = strlen(str); } retval = ZEND_STRTOL(str, NULL, 0); if (str_len>0) { @@ -583,8 +583,7 @@ static void convert_scalar_to_array(zval *op) /* {{{ */ ZVAL_COPY_VALUE(&entry, op); - ZVAL_NEW_ARR(op); - zend_hash_init(Z_ARRVAL_P(op), 8, NULL, ZVAL_PTR_DTOR, 0); + array_init_size(op, 1); zend_hash_index_add_new(Z_ARRVAL_P(op), 0, &entry); } /* }}} */ @@ -634,8 +633,7 @@ ZEND_API void ZEND_FASTCALL convert_to_array(zval *op) /* {{{ */ } break; case IS_NULL: - ZVAL_NEW_ARR(op); - zend_hash_init(Z_ARRVAL_P(op), 8, NULL, ZVAL_PTR_DTOR, 0); + array_init(op); break; case IS_REFERENCE: zend_unwrap_reference(op); diff --git a/Zend/zend_operators.h b/Zend/zend_operators.h index 9c2df28479cca..b2f53785bdf88 100644 --- a/Zend/zend_operators.h +++ b/Zend/zend_operators.h @@ -366,8 +366,8 @@ ZEND_API int ZEND_FASTCALL zend_compare_symbol_tables(HashTable *ht1, HashTable ZEND_API int ZEND_FASTCALL zend_compare_arrays(zval *a1, zval *a2); ZEND_API int ZEND_FASTCALL zend_compare_objects(zval *o1, zval *o2); -ZEND_API int ZEND_FASTCALL zend_atoi(const char *str, int str_len); -ZEND_API zend_long ZEND_FASTCALL zend_atol(const char *str, int str_len); +ZEND_API int ZEND_FASTCALL zend_atoi(const char *str, size_t str_len); +ZEND_API zend_long ZEND_FASTCALL zend_atol(const char *str, size_t str_len); ZEND_API void ZEND_FASTCALL zend_locale_sprintf_double(zval *op ZEND_FILE_LINE_DC); diff --git a/Zend/zend_smart_string.h b/Zend/zend_smart_string.h index 2282202792ac5..12d755ee41097 100644 --- a/Zend/zend_smart_string.h +++ b/Zend/zend_smart_string.h @@ -136,6 +136,10 @@ static zend_always_inline void smart_string_setl(smart_string *dest, char *src, dest->c = src; } +static zend_always_inline void smart_string_reset(smart_string *str) { + str->len = 0; +} + #endif /* diff --git a/Zend/zend_ts_hash.c b/Zend/zend_ts_hash.c index fab54672fc239..66af862884521 100644 --- a/Zend/zend_ts_hash.c +++ b/Zend/zend_ts_hash.c @@ -59,24 +59,24 @@ static void end_write(TsHashTable *ht) } /* delegates */ -ZEND_API void _zend_ts_hash_init(TsHashTable *ht, uint32_t nSize, dtor_func_t pDestructor, zend_bool persistent ZEND_FILE_LINE_DC) +ZEND_API void _zend_ts_hash_init(TsHashTable *ht, uint32_t nSize, dtor_func_t pDestructor, zend_bool persistent) { #ifdef ZTS ht->mx_reader = tsrm_mutex_alloc(); ht->mx_writer = tsrm_mutex_alloc(); ht->reader = 0; #endif - _zend_hash_init(TS_HASH(ht), nSize, pDestructor, persistent ZEND_FILE_LINE_RELAY_CC); + _zend_hash_init(TS_HASH(ht), nSize, pDestructor, persistent); } -ZEND_API void _zend_ts_hash_init_ex(TsHashTable *ht, uint32_t nSize, dtor_func_t pDestructor, zend_bool persistent, zend_bool bApplyProtection ZEND_FILE_LINE_DC) +ZEND_API void _zend_ts_hash_init_ex(TsHashTable *ht, uint32_t nSize, dtor_func_t pDestructor, zend_bool persistent, zend_bool bApplyProtection) { #ifdef ZTS ht->mx_reader = tsrm_mutex_alloc(); ht->mx_writer = tsrm_mutex_alloc(); ht->reader = 0; #endif - _zend_hash_init_ex(TS_HASH(ht), nSize, pDestructor, persistent, bApplyProtection ZEND_FILE_LINE_RELAY_CC); + _zend_hash_init_ex(TS_HASH(ht), nSize, pDestructor, persistent, bApplyProtection); } ZEND_API void zend_ts_hash_destroy(TsHashTable *ht) diff --git a/Zend/zend_ts_hash.h b/Zend/zend_ts_hash.h index 18421e58f6b6a..3128096cd3832 100644 --- a/Zend/zend_ts_hash.h +++ b/Zend/zend_ts_hash.h @@ -37,15 +37,15 @@ BEGIN_EXTERN_C() #define TS_HASH(table) (&(table->hash)) /* startup/shutdown */ -ZEND_API void _zend_ts_hash_init(TsHashTable *ht, uint32_t nSize, dtor_func_t pDestructor, zend_bool persistent ZEND_FILE_LINE_DC); -ZEND_API void _zend_ts_hash_init_ex(TsHashTable *ht, uint32_t nSize, dtor_func_t pDestructor, zend_bool persistent, zend_bool bApplyProtection ZEND_FILE_LINE_DC); +ZEND_API void _zend_ts_hash_init(TsHashTable *ht, uint32_t nSize, dtor_func_t pDestructor, zend_bool persistent); +ZEND_API void _zend_ts_hash_init_ex(TsHashTable *ht, uint32_t nSize, dtor_func_t pDestructor, zend_bool persistent, zend_bool bApplyProtection); ZEND_API void zend_ts_hash_destroy(TsHashTable *ht); ZEND_API void zend_ts_hash_clean(TsHashTable *ht); #define zend_ts_hash_init(ht, nSize, pHashFunction, pDestructor, persistent) \ - _zend_ts_hash_init(ht, nSize, pDestructor, persistent ZEND_FILE_LINE_CC) + _zend_ts_hash_init(ht, nSize, pDestructor, persistent) #define zend_ts_hash_init_ex(ht, nSize, pHashFunction, pDestructor, persistent, bApplyProtection) \ - _zend_ts_hash_init_ex(ht, nSize, pDestructor, persistent, bApplyProtection ZEND_FILE_LINE_CC) + _zend_ts_hash_init_ex(ht, nSize, pDestructor, persistent, bApplyProtection) /* additions/updates/changes */ diff --git a/Zend/zend_types.h b/Zend/zend_types.h index b78ed0c45afff..1028978c288fe 100644 --- a/Zend/zend_types.h +++ b/Zend/zend_types.h @@ -721,8 +721,9 @@ static zend_always_inline zend_uchar zval_get_type(const zval* pz) { } while (0) #define ZVAL_ARR(z, a) do { \ + zend_array *__arr = (a); \ zval *__z = (z); \ - Z_ARR_P(__z) = (a); \ + Z_ARR_P(__z) = __arr; \ Z_TYPE_INFO_P(__z) = IS_ARRAY_EX; \ } while (0) diff --git a/Zend/zend_virtual_cwd.c b/Zend/zend_virtual_cwd.c index 3e95795b084b7..9afa406994635 100644 --- a/Zend/zend_virtual_cwd.c +++ b/Zend/zend_virtual_cwd.c @@ -163,7 +163,7 @@ static inline time_t FileTimeToUnixTime(const FILETIME *FileTime) return (time_t)UnixTime; } -CWD_API int php_sys_readlink(const char *link, char *target, size_t target_len){ /* {{{ */ +CWD_API ssize_t php_sys_readlink(const char *link, char *target, size_t target_len){ /* {{{ */ HANDLE hFile; wchar_t *linkw = php_win32_ioutil_any_to_w(link), targetw[MAXPATHLEN]; size_t ret_len, targetw_len, offset = 0; @@ -229,7 +229,7 @@ CWD_API int php_sys_readlink(const char *link, char *target, size_t target_len){ CloseHandle(hFile); free(linkw); - return ret_len; + return (ssize_t)ret_len; } /* }}} */ @@ -409,7 +409,7 @@ void virtual_cwd_main_cwd_init(uint8_t reinit) /* {{{ */ cwd[0] = '\0'; } - main_cwd_state.cwd_length = (int)strlen(cwd); + main_cwd_state.cwd_length = strlen(cwd); #ifdef ZEND_WIN32 if (main_cwd_state.cwd_length >= 2 && cwd[1] == ':') { cwd[0] = toupper(cwd[0]); @@ -716,10 +716,10 @@ CWD_API realpath_cache_bucket** realpath_cache_get_buckets(void) #undef LINK_MAX #define LINK_MAX 32 -static int tsrm_realpath_r(char *path, int start, int len, int *ll, time_t *t, int use_realpath, int is_dir, int *link_is_dir) /* {{{ */ +static size_t tsrm_realpath_r(char *path, size_t start, size_t len, int *ll, time_t *t, int use_realpath, int is_dir, int *link_is_dir) /* {{{ */ { - int i, j, save; - int directory = 0; + size_t i, j; + int directory = 0, save; #ifdef ZEND_WIN32 WIN32_FIND_DATAW dataw; HANDLE hFind = INVALID_HANDLE_VALUE; @@ -747,28 +747,31 @@ static int tsrm_realpath_r(char *path, int start, int len, int *ll, time_t *t, i while (i > start && !IS_SLASH(path[i-1])) { i--; } + assert(i < MAXPATHLEN); if (i == len || - (i == len - 1 && path[i] == '.')) { + (i + 1 == len && path[i] == '.')) { /* remove double slashes and '.' */ len = i - 1; is_dir = 1; continue; - } else if (i == len - 2 && path[i] == '.' && path[i+1] == '.') { + } else if (i + 2 == len && path[i] == '.' && path[i+1] == '.') { /* remove '..' and previous directory */ is_dir = 1; if (link_is_dir) { *link_is_dir = 1; } - if (i - 1 <= start) { + if (i <= start + 1) { return start ? start : len; } j = tsrm_realpath_r(path, start, i-1, ll, t, use_realpath, 1, NULL); - if (j > start) { + if (j > start && j != (size_t)-1) { j--; + assert(i < MAXPATHLEN); while (j > start && !IS_SLASH(path[j])) { j--; } + assert(i < MAXPATHLEN); if (!start) { /* leading '..' must not be removed in case of relative path */ if (j == 0 && path[0] == '.' && path[1] == '.' && @@ -808,7 +811,7 @@ static int tsrm_realpath_r(char *path, int start, int len, int *ll, time_t *t, i if ((bucket = realpath_cache_find(path, len, *t)) != NULL) { if (is_dir && !bucket->is_dir) { /* not a directory */ - return -1; + return (size_t)-1; } else { if (link_is_dir) { *link_is_dir = bucket->is_dir; @@ -823,14 +826,14 @@ static int tsrm_realpath_r(char *path, int start, int len, int *ll, time_t *t, i if (save) { pathw = php_win32_ioutil_any_to_w(path); if (!pathw) { - return -1; + return (size_t)-1; } hFind = FindFirstFileExW(pathw, FindExInfoBasic, &dataw, FindExSearchNameMatch, NULL, 0); if (INVALID_HANDLE_VALUE == hFind) { if (use_realpath == CWD_REALPATH) { /* file not found */ FREE_PATHW() - return -1; + return (size_t)-1; } /* continue resolution anyway but don't save result in the cache */ save = 0; @@ -850,7 +853,8 @@ static int tsrm_realpath_r(char *path, int start, int len, int *ll, time_t *t, i HANDLE hLink = NULL; REPARSE_DATA_BUFFER * pbuffer; DWORD retlength = 0; - int bufindex = 0, isabsolute = 0; + size_t bufindex = 0; + uint8_t isabsolute = 0; wchar_t * reparsetarget; BOOL isVolume = FALSE; #if VIRTUAL_CWD_DEBUG @@ -858,20 +862,20 @@ static int tsrm_realpath_r(char *path, int start, int len, int *ll, time_t *t, i #endif char *substitutename = NULL; size_t substitutename_len; - int substitutename_off = 0; + size_t substitutename_off = 0; wchar_t tmpsubstname[MAXPATHLEN]; if(++(*ll) > LINK_MAX) { free_alloca(tmp, use_heap); FREE_PATHW() - return -1; + return (size_t)-1; } hLink = CreateFileW(pathw, GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_FLAG_OPEN_REPARSE_POINT|FILE_FLAG_BACKUP_SEMANTICS, NULL); if(hLink == INVALID_HANDLE_VALUE) { free_alloca(tmp, use_heap); FREE_PATHW() - return -1; + return (size_t)-1; } pbuffer = (REPARSE_DATA_BUFFER *)do_alloca(MAXIMUM_REPARSE_DATA_BUFFER_SIZE, use_heap_large); @@ -879,14 +883,14 @@ static int tsrm_realpath_r(char *path, int start, int len, int *ll, time_t *t, i CloseHandle(hLink); free_alloca(tmp, use_heap); FREE_PATHW() - return -1; + return (size_t)-1; } if(!DeviceIoControl(hLink, FSCTL_GET_REPARSE_POINT, NULL, 0, pbuffer, MAXIMUM_REPARSE_DATA_BUFFER_SIZE, &retlength, NULL)) { free_alloca(pbuffer, use_heap_large); free_alloca(tmp, use_heap); CloseHandle(hLink); FREE_PATHW() - return -1; + return (size_t)-1; } CloseHandle(hLink); @@ -900,7 +904,7 @@ static int tsrm_realpath_r(char *path, int start, int len, int *ll, time_t *t, i free_alloca(pbuffer, use_heap_large); free_alloca(tmp, use_heap); FREE_PATHW() - return -1; + return (size_t)-1; } #endif @@ -909,7 +913,7 @@ static int tsrm_realpath_r(char *path, int start, int len, int *ll, time_t *t, i free_alloca(pbuffer, use_heap_large); free_alloca(tmp, use_heap); FREE_PATHW() - return -1; + return (size_t)-1; } memmove(tmpsubstname, reparsetarget + pbuffer->MountPointReparseBuffer.SubstituteNameOffset / sizeof(WCHAR), pbuffer->MountPointReparseBuffer.SubstituteNameLength); tmpsubstname[substitutename_len] = L'\0'; @@ -922,7 +926,7 @@ static int tsrm_realpath_r(char *path, int start, int len, int *ll, time_t *t, i free(printname); #endif FREE_PATHW() - return -1; + return (size_t)-1; } } else if(pbuffer->ReparseTag == IO_REPARSE_TAG_MOUNT_POINT) { @@ -934,7 +938,7 @@ static int tsrm_realpath_r(char *path, int start, int len, int *ll, time_t *t, i free_alloca(pbuffer, use_heap_large); free_alloca(tmp, use_heap); FREE_PATHW() - return -1; + return (size_t)-1; } #endif @@ -944,7 +948,7 @@ static int tsrm_realpath_r(char *path, int start, int len, int *ll, time_t *t, i free_alloca(pbuffer, use_heap_large); free_alloca(tmp, use_heap); FREE_PATHW() - return -1; + return (size_t)-1; } memmove(tmpsubstname, reparsetarget + pbuffer->MountPointReparseBuffer.SubstituteNameOffset / sizeof(WCHAR), pbuffer->MountPointReparseBuffer.SubstituteNameLength); tmpsubstname[substitutename_len] = L'\0'; @@ -957,7 +961,7 @@ static int tsrm_realpath_r(char *path, int start, int len, int *ll, time_t *t, i free(printname); #endif FREE_PATHW() - return -1; + return (size_t)-1; } } else if (pbuffer->ReparseTag == IO_REPARSE_TAG_DEDUP) { @@ -967,7 +971,7 @@ static int tsrm_realpath_r(char *path, int start, int len, int *ll, time_t *t, i free_alloca(pbuffer, use_heap_large); free_alloca(tmp, use_heap); FREE_PATHW() - return -1; + return (size_t)-1; } memcpy(substitutename, path, len + 1); substitutename_len = len; @@ -976,7 +980,7 @@ static int tsrm_realpath_r(char *path, int start, int len, int *ll, time_t *t, i free_alloca(pbuffer, use_heap_large); free_alloca(tmp, use_heap); FREE_PATHW() - return -1; + return (size_t)-1; } if(isabsolute && substitutename_len > 4) { @@ -1003,7 +1007,7 @@ static int tsrm_realpath_r(char *path, int start, int len, int *ll, time_t *t, i if (!isVolume) { char * tmp2 = substitutename + substitutename_off; - for(bufindex = 0; bufindex < (substitutename_len - substitutename_off); bufindex++) { + for (bufindex = 0; bufindex + substitutename_off < substitutename_len; bufindex++) { *(path + bufindex) = *(tmp2 + bufindex); } @@ -1027,10 +1031,10 @@ static int tsrm_realpath_r(char *path, int start, int len, int *ll, time_t *t, i if (!((j == 3) && (path[1] == ':') && (path[2] == '\\'))) { /* use_realpath is 0 in the call below coz path is absolute*/ j = tsrm_realpath_r(path, 0, j, ll, t, 0, is_dir, &directory); - if(j < 0) { + if(j == (size_t)-1) { free_alloca(tmp, use_heap); FREE_PATHW() - return -1; + return (size_t)-1; } } } @@ -1038,17 +1042,17 @@ static int tsrm_realpath_r(char *path, int start, int len, int *ll, time_t *t, i if(i + j >= MAXPATHLEN - 1) { free_alloca(tmp, use_heap); FREE_PATHW() - return -1; + return (size_t)-1; } memmove(path+i, path, j+1); memcpy(path, tmp, i-1); path[i-1] = DEFAULT_SLASH; j = tsrm_realpath_r(path, start, i + j, ll, t, use_realpath, is_dir, &directory); - if(j < 0) { + if(j == (size_t)-1) { free_alloca(tmp, use_heap); FREE_PATHW() - return -1; + return (size_t)-1; } } directory = (dataw.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY); @@ -1064,14 +1068,14 @@ static int tsrm_realpath_r(char *path, int start, int len, int *ll, time_t *t, i /* not a directory */ free_alloca(tmp, use_heap); FREE_PATHW() - return -1; + return (size_t)-1; } } #else if (save && php_sys_lstat(path, &st) < 0) { if (use_realpath == CWD_REALPATH) { /* file not found */ - return -1; + return (size_t)-1; } /* continue resolution anyway but don't save result in the cache */ save = 0; @@ -1081,30 +1085,30 @@ static int tsrm_realpath_r(char *path, int start, int len, int *ll, time_t *t, i memcpy(tmp, path, len+1); if (save && S_ISLNK(st.st_mode)) { - if (++(*ll) > LINK_MAX || (j = php_sys_readlink(tmp, path, MAXPATHLEN)) < 0) { + if (++(*ll) > LINK_MAX || (j = (size_t)php_sys_readlink(tmp, path, MAXPATHLEN)) == (size_t)-1) { /* too many links or broken symlinks */ free_alloca(tmp, use_heap); - return -1; + return (size_t)-1; } path[j] = 0; if (IS_ABSOLUTE_PATH(path, j)) { j = tsrm_realpath_r(path, 1, j, ll, t, use_realpath, is_dir, &directory); - if (j < 0) { + if (j == (size_t)-1) { free_alloca(tmp, use_heap); - return -1; + return (size_t)-1; } } else { if (i + j >= MAXPATHLEN-1) { free_alloca(tmp, use_heap); - return -1; /* buffer overflow */ + return (size_t)-1; /* buffer overflow */ } memmove(path+i, path, j+1); memcpy(path, tmp, i-1); path[i-1] = DEFAULT_SLASH; j = tsrm_realpath_r(path, start, i + j, ll, t, use_realpath, is_dir, &directory); - if (j < 0) { + if (j == (size_t)-1) { free_alloca(tmp, use_heap); - return -1; + return (size_t)-1; } } if (link_is_dir) { @@ -1119,24 +1123,24 @@ static int tsrm_realpath_r(char *path, int start, int len, int *ll, time_t *t, i if (is_dir && !directory) { /* not a directory */ free_alloca(tmp, use_heap); - return -1; + return (size_t)-1; } } #endif - if (i - 1 <= start) { + if (i <= start + 1) { j = start; } else { /* some leading directories may be unaccessable */ j = tsrm_realpath_r(path, start, i-1, ll, t, save ? CWD_FILEPATH : use_realpath, 1, NULL); - if (j > start) { + if (j > start && j != (size_t)-1) { path[j++] = DEFAULT_SLASH; } } #ifdef ZEND_WIN32 - if (j < 0 || j + len - i >= MAXPATHLEN-1) { + if (j == (size_t)-1 || j + len >= MAXPATHLEN - 1 + i) { free_alloca(tmp, use_heap); FREE_PATHW() - return -1; + return (size_t)-1; } if (save) { size_t sz; @@ -1144,9 +1148,9 @@ static int tsrm_realpath_r(char *path, int start, int len, int *ll, time_t *t, i if (!tmp_path) { free_alloca(tmp, use_heap); FREE_PATHW() - return -1; + return (size_t)-1; } - i = (int)sz; + i = sz; memcpy(path+j, tmp_path, i+1); free(tmp_path); j += i; @@ -1157,9 +1161,9 @@ static int tsrm_realpath_r(char *path, int start, int len, int *ll, time_t *t, i } } #else - if (j < 0 || j + len - i >= MAXPATHLEN-1) { + if (j == (size_t)-1 || j + len >= MAXPATHLEN - 1 + i) { free_alloca(tmp, use_heap); - return -1; + return (size_t)-1; } memcpy(path+j, tmp+i, len-i+1); j += (len-i); @@ -1185,16 +1189,16 @@ static int tsrm_realpath_r(char *path, int start, int len, int *ll, time_t *t, i /* returns 0 for ok, 1 for error */ CWD_API int virtual_file_ex(cwd_state *state, const char *path, verify_path_func verify_path, int use_realpath) /* {{{ */ { - int path_length = (int)strlen(path); + size_t path_length = strlen(path); char resolved_path[MAXPATHLEN]; - int start = 1; + size_t start = 1; int ll = 0; time_t t; int ret; int add_slash; void *tmp; - if (path_length <= 0 || path_length >= MAXPATHLEN-1) { + if (!path_length || path_length >= MAXPATHLEN-1) { #ifdef ZEND_WIN32 _set_errno(EINVAL); #else @@ -1216,7 +1220,7 @@ CWD_API int virtual_file_ex(cwd_state *state, const char *path, verify_path_func start = 0; memcpy(resolved_path , path, path_length + 1); } else { - int state_cwd_length = state->cwd_length; + size_t state_cwd_length = state->cwd_length; #ifdef ZEND_WIN32 if (IS_SLASH(path[0])) { @@ -1310,7 +1314,7 @@ CWD_API int virtual_file_ex(cwd_state *state, const char *path, verify_path_func t = CWDG(realpath_cache_ttl) ? 0 : -1; path_length = tsrm_realpath_r(resolved_path, start, path_length, &ll, &t, use_realpath, 0, NULL); - if (path_length < 0) { + if (path_length == (size_t)-1) { errno = ENOENT; return 1; } @@ -1426,7 +1430,7 @@ CWD_API char *virtual_realpath(const char *path, char *real_path) /* {{{ */ } if (virtual_file_ex(&new_state, path, NULL, CWD_REALPATH)==0) { - int len = new_state.cwd_length>MAXPATHLEN-1?MAXPATHLEN-1:new_state.cwd_length; + size_t len = new_state.cwd_length>MAXPATHLEN-1?MAXPATHLEN-1:new_state.cwd_length; memcpy(real_path, new_state.cwd, len); real_path[len] = '\0'; @@ -1890,7 +1894,7 @@ CWD_API char *tsrm_realpath(const char *path, char *real_path) /* {{{ */ } else if (!IS_ABSOLUTE_PATH(path, strlen(path)) && VCWD_GETCWD(cwd, MAXPATHLEN)) { new_state.cwd = estrdup(cwd); - new_state.cwd_length = (int)strlen(cwd); + new_state.cwd_length = strlen(cwd); } else { new_state.cwd = (char*)emalloc(1); new_state.cwd[0] = '\0'; @@ -1903,7 +1907,7 @@ CWD_API char *tsrm_realpath(const char *path, char *real_path) /* {{{ */ } if (real_path) { - int copy_len = new_state.cwd_length>MAXPATHLEN-1 ? MAXPATHLEN-1 : new_state.cwd_length; + size_t copy_len = new_state.cwd_length>MAXPATHLEN-1 ? MAXPATHLEN-1 : new_state.cwd_length; memcpy(real_path, new_state.cwd, copy_len); real_path[copy_len] = '\0'; efree(new_state.cwd); diff --git a/Zend/zend_virtual_cwd.h b/Zend/zend_virtual_cwd.h index dee87c0a36aa0..5e41fe27426aa 100644 --- a/Zend/zend_virtual_cwd.h +++ b/Zend/zend_virtual_cwd.h @@ -121,7 +121,7 @@ typedef unsigned short mode_t; CWD_API int php_sys_stat_ex(const char *path, zend_stat_t *buf, int lstat); # define php_sys_stat(path, buf) php_sys_stat_ex(path, buf, 0) # define php_sys_lstat(path, buf) php_sys_stat_ex(path, buf, 1) -CWD_API int php_sys_readlink(const char *link, char *target, size_t target_len); +CWD_API ssize_t php_sys_readlink(const char *link, char *target, size_t target_len); #else # define php_sys_stat stat # define php_sys_lstat lstat @@ -132,7 +132,7 @@ CWD_API int php_sys_readlink(const char *link, char *target, size_t target_len); typedef struct _cwd_state { char *cwd; - int cwd_length; + size_t cwd_length; } cwd_state; typedef int (*verify_path_func)(const cwd_state *); diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h index 1c3668088ef0f..489ac6541add6 100644 --- a/Zend/zend_vm_def.h +++ b/Zend/zend_vm_def.h @@ -900,8 +900,7 @@ ZEND_VM_C_LABEL(assign_dim_op_new_array): } else if (OP1_TYPE == IS_CV && UNEXPECTED(Z_TYPE_INFO_P(container) == IS_UNDEF)) { container = GET_OP1_UNDEF_CV(container, BP_VAR_RW); ZEND_VM_C_LABEL(assign_dim_op_convert_to_array): - ZVAL_NEW_ARR(container); - zend_hash_init(Z_ARRVAL_P(container), 8, NULL, ZVAL_PTR_DTOR, 0); + ZVAL_ARR(container, zend_new_array(8)); ZEND_VM_C_GOTO(assign_dim_op_new_array); } @@ -1792,7 +1791,7 @@ ZEND_VM_HANDLER(82, ZEND_FETCH_OBJ_R, CONST|TMP|VAR|UNUSED|THIS|CV, CONST|TMPVAR EXPECTED(zobj->ce == CACHED_PTR(Z_CACHE_SLOT_P(offset)))) { uint32_t prop_offset = (uint32_t)(intptr_t)CACHED_PTR(Z_CACHE_SLOT_P(offset) + sizeof(void*)); - if (EXPECTED(prop_offset != (uint32_t)ZEND_DYNAMIC_PROPERTY_OFFSET)) { + if (EXPECTED(IS_VALID_PROPERTY_OFFSET(prop_offset))) { retval = OBJ_PROP(zobj, prop_offset); if (EXPECTED(Z_TYPE_INFO_P(retval) != IS_UNDEF)) { ZVAL_COPY_UNREF(EX_VAR(opline->result.var), retval); @@ -1913,7 +1912,7 @@ ZEND_VM_HANDLER(91, ZEND_FETCH_OBJ_IS, CONST|TMPVAR|UNUSED|THIS|CV, CONST|TMPVAR EXPECTED(zobj->ce == CACHED_PTR(Z_CACHE_SLOT_P(offset)))) { uint32_t prop_offset = (uint32_t)(intptr_t)CACHED_PTR(Z_CACHE_SLOT_P(offset) + sizeof(void*)); - if (EXPECTED(prop_offset != (uint32_t)ZEND_DYNAMIC_PROPERTY_OFFSET)) { + if (EXPECTED(IS_VALID_PROPERTY_OFFSET(prop_offset))) { retval = OBJ_PROP(zobj, prop_offset); if (EXPECTED(Z_TYPE_P(retval) != IS_UNDEF)) { ZVAL_COPY(EX_VAR(opline->result.var), retval); @@ -2083,7 +2082,7 @@ ZEND_VM_HANDLER(136, ZEND_ASSIGN_OBJ, VAR|UNUSED|THIS|CV, CONST|TMPVAR|CV, SPEC( zend_object *zobj = Z_OBJ_P(object); zval *property_val; - if (EXPECTED(prop_offset != (uint32_t)ZEND_DYNAMIC_PROPERTY_OFFSET)) { + if (EXPECTED(IS_VALID_PROPERTY_OFFSET(prop_offset))) { property_val = OBJ_PROP(zobj, prop_offset); if (Z_TYPE_P(property_val) != IS_UNDEF) { ZEND_VM_C_LABEL(fast_assign_obj): @@ -2247,8 +2246,7 @@ ZEND_VM_C_LABEL(try_assign_dim_array): FREE_OP_DATA(); } } else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) { - ZVAL_NEW_ARR(object_ptr); - zend_hash_init(Z_ARRVAL_P(object_ptr), 8, NULL, ZVAL_PTR_DTOR, 0); + ZVAL_ARR(object_ptr, zend_new_array(8)); ZEND_VM_C_GOTO(try_assign_dim_array); } else { if (OP1_TYPE != IS_VAR || EXPECTED(!Z_ISERROR_P(object_ptr))) { @@ -5219,8 +5217,7 @@ ZEND_VM_HANDLER(71, ZEND_INIT_ARRAY, CONST|TMP|VAR|CV, CONST|TMPVAR|UNUSED|NEXT| } else { size = 0; } - ZVAL_NEW_ARR(array); - zend_hash_init(Z_ARRVAL_P(array), size, NULL, ZVAL_PTR_DTOR, 0); + ZVAL_ARR(array, zend_new_array(size)); if (OP1_TYPE != IS_UNUSED) { /* Explicitly initialize array as not-packed if flag is set */ @@ -5277,8 +5274,7 @@ ZEND_VM_HANDLER(21, ZEND_CAST, CONST|TMP|VAR|CV, ANY, TYPE) if (opline->extended_value == IS_ARRAY) { if (Z_TYPE_P(expr) != IS_OBJECT) { - ZVAL_NEW_ARR(result); - zend_hash_init(Z_ARRVAL_P(result), 8, NULL, ZVAL_PTR_DTOR, 0); + ZVAL_ARR(result, zend_new_array(8)); if (Z_TYPE_P(expr) != IS_NULL) { expr = zend_hash_index_add_new(Z_ARRVAL_P(result), 0, expr); if (OP1_TYPE == IS_CONST) { @@ -7774,8 +7770,7 @@ ZEND_VM_HANDLER(158, ZEND_CALL_TRAMPOLINE, ANY, ANY) SAVE_OPLINE(); - args = emalloc(sizeof(zend_array)); - zend_hash_init(args, num_args, NULL, ZVAL_PTR_DTOR, 0); + args = zend_new_array(num_args); if (num_args) { zval *p = ZEND_CALL_ARG(execute_data, 1); zval *end = p + num_args; @@ -8270,8 +8265,7 @@ ZEND_VM_HANDLER(195, ZEND_FUNC_GET_ARGS, UNUSED|CONST, UNUSED) result_size = arg_count; } - ht = (zend_array *) emalloc(sizeof(zend_array)); - zend_hash_init(ht, result_size, NULL, ZVAL_PTR_DTOR, 0); + ht = zend_new_array(result_size); ZVAL_ARR(EX_VAR(opline->result.var), ht); if (result_size) { diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h index 6b83684b7f338..f26b6c5c92c6a 100644 --- a/Zend/zend_vm_execute.h +++ b/Zend/zend_vm_execute.h @@ -1965,8 +1965,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CALL_TRAMPOLINE_SPEC_HANDLER(Z SAVE_OPLINE(); - args = emalloc(sizeof(zend_array)); - zend_hash_init(args, num_args, NULL, ZVAL_PTR_DTOR, 0); + args = zend_new_array(num_args); if (num_args) { zval *p = ZEND_CALL_ARG(execute_data, 1); zval *end = p + num_args; @@ -3392,8 +3391,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CAST_SPEC_CONST_HANDLER(ZEND_O if (opline->extended_value == IS_ARRAY) { if (Z_TYPE_P(expr) != IS_OBJECT) { - ZVAL_NEW_ARR(result); - zend_hash_init(Z_ARRVAL_P(result), 8, NULL, ZVAL_PTR_DTOR, 0); + ZVAL_ARR(result, zend_new_array(8)); if (Z_TYPE_P(expr) != IS_NULL) { expr = zend_hash_index_add_new(Z_ARRVAL_P(result), 0, expr); if (IS_CONST == IS_CONST) { @@ -5008,7 +5006,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_R_SPEC_CONST_CONST_H EXPECTED(zobj->ce == CACHED_PTR(Z_CACHE_SLOT_P(offset)))) { uint32_t prop_offset = (uint32_t)(intptr_t)CACHED_PTR(Z_CACHE_SLOT_P(offset) + sizeof(void*)); - if (EXPECTED(prop_offset != (uint32_t)ZEND_DYNAMIC_PROPERTY_OFFSET)) { + if (EXPECTED(IS_VALID_PROPERTY_OFFSET(prop_offset))) { retval = OBJ_PROP(zobj, prop_offset); if (EXPECTED(Z_TYPE_INFO_P(retval) != IS_UNDEF)) { ZVAL_COPY_UNREF(EX_VAR(opline->result.var), retval); @@ -5081,7 +5079,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_IS_SPEC_CONST_CONST_ EXPECTED(zobj->ce == CACHED_PTR(Z_CACHE_SLOT_P(offset)))) { uint32_t prop_offset = (uint32_t)(intptr_t)CACHED_PTR(Z_CACHE_SLOT_P(offset) + sizeof(void*)); - if (EXPECTED(prop_offset != (uint32_t)ZEND_DYNAMIC_PROPERTY_OFFSET)) { + if (EXPECTED(IS_VALID_PROPERTY_OFFSET(prop_offset))) { retval = OBJ_PROP(zobj, prop_offset); if (EXPECTED(Z_TYPE_P(retval) != IS_UNDEF)) { ZVAL_COPY(EX_VAR(opline->result.var), retval); @@ -5887,8 +5885,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_CONST_CONST_HA } else { size = 0; } - ZVAL_NEW_ARR(array); - zend_hash_init(Z_ARRVAL_P(array), size, NULL, ZVAL_PTR_DTOR, 0); + ZVAL_ARR(array, zend_new_array(size)); if (IS_CONST != IS_UNUSED) { /* Explicitly initialize array as not-packed if flag is set */ @@ -7671,8 +7668,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_CONST_UNUSED_H } else { size = 0; } - ZVAL_NEW_ARR(array); - zend_hash_init(Z_ARRVAL_P(array), size, NULL, ZVAL_PTR_DTOR, 0); + ZVAL_ARR(array, zend_new_array(size)); if (IS_CONST != IS_UNUSED) { /* Explicitly initialize array as not-packed if flag is set */ @@ -8173,8 +8169,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FUNC_GET_ARGS_SPEC_CONST_UNUSE result_size = arg_count; } - ht = (zend_array *) emalloc(sizeof(zend_array)); - zend_hash_init(ht, result_size, NULL, ZVAL_PTR_DTOR, 0); + ht = zend_new_array(result_size); ZVAL_ARR(EX_VAR(opline->result.var), ht); if (result_size) { @@ -9057,7 +9052,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_R_SPEC_CONST_CV_HAND EXPECTED(zobj->ce == CACHED_PTR(Z_CACHE_SLOT_P(offset)))) { uint32_t prop_offset = (uint32_t)(intptr_t)CACHED_PTR(Z_CACHE_SLOT_P(offset) + sizeof(void*)); - if (EXPECTED(prop_offset != (uint32_t)ZEND_DYNAMIC_PROPERTY_OFFSET)) { + if (EXPECTED(IS_VALID_PROPERTY_OFFSET(prop_offset))) { retval = OBJ_PROP(zobj, prop_offset); if (EXPECTED(Z_TYPE_INFO_P(retval) != IS_UNDEF)) { ZVAL_COPY_UNREF(EX_VAR(opline->result.var), retval); @@ -9130,7 +9125,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_IS_SPEC_CONST_CV_HAN EXPECTED(zobj->ce == CACHED_PTR(Z_CACHE_SLOT_P(offset)))) { uint32_t prop_offset = (uint32_t)(intptr_t)CACHED_PTR(Z_CACHE_SLOT_P(offset) + sizeof(void*)); - if (EXPECTED(prop_offset != (uint32_t)ZEND_DYNAMIC_PROPERTY_OFFSET)) { + if (EXPECTED(IS_VALID_PROPERTY_OFFSET(prop_offset))) { retval = OBJ_PROP(zobj, prop_offset); if (EXPECTED(Z_TYPE_P(retval) != IS_UNDEF)) { ZVAL_COPY(EX_VAR(opline->result.var), retval); @@ -9906,8 +9901,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_CONST_CV_HANDL } else { size = 0; } - ZVAL_NEW_ARR(array); - zend_hash_init(Z_ARRVAL_P(array), size, NULL, ZVAL_PTR_DTOR, 0); + ZVAL_ARR(array, zend_new_array(size)); if (IS_CONST != IS_UNUSED) { /* Explicitly initialize array as not-packed if flag is set */ @@ -11076,7 +11070,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_R_SPEC_CONST_TMPVAR_ EXPECTED(zobj->ce == CACHED_PTR(Z_CACHE_SLOT_P(offset)))) { uint32_t prop_offset = (uint32_t)(intptr_t)CACHED_PTR(Z_CACHE_SLOT_P(offset) + sizeof(void*)); - if (EXPECTED(prop_offset != (uint32_t)ZEND_DYNAMIC_PROPERTY_OFFSET)) { + if (EXPECTED(IS_VALID_PROPERTY_OFFSET(prop_offset))) { retval = OBJ_PROP(zobj, prop_offset); if (EXPECTED(Z_TYPE_INFO_P(retval) != IS_UNDEF)) { ZVAL_COPY_UNREF(EX_VAR(opline->result.var), retval); @@ -11150,7 +11144,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_IS_SPEC_CONST_TMPVAR EXPECTED(zobj->ce == CACHED_PTR(Z_CACHE_SLOT_P(offset)))) { uint32_t prop_offset = (uint32_t)(intptr_t)CACHED_PTR(Z_CACHE_SLOT_P(offset) + sizeof(void*)); - if (EXPECTED(prop_offset != (uint32_t)ZEND_DYNAMIC_PROPERTY_OFFSET)) { + if (EXPECTED(IS_VALID_PROPERTY_OFFSET(prop_offset))) { retval = OBJ_PROP(zobj, prop_offset); if (EXPECTED(Z_TYPE_P(retval) != IS_UNDEF)) { ZVAL_COPY(EX_VAR(opline->result.var), retval); @@ -11874,8 +11868,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_CONST_TMPVAR_H } else { size = 0; } - ZVAL_NEW_ARR(array); - zend_hash_init(Z_ARRVAL_P(array), size, NULL, ZVAL_PTR_DTOR, 0); + ZVAL_ARR(array, zend_new_array(size)); if (IS_CONST != IS_UNUSED) { /* Explicitly initialize array as not-packed if flag is set */ @@ -12897,8 +12890,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CAST_SPEC_TMP_HANDLER(ZEND_OPC if (opline->extended_value == IS_ARRAY) { if (Z_TYPE_P(expr) != IS_OBJECT) { - ZVAL_NEW_ARR(result); - zend_hash_init(Z_ARRVAL_P(result), 8, NULL, ZVAL_PTR_DTOR, 0); + ZVAL_ARR(result, zend_new_array(8)); if (Z_TYPE_P(expr) != IS_NULL) { expr = zend_hash_index_add_new(Z_ARRVAL_P(result), 0, expr); if (IS_TMP_VAR == IS_CONST) { @@ -13556,7 +13548,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_R_SPEC_TMP_CONST_HAN EXPECTED(zobj->ce == CACHED_PTR(Z_CACHE_SLOT_P(offset)))) { uint32_t prop_offset = (uint32_t)(intptr_t)CACHED_PTR(Z_CACHE_SLOT_P(offset) + sizeof(void*)); - if (EXPECTED(prop_offset != (uint32_t)ZEND_DYNAMIC_PROPERTY_OFFSET)) { + if (EXPECTED(IS_VALID_PROPERTY_OFFSET(prop_offset))) { retval = OBJ_PROP(zobj, prop_offset); if (EXPECTED(Z_TYPE_INFO_P(retval) != IS_UNDEF)) { ZVAL_COPY_UNREF(EX_VAR(opline->result.var), retval); @@ -13821,8 +13813,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_TMP_CONST_HAND } else { size = 0; } - ZVAL_NEW_ARR(array); - zend_hash_init(Z_ARRVAL_P(array), size, NULL, ZVAL_PTR_DTOR, 0); + ZVAL_ARR(array, zend_new_array(size)); if (IS_TMP_VAR != IS_UNUSED) { /* Explicitly initialize array as not-packed if flag is set */ @@ -14550,8 +14541,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_TMP_UNUSED_HAN } else { size = 0; } - ZVAL_NEW_ARR(array); - zend_hash_init(Z_ARRVAL_P(array), size, NULL, ZVAL_PTR_DTOR, 0); + ZVAL_ARR(array, zend_new_array(size)); if (IS_TMP_VAR != IS_UNUSED) { /* Explicitly initialize array as not-packed if flag is set */ @@ -14908,7 +14898,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_R_SPEC_TMP_CV_HANDLE EXPECTED(zobj->ce == CACHED_PTR(Z_CACHE_SLOT_P(offset)))) { uint32_t prop_offset = (uint32_t)(intptr_t)CACHED_PTR(Z_CACHE_SLOT_P(offset) + sizeof(void*)); - if (EXPECTED(prop_offset != (uint32_t)ZEND_DYNAMIC_PROPERTY_OFFSET)) { + if (EXPECTED(IS_VALID_PROPERTY_OFFSET(prop_offset))) { retval = OBJ_PROP(zobj, prop_offset); if (EXPECTED(Z_TYPE_INFO_P(retval) != IS_UNDEF)) { ZVAL_COPY_UNREF(EX_VAR(opline->result.var), retval); @@ -15173,8 +15163,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_TMP_CV_HANDLER } else { size = 0; } - ZVAL_NEW_ARR(array); - zend_hash_init(Z_ARRVAL_P(array), size, NULL, ZVAL_PTR_DTOR, 0); + ZVAL_ARR(array, zend_new_array(size)); if (IS_TMP_VAR != IS_UNUSED) { /* Explicitly initialize array as not-packed if flag is set */ @@ -15430,7 +15419,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_R_SPEC_TMP_TMPVAR_HA EXPECTED(zobj->ce == CACHED_PTR(Z_CACHE_SLOT_P(offset)))) { uint32_t prop_offset = (uint32_t)(intptr_t)CACHED_PTR(Z_CACHE_SLOT_P(offset) + sizeof(void*)); - if (EXPECTED(prop_offset != (uint32_t)ZEND_DYNAMIC_PROPERTY_OFFSET)) { + if (EXPECTED(IS_VALID_PROPERTY_OFFSET(prop_offset))) { retval = OBJ_PROP(zobj, prop_offset); if (EXPECTED(Z_TYPE_INFO_P(retval) != IS_UNDEF)) { ZVAL_COPY_UNREF(EX_VAR(opline->result.var), retval); @@ -15696,8 +15685,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_TMP_TMPVAR_HAN } else { size = 0; } - ZVAL_NEW_ARR(array); - zend_hash_init(Z_ARRVAL_P(array), size, NULL, ZVAL_PTR_DTOR, 0); + ZVAL_ARR(array, zend_new_array(size)); if (IS_TMP_VAR != IS_UNUSED) { /* Explicitly initialize array as not-packed if flag is set */ @@ -16549,8 +16537,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CAST_SPEC_VAR_HANDLER(ZEND_OPC if (opline->extended_value == IS_ARRAY) { if (Z_TYPE_P(expr) != IS_OBJECT) { - ZVAL_NEW_ARR(result); - zend_hash_init(Z_ARRVAL_P(result), 8, NULL, ZVAL_PTR_DTOR, 0); + ZVAL_ARR(result, zend_new_array(8)); if (Z_TYPE_P(expr) != IS_NULL) { expr = zend_hash_index_add_new(Z_ARRVAL_P(result), 0, expr); if (IS_VAR == IS_CONST) { @@ -17648,8 +17635,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_binary_assign_op_dim_helper_SP } else if (IS_VAR == IS_CV && UNEXPECTED(Z_TYPE_INFO_P(container) == IS_UNDEF)) { container = GET_OP1_UNDEF_CV(container, BP_VAR_RW); assign_dim_op_convert_to_array: - ZVAL_NEW_ARR(container); - zend_hash_init(Z_ARRVAL_P(container), 8, NULL, ZVAL_PTR_DTOR, 0); + ZVAL_ARR(container, zend_new_array(8)); goto assign_dim_op_new_array; } @@ -18239,7 +18225,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_R_SPEC_VAR_CONST_HAN EXPECTED(zobj->ce == CACHED_PTR(Z_CACHE_SLOT_P(offset)))) { uint32_t prop_offset = (uint32_t)(intptr_t)CACHED_PTR(Z_CACHE_SLOT_P(offset) + sizeof(void*)); - if (EXPECTED(prop_offset != (uint32_t)ZEND_DYNAMIC_PROPERTY_OFFSET)) { + if (EXPECTED(IS_VALID_PROPERTY_OFFSET(prop_offset))) { retval = OBJ_PROP(zobj, prop_offset); if (EXPECTED(Z_TYPE_INFO_P(retval) != IS_UNDEF)) { ZVAL_COPY_UNREF(EX_VAR(opline->result.var), retval); @@ -18445,7 +18431,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_VAR_CONST_OP_D zend_object *zobj = Z_OBJ_P(object); zval *property_val; - if (EXPECTED(prop_offset != (uint32_t)ZEND_DYNAMIC_PROPERTY_OFFSET)) { + if (EXPECTED(IS_VALID_PROPERTY_OFFSET(prop_offset))) { property_val = OBJ_PROP(zobj, prop_offset); if (Z_TYPE_P(property_val) != IS_UNDEF) { fast_assign_obj: @@ -18603,7 +18589,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_VAR_CONST_OP_D zend_object *zobj = Z_OBJ_P(object); zval *property_val; - if (EXPECTED(prop_offset != (uint32_t)ZEND_DYNAMIC_PROPERTY_OFFSET)) { + if (EXPECTED(IS_VALID_PROPERTY_OFFSET(prop_offset))) { property_val = OBJ_PROP(zobj, prop_offset); if (Z_TYPE_P(property_val) != IS_UNDEF) { fast_assign_obj: @@ -18761,7 +18747,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_VAR_CONST_OP_D zend_object *zobj = Z_OBJ_P(object); zval *property_val; - if (EXPECTED(prop_offset != (uint32_t)ZEND_DYNAMIC_PROPERTY_OFFSET)) { + if (EXPECTED(IS_VALID_PROPERTY_OFFSET(prop_offset))) { property_val = OBJ_PROP(zobj, prop_offset); if (Z_TYPE_P(property_val) != IS_UNDEF) { fast_assign_obj: @@ -18919,7 +18905,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_VAR_CONST_OP_D zend_object *zobj = Z_OBJ_P(object); zval *property_val; - if (EXPECTED(prop_offset != (uint32_t)ZEND_DYNAMIC_PROPERTY_OFFSET)) { + if (EXPECTED(IS_VALID_PROPERTY_OFFSET(prop_offset))) { property_val = OBJ_PROP(zobj, prop_offset); if (Z_TYPE_P(property_val) != IS_UNDEF) { fast_assign_obj: @@ -19082,8 +19068,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_VAR_CONST_OP_D } } else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) { - ZVAL_NEW_ARR(object_ptr); - zend_hash_init(Z_ARRVAL_P(object_ptr), 8, NULL, ZVAL_PTR_DTOR, 0); + ZVAL_ARR(object_ptr, zend_new_array(8)); goto try_assign_dim_array; } else { if (IS_VAR != IS_VAR || EXPECTED(!Z_ISERROR_P(object_ptr))) { @@ -19175,8 +19160,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_VAR_CONST_OP_D zval_ptr_dtor_nogc(free_op_data); } } else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) { - ZVAL_NEW_ARR(object_ptr); - zend_hash_init(Z_ARRVAL_P(object_ptr), 8, NULL, ZVAL_PTR_DTOR, 0); + ZVAL_ARR(object_ptr, zend_new_array(8)); goto try_assign_dim_array; } else { if (IS_VAR != IS_VAR || EXPECTED(!Z_ISERROR_P(object_ptr))) { @@ -19268,8 +19252,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_VAR_CONST_OP_D zval_ptr_dtor_nogc(free_op_data); } } else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) { - ZVAL_NEW_ARR(object_ptr); - zend_hash_init(Z_ARRVAL_P(object_ptr), 8, NULL, ZVAL_PTR_DTOR, 0); + ZVAL_ARR(object_ptr, zend_new_array(8)); goto try_assign_dim_array; } else { if (IS_VAR != IS_VAR || EXPECTED(!Z_ISERROR_P(object_ptr))) { @@ -19360,8 +19343,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_VAR_CONST_OP_D } } else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) { - ZVAL_NEW_ARR(object_ptr); - zend_hash_init(Z_ARRVAL_P(object_ptr), 8, NULL, ZVAL_PTR_DTOR, 0); + ZVAL_ARR(object_ptr, zend_new_array(8)); goto try_assign_dim_array; } else { if (IS_VAR != IS_VAR || EXPECTED(!Z_ISERROR_P(object_ptr))) { @@ -19786,8 +19768,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_VAR_CONST_HAND } else { size = 0; } - ZVAL_NEW_ARR(array); - zend_hash_init(Z_ARRVAL_P(array), size, NULL, ZVAL_PTR_DTOR, 0); + ZVAL_ARR(array, zend_new_array(size)); if (IS_VAR != IS_UNUSED) { /* Explicitly initialize array as not-packed if flag is set */ @@ -20672,8 +20653,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_binary_assign_op_dim_helper_SP } else if (IS_VAR == IS_CV && UNEXPECTED(Z_TYPE_INFO_P(container) == IS_UNDEF)) { container = GET_OP1_UNDEF_CV(container, BP_VAR_RW); assign_dim_op_convert_to_array: - ZVAL_NEW_ARR(container); - zend_hash_init(Z_ARRVAL_P(container), 8, NULL, ZVAL_PTR_DTOR, 0); + ZVAL_ARR(container, zend_new_array(8)); goto assign_dim_op_new_array; } @@ -20935,8 +20915,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_VAR_UNUSED_OP_ } } else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) { - ZVAL_NEW_ARR(object_ptr); - zend_hash_init(Z_ARRVAL_P(object_ptr), 8, NULL, ZVAL_PTR_DTOR, 0); + ZVAL_ARR(object_ptr, zend_new_array(8)); goto try_assign_dim_array; } else { if (IS_VAR != IS_VAR || EXPECTED(!Z_ISERROR_P(object_ptr))) { @@ -21028,8 +21007,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_VAR_UNUSED_OP_ zval_ptr_dtor_nogc(free_op_data); } } else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) { - ZVAL_NEW_ARR(object_ptr); - zend_hash_init(Z_ARRVAL_P(object_ptr), 8, NULL, ZVAL_PTR_DTOR, 0); + ZVAL_ARR(object_ptr, zend_new_array(8)); goto try_assign_dim_array; } else { if (IS_VAR != IS_VAR || EXPECTED(!Z_ISERROR_P(object_ptr))) { @@ -21121,8 +21099,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_VAR_UNUSED_OP_ zval_ptr_dtor_nogc(free_op_data); } } else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) { - ZVAL_NEW_ARR(object_ptr); - zend_hash_init(Z_ARRVAL_P(object_ptr), 8, NULL, ZVAL_PTR_DTOR, 0); + ZVAL_ARR(object_ptr, zend_new_array(8)); goto try_assign_dim_array; } else { if (IS_VAR != IS_VAR || EXPECTED(!Z_ISERROR_P(object_ptr))) { @@ -21213,8 +21190,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_VAR_UNUSED_OP_ } } else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) { - ZVAL_NEW_ARR(object_ptr); - zend_hash_init(Z_ARRVAL_P(object_ptr), 8, NULL, ZVAL_PTR_DTOR, 0); + ZVAL_ARR(object_ptr, zend_new_array(8)); goto try_assign_dim_array; } else { if (IS_VAR != IS_VAR || EXPECTED(!Z_ISERROR_P(object_ptr))) { @@ -21548,8 +21524,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_VAR_UNUSED_HAN } else { size = 0; } - ZVAL_NEW_ARR(array); - zend_hash_init(Z_ARRVAL_P(array), size, NULL, ZVAL_PTR_DTOR, 0); + ZVAL_ARR(array, zend_new_array(size)); if (IS_VAR != IS_UNUSED) { /* Explicitly initialize array as not-packed if flag is set */ @@ -21986,8 +21961,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_binary_assign_op_dim_helper_SP } else if (IS_VAR == IS_CV && UNEXPECTED(Z_TYPE_INFO_P(container) == IS_UNDEF)) { container = GET_OP1_UNDEF_CV(container, BP_VAR_RW); assign_dim_op_convert_to_array: - ZVAL_NEW_ARR(container); - zend_hash_init(Z_ARRVAL_P(container), 8, NULL, ZVAL_PTR_DTOR, 0); + ZVAL_ARR(container, zend_new_array(8)); goto assign_dim_op_new_array; } @@ -22577,7 +22551,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_R_SPEC_VAR_CV_HANDLE EXPECTED(zobj->ce == CACHED_PTR(Z_CACHE_SLOT_P(offset)))) { uint32_t prop_offset = (uint32_t)(intptr_t)CACHED_PTR(Z_CACHE_SLOT_P(offset) + sizeof(void*)); - if (EXPECTED(prop_offset != (uint32_t)ZEND_DYNAMIC_PROPERTY_OFFSET)) { + if (EXPECTED(IS_VALID_PROPERTY_OFFSET(prop_offset))) { retval = OBJ_PROP(zobj, prop_offset); if (EXPECTED(Z_TYPE_INFO_P(retval) != IS_UNDEF)) { ZVAL_COPY_UNREF(EX_VAR(opline->result.var), retval); @@ -22783,7 +22757,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_VAR_CV_OP_DATA zend_object *zobj = Z_OBJ_P(object); zval *property_val; - if (EXPECTED(prop_offset != (uint32_t)ZEND_DYNAMIC_PROPERTY_OFFSET)) { + if (EXPECTED(IS_VALID_PROPERTY_OFFSET(prop_offset))) { property_val = OBJ_PROP(zobj, prop_offset); if (Z_TYPE_P(property_val) != IS_UNDEF) { fast_assign_obj: @@ -22941,7 +22915,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_VAR_CV_OP_DATA zend_object *zobj = Z_OBJ_P(object); zval *property_val; - if (EXPECTED(prop_offset != (uint32_t)ZEND_DYNAMIC_PROPERTY_OFFSET)) { + if (EXPECTED(IS_VALID_PROPERTY_OFFSET(prop_offset))) { property_val = OBJ_PROP(zobj, prop_offset); if (Z_TYPE_P(property_val) != IS_UNDEF) { fast_assign_obj: @@ -23099,7 +23073,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_VAR_CV_OP_DATA zend_object *zobj = Z_OBJ_P(object); zval *property_val; - if (EXPECTED(prop_offset != (uint32_t)ZEND_DYNAMIC_PROPERTY_OFFSET)) { + if (EXPECTED(IS_VALID_PROPERTY_OFFSET(prop_offset))) { property_val = OBJ_PROP(zobj, prop_offset); if (Z_TYPE_P(property_val) != IS_UNDEF) { fast_assign_obj: @@ -23257,7 +23231,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_VAR_CV_OP_DATA zend_object *zobj = Z_OBJ_P(object); zval *property_val; - if (EXPECTED(prop_offset != (uint32_t)ZEND_DYNAMIC_PROPERTY_OFFSET)) { + if (EXPECTED(IS_VALID_PROPERTY_OFFSET(prop_offset))) { property_val = OBJ_PROP(zobj, prop_offset); if (Z_TYPE_P(property_val) != IS_UNDEF) { fast_assign_obj: @@ -23420,8 +23394,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_VAR_CV_OP_DATA } } else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) { - ZVAL_NEW_ARR(object_ptr); - zend_hash_init(Z_ARRVAL_P(object_ptr), 8, NULL, ZVAL_PTR_DTOR, 0); + ZVAL_ARR(object_ptr, zend_new_array(8)); goto try_assign_dim_array; } else { if (IS_VAR != IS_VAR || EXPECTED(!Z_ISERROR_P(object_ptr))) { @@ -23513,8 +23486,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_VAR_CV_OP_DATA zval_ptr_dtor_nogc(free_op_data); } } else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) { - ZVAL_NEW_ARR(object_ptr); - zend_hash_init(Z_ARRVAL_P(object_ptr), 8, NULL, ZVAL_PTR_DTOR, 0); + ZVAL_ARR(object_ptr, zend_new_array(8)); goto try_assign_dim_array; } else { if (IS_VAR != IS_VAR || EXPECTED(!Z_ISERROR_P(object_ptr))) { @@ -23606,8 +23578,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_VAR_CV_OP_DATA zval_ptr_dtor_nogc(free_op_data); } } else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) { - ZVAL_NEW_ARR(object_ptr); - zend_hash_init(Z_ARRVAL_P(object_ptr), 8, NULL, ZVAL_PTR_DTOR, 0); + ZVAL_ARR(object_ptr, zend_new_array(8)); goto try_assign_dim_array; } else { if (IS_VAR != IS_VAR || EXPECTED(!Z_ISERROR_P(object_ptr))) { @@ -23698,8 +23669,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_VAR_CV_OP_DATA } } else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) { - ZVAL_NEW_ARR(object_ptr); - zend_hash_init(Z_ARRVAL_P(object_ptr), 8, NULL, ZVAL_PTR_DTOR, 0); + ZVAL_ARR(object_ptr, zend_new_array(8)); goto try_assign_dim_array; } else { if (IS_VAR != IS_VAR || EXPECTED(!Z_ISERROR_P(object_ptr))) { @@ -24096,8 +24066,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_VAR_CV_HANDLER } else { size = 0; } - ZVAL_NEW_ARR(array); - zend_hash_init(Z_ARRVAL_P(array), size, NULL, ZVAL_PTR_DTOR, 0); + ZVAL_ARR(array, zend_new_array(size)); if (IS_VAR != IS_UNUSED) { /* Explicitly initialize array as not-packed if flag is set */ @@ -24592,8 +24561,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_binary_assign_op_dim_helper_SP } else if (IS_VAR == IS_CV && UNEXPECTED(Z_TYPE_INFO_P(container) == IS_UNDEF)) { container = GET_OP1_UNDEF_CV(container, BP_VAR_RW); assign_dim_op_convert_to_array: - ZVAL_NEW_ARR(container); - zend_hash_init(Z_ARRVAL_P(container), 8, NULL, ZVAL_PTR_DTOR, 0); + ZVAL_ARR(container, zend_new_array(8)); goto assign_dim_op_new_array; } @@ -25187,7 +25155,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_R_SPEC_VAR_TMPVAR_HA EXPECTED(zobj->ce == CACHED_PTR(Z_CACHE_SLOT_P(offset)))) { uint32_t prop_offset = (uint32_t)(intptr_t)CACHED_PTR(Z_CACHE_SLOT_P(offset) + sizeof(void*)); - if (EXPECTED(prop_offset != (uint32_t)ZEND_DYNAMIC_PROPERTY_OFFSET)) { + if (EXPECTED(IS_VALID_PROPERTY_OFFSET(prop_offset))) { retval = OBJ_PROP(zobj, prop_offset); if (EXPECTED(Z_TYPE_INFO_P(retval) != IS_UNDEF)) { ZVAL_COPY_UNREF(EX_VAR(opline->result.var), retval); @@ -25394,7 +25362,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_VAR_TMPVAR_OP_ zend_object *zobj = Z_OBJ_P(object); zval *property_val; - if (EXPECTED(prop_offset != (uint32_t)ZEND_DYNAMIC_PROPERTY_OFFSET)) { + if (EXPECTED(IS_VALID_PROPERTY_OFFSET(prop_offset))) { property_val = OBJ_PROP(zobj, prop_offset); if (Z_TYPE_P(property_val) != IS_UNDEF) { fast_assign_obj: @@ -25552,7 +25520,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_VAR_TMPVAR_OP_ zend_object *zobj = Z_OBJ_P(object); zval *property_val; - if (EXPECTED(prop_offset != (uint32_t)ZEND_DYNAMIC_PROPERTY_OFFSET)) { + if (EXPECTED(IS_VALID_PROPERTY_OFFSET(prop_offset))) { property_val = OBJ_PROP(zobj, prop_offset); if (Z_TYPE_P(property_val) != IS_UNDEF) { fast_assign_obj: @@ -25710,7 +25678,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_VAR_TMPVAR_OP_ zend_object *zobj = Z_OBJ_P(object); zval *property_val; - if (EXPECTED(prop_offset != (uint32_t)ZEND_DYNAMIC_PROPERTY_OFFSET)) { + if (EXPECTED(IS_VALID_PROPERTY_OFFSET(prop_offset))) { property_val = OBJ_PROP(zobj, prop_offset); if (Z_TYPE_P(property_val) != IS_UNDEF) { fast_assign_obj: @@ -25868,7 +25836,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_VAR_TMPVAR_OP_ zend_object *zobj = Z_OBJ_P(object); zval *property_val; - if (EXPECTED(prop_offset != (uint32_t)ZEND_DYNAMIC_PROPERTY_OFFSET)) { + if (EXPECTED(IS_VALID_PROPERTY_OFFSET(prop_offset))) { property_val = OBJ_PROP(zobj, prop_offset); if (Z_TYPE_P(property_val) != IS_UNDEF) { fast_assign_obj: @@ -26031,8 +25999,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_VAR_TMPVAR_OP_ } } else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) { - ZVAL_NEW_ARR(object_ptr); - zend_hash_init(Z_ARRVAL_P(object_ptr), 8, NULL, ZVAL_PTR_DTOR, 0); + ZVAL_ARR(object_ptr, zend_new_array(8)); goto try_assign_dim_array; } else { if (IS_VAR != IS_VAR || EXPECTED(!Z_ISERROR_P(object_ptr))) { @@ -26124,8 +26091,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_VAR_TMPVAR_OP_ zval_ptr_dtor_nogc(free_op_data); } } else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) { - ZVAL_NEW_ARR(object_ptr); - zend_hash_init(Z_ARRVAL_P(object_ptr), 8, NULL, ZVAL_PTR_DTOR, 0); + ZVAL_ARR(object_ptr, zend_new_array(8)); goto try_assign_dim_array; } else { if (IS_VAR != IS_VAR || EXPECTED(!Z_ISERROR_P(object_ptr))) { @@ -26217,8 +26183,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_VAR_TMPVAR_OP_ zval_ptr_dtor_nogc(free_op_data); } } else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) { - ZVAL_NEW_ARR(object_ptr); - zend_hash_init(Z_ARRVAL_P(object_ptr), 8, NULL, ZVAL_PTR_DTOR, 0); + ZVAL_ARR(object_ptr, zend_new_array(8)); goto try_assign_dim_array; } else { if (IS_VAR != IS_VAR || EXPECTED(!Z_ISERROR_P(object_ptr))) { @@ -26309,8 +26274,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_VAR_TMPVAR_OP_ } } else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) { - ZVAL_NEW_ARR(object_ptr); - zend_hash_init(Z_ARRVAL_P(object_ptr), 8, NULL, ZVAL_PTR_DTOR, 0); + ZVAL_ARR(object_ptr, zend_new_array(8)); goto try_assign_dim_array; } else { if (IS_VAR != IS_VAR || EXPECTED(!Z_ISERROR_P(object_ptr))) { @@ -26594,8 +26558,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_VAR_TMPVAR_HAN } else { size = 0; } - ZVAL_NEW_ARR(array); - zend_hash_init(Z_ARRVAL_P(array), size, NULL, ZVAL_PTR_DTOR, 0); + ZVAL_ARR(array, zend_new_array(size)); if (IS_VAR != IS_UNUSED) { /* Explicitly initialize array as not-packed if flag is set */ @@ -27247,7 +27210,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_R_SPEC_UNUSED_CONST_ EXPECTED(zobj->ce == CACHED_PTR(Z_CACHE_SLOT_P(offset)))) { uint32_t prop_offset = (uint32_t)(intptr_t)CACHED_PTR(Z_CACHE_SLOT_P(offset) + sizeof(void*)); - if (EXPECTED(prop_offset != (uint32_t)ZEND_DYNAMIC_PROPERTY_OFFSET)) { + if (EXPECTED(IS_VALID_PROPERTY_OFFSET(prop_offset))) { retval = OBJ_PROP(zobj, prop_offset); if (EXPECTED(Z_TYPE_INFO_P(retval) != IS_UNDEF)) { ZVAL_COPY_UNREF(EX_VAR(opline->result.var), retval); @@ -27367,7 +27330,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_IS_SPEC_UNUSED_CONST EXPECTED(zobj->ce == CACHED_PTR(Z_CACHE_SLOT_P(offset)))) { uint32_t prop_offset = (uint32_t)(intptr_t)CACHED_PTR(Z_CACHE_SLOT_P(offset) + sizeof(void*)); - if (EXPECTED(prop_offset != (uint32_t)ZEND_DYNAMIC_PROPERTY_OFFSET)) { + if (EXPECTED(IS_VALID_PROPERTY_OFFSET(prop_offset))) { retval = OBJ_PROP(zobj, prop_offset); if (EXPECTED(Z_TYPE_P(retval) != IS_UNDEF)) { ZVAL_COPY(EX_VAR(opline->result.var), retval); @@ -27523,7 +27486,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_UNUSED_CONST_O zend_object *zobj = Z_OBJ_P(object); zval *property_val; - if (EXPECTED(prop_offset != (uint32_t)ZEND_DYNAMIC_PROPERTY_OFFSET)) { + if (EXPECTED(IS_VALID_PROPERTY_OFFSET(prop_offset))) { property_val = OBJ_PROP(zobj, prop_offset); if (Z_TYPE_P(property_val) != IS_UNDEF) { fast_assign_obj: @@ -27681,7 +27644,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_UNUSED_CONST_O zend_object *zobj = Z_OBJ_P(object); zval *property_val; - if (EXPECTED(prop_offset != (uint32_t)ZEND_DYNAMIC_PROPERTY_OFFSET)) { + if (EXPECTED(IS_VALID_PROPERTY_OFFSET(prop_offset))) { property_val = OBJ_PROP(zobj, prop_offset); if (Z_TYPE_P(property_val) != IS_UNDEF) { fast_assign_obj: @@ -27839,7 +27802,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_UNUSED_CONST_O zend_object *zobj = Z_OBJ_P(object); zval *property_val; - if (EXPECTED(prop_offset != (uint32_t)ZEND_DYNAMIC_PROPERTY_OFFSET)) { + if (EXPECTED(IS_VALID_PROPERTY_OFFSET(prop_offset))) { property_val = OBJ_PROP(zobj, prop_offset); if (Z_TYPE_P(property_val) != IS_UNDEF) { fast_assign_obj: @@ -27997,7 +27960,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_UNUSED_CONST_O zend_object *zobj = Z_OBJ_P(object); zval *property_val; - if (EXPECTED(prop_offset != (uint32_t)ZEND_DYNAMIC_PROPERTY_OFFSET)) { + if (EXPECTED(IS_VALID_PROPERTY_OFFSET(prop_offset))) { property_val = OBJ_PROP(zobj, prop_offset); if (Z_TYPE_P(property_val) != IS_UNDEF) { fast_assign_obj: @@ -29472,8 +29435,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FUNC_GET_ARGS_SPEC_UNUSED_UNUS result_size = arg_count; } - ht = (zend_array *) emalloc(sizeof(zend_array)); - zend_hash_init(ht, result_size, NULL, ZVAL_PTR_DTOR, 0); + ht = zend_new_array(result_size); ZVAL_ARR(EX_VAR(opline->result.var), ht); if (result_size) { @@ -29856,7 +29818,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_R_SPEC_UNUSED_CV_HAN EXPECTED(zobj->ce == CACHED_PTR(Z_CACHE_SLOT_P(offset)))) { uint32_t prop_offset = (uint32_t)(intptr_t)CACHED_PTR(Z_CACHE_SLOT_P(offset) + sizeof(void*)); - if (EXPECTED(prop_offset != (uint32_t)ZEND_DYNAMIC_PROPERTY_OFFSET)) { + if (EXPECTED(IS_VALID_PROPERTY_OFFSET(prop_offset))) { retval = OBJ_PROP(zobj, prop_offset); if (EXPECTED(Z_TYPE_INFO_P(retval) != IS_UNDEF)) { ZVAL_COPY_UNREF(EX_VAR(opline->result.var), retval); @@ -29976,7 +29938,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_IS_SPEC_UNUSED_CV_HA EXPECTED(zobj->ce == CACHED_PTR(Z_CACHE_SLOT_P(offset)))) { uint32_t prop_offset = (uint32_t)(intptr_t)CACHED_PTR(Z_CACHE_SLOT_P(offset) + sizeof(void*)); - if (EXPECTED(prop_offset != (uint32_t)ZEND_DYNAMIC_PROPERTY_OFFSET)) { + if (EXPECTED(IS_VALID_PROPERTY_OFFSET(prop_offset))) { retval = OBJ_PROP(zobj, prop_offset); if (EXPECTED(Z_TYPE_P(retval) != IS_UNDEF)) { ZVAL_COPY(EX_VAR(opline->result.var), retval); @@ -30132,7 +30094,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_UNUSED_CV_OP_D zend_object *zobj = Z_OBJ_P(object); zval *property_val; - if (EXPECTED(prop_offset != (uint32_t)ZEND_DYNAMIC_PROPERTY_OFFSET)) { + if (EXPECTED(IS_VALID_PROPERTY_OFFSET(prop_offset))) { property_val = OBJ_PROP(zobj, prop_offset); if (Z_TYPE_P(property_val) != IS_UNDEF) { fast_assign_obj: @@ -30290,7 +30252,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_UNUSED_CV_OP_D zend_object *zobj = Z_OBJ_P(object); zval *property_val; - if (EXPECTED(prop_offset != (uint32_t)ZEND_DYNAMIC_PROPERTY_OFFSET)) { + if (EXPECTED(IS_VALID_PROPERTY_OFFSET(prop_offset))) { property_val = OBJ_PROP(zobj, prop_offset); if (Z_TYPE_P(property_val) != IS_UNDEF) { fast_assign_obj: @@ -30448,7 +30410,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_UNUSED_CV_OP_D zend_object *zobj = Z_OBJ_P(object); zval *property_val; - if (EXPECTED(prop_offset != (uint32_t)ZEND_DYNAMIC_PROPERTY_OFFSET)) { + if (EXPECTED(IS_VALID_PROPERTY_OFFSET(prop_offset))) { property_val = OBJ_PROP(zobj, prop_offset); if (Z_TYPE_P(property_val) != IS_UNDEF) { fast_assign_obj: @@ -30606,7 +30568,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_UNUSED_CV_OP_D zend_object *zobj = Z_OBJ_P(object); zval *property_val; - if (EXPECTED(prop_offset != (uint32_t)ZEND_DYNAMIC_PROPERTY_OFFSET)) { + if (EXPECTED(IS_VALID_PROPERTY_OFFSET(prop_offset))) { property_val = OBJ_PROP(zobj, prop_offset); if (Z_TYPE_P(property_val) != IS_UNDEF) { fast_assign_obj: @@ -31568,7 +31530,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_R_SPEC_UNUSED_TMPVAR EXPECTED(zobj->ce == CACHED_PTR(Z_CACHE_SLOT_P(offset)))) { uint32_t prop_offset = (uint32_t)(intptr_t)CACHED_PTR(Z_CACHE_SLOT_P(offset) + sizeof(void*)); - if (EXPECTED(prop_offset != (uint32_t)ZEND_DYNAMIC_PROPERTY_OFFSET)) { + if (EXPECTED(IS_VALID_PROPERTY_OFFSET(prop_offset))) { retval = OBJ_PROP(zobj, prop_offset); if (EXPECTED(Z_TYPE_INFO_P(retval) != IS_UNDEF)) { ZVAL_COPY_UNREF(EX_VAR(opline->result.var), retval); @@ -31689,7 +31651,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_IS_SPEC_UNUSED_TMPVA EXPECTED(zobj->ce == CACHED_PTR(Z_CACHE_SLOT_P(offset)))) { uint32_t prop_offset = (uint32_t)(intptr_t)CACHED_PTR(Z_CACHE_SLOT_P(offset) + sizeof(void*)); - if (EXPECTED(prop_offset != (uint32_t)ZEND_DYNAMIC_PROPERTY_OFFSET)) { + if (EXPECTED(IS_VALID_PROPERTY_OFFSET(prop_offset))) { retval = OBJ_PROP(zobj, prop_offset); if (EXPECTED(Z_TYPE_P(retval) != IS_UNDEF)) { ZVAL_COPY(EX_VAR(opline->result.var), retval); @@ -31846,7 +31808,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_UNUSED_TMPVAR_ zend_object *zobj = Z_OBJ_P(object); zval *property_val; - if (EXPECTED(prop_offset != (uint32_t)ZEND_DYNAMIC_PROPERTY_OFFSET)) { + if (EXPECTED(IS_VALID_PROPERTY_OFFSET(prop_offset))) { property_val = OBJ_PROP(zobj, prop_offset); if (Z_TYPE_P(property_val) != IS_UNDEF) { fast_assign_obj: @@ -32004,7 +31966,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_UNUSED_TMPVAR_ zend_object *zobj = Z_OBJ_P(object); zval *property_val; - if (EXPECTED(prop_offset != (uint32_t)ZEND_DYNAMIC_PROPERTY_OFFSET)) { + if (EXPECTED(IS_VALID_PROPERTY_OFFSET(prop_offset))) { property_val = OBJ_PROP(zobj, prop_offset); if (Z_TYPE_P(property_val) != IS_UNDEF) { fast_assign_obj: @@ -32162,7 +32124,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_UNUSED_TMPVAR_ zend_object *zobj = Z_OBJ_P(object); zval *property_val; - if (EXPECTED(prop_offset != (uint32_t)ZEND_DYNAMIC_PROPERTY_OFFSET)) { + if (EXPECTED(IS_VALID_PROPERTY_OFFSET(prop_offset))) { property_val = OBJ_PROP(zobj, prop_offset); if (Z_TYPE_P(property_val) != IS_UNDEF) { fast_assign_obj: @@ -32320,7 +32282,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_UNUSED_TMPVAR_ zend_object *zobj = Z_OBJ_P(object); zval *property_val; - if (EXPECTED(prop_offset != (uint32_t)ZEND_DYNAMIC_PROPERTY_OFFSET)) { + if (EXPECTED(IS_VALID_PROPERTY_OFFSET(prop_offset))) { property_val = OBJ_PROP(zobj, prop_offset); if (Z_TYPE_P(property_val) != IS_UNDEF) { fast_assign_obj: @@ -33819,8 +33781,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CAST_SPEC_CV_HANDLER(ZEND_OPCO if (opline->extended_value == IS_ARRAY) { if (Z_TYPE_P(expr) != IS_OBJECT) { - ZVAL_NEW_ARR(result); - zend_hash_init(Z_ARRVAL_P(result), 8, NULL, ZVAL_PTR_DTOR, 0); + ZVAL_ARR(result, zend_new_array(8)); if (Z_TYPE_P(expr) != IS_NULL) { expr = zend_hash_index_add_new(Z_ARRVAL_P(result), 0, expr); if (IS_CV == IS_CONST) { @@ -35387,8 +35348,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_binary_assign_op_dim_helper_SP } else if (IS_CV == IS_CV && UNEXPECTED(Z_TYPE_INFO_P(container) == IS_UNDEF)) { container = GET_OP1_UNDEF_CV(container, BP_VAR_RW); assign_dim_op_convert_to_array: - ZVAL_NEW_ARR(container); - zend_hash_init(Z_ARRVAL_P(container), 8, NULL, ZVAL_PTR_DTOR, 0); + ZVAL_ARR(container, zend_new_array(8)); goto assign_dim_op_new_array; } @@ -36095,7 +36055,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_R_SPEC_CV_CONST_HAND EXPECTED(zobj->ce == CACHED_PTR(Z_CACHE_SLOT_P(offset)))) { uint32_t prop_offset = (uint32_t)(intptr_t)CACHED_PTR(Z_CACHE_SLOT_P(offset) + sizeof(void*)); - if (EXPECTED(prop_offset != (uint32_t)ZEND_DYNAMIC_PROPERTY_OFFSET)) { + if (EXPECTED(IS_VALID_PROPERTY_OFFSET(prop_offset))) { retval = OBJ_PROP(zobj, prop_offset); if (EXPECTED(Z_TYPE_INFO_P(retval) != IS_UNDEF)) { ZVAL_COPY_UNREF(EX_VAR(opline->result.var), retval); @@ -36215,7 +36175,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_IS_SPEC_CV_CONST_HAN EXPECTED(zobj->ce == CACHED_PTR(Z_CACHE_SLOT_P(offset)))) { uint32_t prop_offset = (uint32_t)(intptr_t)CACHED_PTR(Z_CACHE_SLOT_P(offset) + sizeof(void*)); - if (EXPECTED(prop_offset != (uint32_t)ZEND_DYNAMIC_PROPERTY_OFFSET)) { + if (EXPECTED(IS_VALID_PROPERTY_OFFSET(prop_offset))) { retval = OBJ_PROP(zobj, prop_offset); if (EXPECTED(Z_TYPE_P(retval) != IS_UNDEF)) { ZVAL_COPY(EX_VAR(opline->result.var), retval); @@ -36384,7 +36344,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_CV_CONST_OP_DA zend_object *zobj = Z_OBJ_P(object); zval *property_val; - if (EXPECTED(prop_offset != (uint32_t)ZEND_DYNAMIC_PROPERTY_OFFSET)) { + if (EXPECTED(IS_VALID_PROPERTY_OFFSET(prop_offset))) { property_val = OBJ_PROP(zobj, prop_offset); if (Z_TYPE_P(property_val) != IS_UNDEF) { fast_assign_obj: @@ -36542,7 +36502,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_CV_CONST_OP_DA zend_object *zobj = Z_OBJ_P(object); zval *property_val; - if (EXPECTED(prop_offset != (uint32_t)ZEND_DYNAMIC_PROPERTY_OFFSET)) { + if (EXPECTED(IS_VALID_PROPERTY_OFFSET(prop_offset))) { property_val = OBJ_PROP(zobj, prop_offset); if (Z_TYPE_P(property_val) != IS_UNDEF) { fast_assign_obj: @@ -36700,7 +36660,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_CV_CONST_OP_DA zend_object *zobj = Z_OBJ_P(object); zval *property_val; - if (EXPECTED(prop_offset != (uint32_t)ZEND_DYNAMIC_PROPERTY_OFFSET)) { + if (EXPECTED(IS_VALID_PROPERTY_OFFSET(prop_offset))) { property_val = OBJ_PROP(zobj, prop_offset); if (Z_TYPE_P(property_val) != IS_UNDEF) { fast_assign_obj: @@ -36858,7 +36818,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_CV_CONST_OP_DA zend_object *zobj = Z_OBJ_P(object); zval *property_val; - if (EXPECTED(prop_offset != (uint32_t)ZEND_DYNAMIC_PROPERTY_OFFSET)) { + if (EXPECTED(IS_VALID_PROPERTY_OFFSET(prop_offset))) { property_val = OBJ_PROP(zobj, prop_offset); if (Z_TYPE_P(property_val) != IS_UNDEF) { fast_assign_obj: @@ -37021,8 +36981,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_CV_CONST_OP_DA } } else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) { - ZVAL_NEW_ARR(object_ptr); - zend_hash_init(Z_ARRVAL_P(object_ptr), 8, NULL, ZVAL_PTR_DTOR, 0); + ZVAL_ARR(object_ptr, zend_new_array(8)); goto try_assign_dim_array; } else { if (IS_CV != IS_VAR || EXPECTED(!Z_ISERROR_P(object_ptr))) { @@ -37114,8 +37073,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_CV_CONST_OP_DA zval_ptr_dtor_nogc(free_op_data); } } else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) { - ZVAL_NEW_ARR(object_ptr); - zend_hash_init(Z_ARRVAL_P(object_ptr), 8, NULL, ZVAL_PTR_DTOR, 0); + ZVAL_ARR(object_ptr, zend_new_array(8)); goto try_assign_dim_array; } else { if (IS_CV != IS_VAR || EXPECTED(!Z_ISERROR_P(object_ptr))) { @@ -37207,8 +37165,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_CV_CONST_OP_DA zval_ptr_dtor_nogc(free_op_data); } } else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) { - ZVAL_NEW_ARR(object_ptr); - zend_hash_init(Z_ARRVAL_P(object_ptr), 8, NULL, ZVAL_PTR_DTOR, 0); + ZVAL_ARR(object_ptr, zend_new_array(8)); goto try_assign_dim_array; } else { if (IS_CV != IS_VAR || EXPECTED(!Z_ISERROR_P(object_ptr))) { @@ -37299,8 +37256,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_CV_CONST_OP_DA } } else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) { - ZVAL_NEW_ARR(object_ptr); - zend_hash_init(Z_ARRVAL_P(object_ptr), 8, NULL, ZVAL_PTR_DTOR, 0); + ZVAL_ARR(object_ptr, zend_new_array(8)); goto try_assign_dim_array; } else { if (IS_CV != IS_VAR || EXPECTED(!Z_ISERROR_P(object_ptr))) { @@ -37787,8 +37743,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_CV_CONST_HANDL } else { size = 0; } - ZVAL_NEW_ARR(array); - zend_hash_init(Z_ARRVAL_P(array), size, NULL, ZVAL_PTR_DTOR, 0); + ZVAL_ARR(array, zend_new_array(size)); if (IS_CV != IS_UNUSED) { /* Explicitly initialize array as not-packed if flag is set */ @@ -39545,8 +39500,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_binary_assign_op_dim_helper_SP } else if (IS_CV == IS_CV && UNEXPECTED(Z_TYPE_INFO_P(container) == IS_UNDEF)) { container = GET_OP1_UNDEF_CV(container, BP_VAR_RW); assign_dim_op_convert_to_array: - ZVAL_NEW_ARR(container); - zend_hash_init(Z_ARRVAL_P(container), 8, NULL, ZVAL_PTR_DTOR, 0); + ZVAL_ARR(container, zend_new_array(8)); goto assign_dim_op_new_array; } @@ -40037,8 +39991,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_CV_UNUSED_OP_D } } else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) { - ZVAL_NEW_ARR(object_ptr); - zend_hash_init(Z_ARRVAL_P(object_ptr), 8, NULL, ZVAL_PTR_DTOR, 0); + ZVAL_ARR(object_ptr, zend_new_array(8)); goto try_assign_dim_array; } else { if (IS_CV != IS_VAR || EXPECTED(!Z_ISERROR_P(object_ptr))) { @@ -40130,8 +40083,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_CV_UNUSED_OP_D zval_ptr_dtor_nogc(free_op_data); } } else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) { - ZVAL_NEW_ARR(object_ptr); - zend_hash_init(Z_ARRVAL_P(object_ptr), 8, NULL, ZVAL_PTR_DTOR, 0); + ZVAL_ARR(object_ptr, zend_new_array(8)); goto try_assign_dim_array; } else { if (IS_CV != IS_VAR || EXPECTED(!Z_ISERROR_P(object_ptr))) { @@ -40223,8 +40175,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_CV_UNUSED_OP_D zval_ptr_dtor_nogc(free_op_data); } } else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) { - ZVAL_NEW_ARR(object_ptr); - zend_hash_init(Z_ARRVAL_P(object_ptr), 8, NULL, ZVAL_PTR_DTOR, 0); + ZVAL_ARR(object_ptr, zend_new_array(8)); goto try_assign_dim_array; } else { if (IS_CV != IS_VAR || EXPECTED(!Z_ISERROR_P(object_ptr))) { @@ -40315,8 +40266,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_CV_UNUSED_OP_D } } else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) { - ZVAL_NEW_ARR(object_ptr); - zend_hash_init(Z_ARRVAL_P(object_ptr), 8, NULL, ZVAL_PTR_DTOR, 0); + ZVAL_ARR(object_ptr, zend_new_array(8)); goto try_assign_dim_array; } else { if (IS_CV != IS_VAR || EXPECTED(!Z_ISERROR_P(object_ptr))) { @@ -40495,8 +40445,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_CV_UNUSED_HAND } else { size = 0; } - ZVAL_NEW_ARR(array); - zend_hash_init(Z_ARRVAL_P(array), size, NULL, ZVAL_PTR_DTOR, 0); + ZVAL_ARR(array, zend_new_array(size)); if (IS_CV != IS_UNUSED) { /* Explicitly initialize array as not-packed if flag is set */ @@ -41904,8 +41853,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_binary_assign_op_dim_helper_SP } else if (IS_CV == IS_CV && UNEXPECTED(Z_TYPE_INFO_P(container) == IS_UNDEF)) { container = GET_OP1_UNDEF_CV(container, BP_VAR_RW); assign_dim_op_convert_to_array: - ZVAL_NEW_ARR(container); - zend_hash_init(Z_ARRVAL_P(container), 8, NULL, ZVAL_PTR_DTOR, 0); + ZVAL_ARR(container, zend_new_array(8)); goto assign_dim_op_new_array; } @@ -42545,7 +42493,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_R_SPEC_CV_CV_HANDLER EXPECTED(zobj->ce == CACHED_PTR(Z_CACHE_SLOT_P(offset)))) { uint32_t prop_offset = (uint32_t)(intptr_t)CACHED_PTR(Z_CACHE_SLOT_P(offset) + sizeof(void*)); - if (EXPECTED(prop_offset != (uint32_t)ZEND_DYNAMIC_PROPERTY_OFFSET)) { + if (EXPECTED(IS_VALID_PROPERTY_OFFSET(prop_offset))) { retval = OBJ_PROP(zobj, prop_offset); if (EXPECTED(Z_TYPE_INFO_P(retval) != IS_UNDEF)) { ZVAL_COPY_UNREF(EX_VAR(opline->result.var), retval); @@ -42665,7 +42613,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_IS_SPEC_CV_CV_HANDLE EXPECTED(zobj->ce == CACHED_PTR(Z_CACHE_SLOT_P(offset)))) { uint32_t prop_offset = (uint32_t)(intptr_t)CACHED_PTR(Z_CACHE_SLOT_P(offset) + sizeof(void*)); - if (EXPECTED(prop_offset != (uint32_t)ZEND_DYNAMIC_PROPERTY_OFFSET)) { + if (EXPECTED(IS_VALID_PROPERTY_OFFSET(prop_offset))) { retval = OBJ_PROP(zobj, prop_offset); if (EXPECTED(Z_TYPE_P(retval) != IS_UNDEF)) { ZVAL_COPY(EX_VAR(opline->result.var), retval); @@ -42834,7 +42782,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_CV_CV_OP_DATA_ zend_object *zobj = Z_OBJ_P(object); zval *property_val; - if (EXPECTED(prop_offset != (uint32_t)ZEND_DYNAMIC_PROPERTY_OFFSET)) { + if (EXPECTED(IS_VALID_PROPERTY_OFFSET(prop_offset))) { property_val = OBJ_PROP(zobj, prop_offset); if (Z_TYPE_P(property_val) != IS_UNDEF) { fast_assign_obj: @@ -42992,7 +42940,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_CV_CV_OP_DATA_ zend_object *zobj = Z_OBJ_P(object); zval *property_val; - if (EXPECTED(prop_offset != (uint32_t)ZEND_DYNAMIC_PROPERTY_OFFSET)) { + if (EXPECTED(IS_VALID_PROPERTY_OFFSET(prop_offset))) { property_val = OBJ_PROP(zobj, prop_offset); if (Z_TYPE_P(property_val) != IS_UNDEF) { fast_assign_obj: @@ -43150,7 +43098,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_CV_CV_OP_DATA_ zend_object *zobj = Z_OBJ_P(object); zval *property_val; - if (EXPECTED(prop_offset != (uint32_t)ZEND_DYNAMIC_PROPERTY_OFFSET)) { + if (EXPECTED(IS_VALID_PROPERTY_OFFSET(prop_offset))) { property_val = OBJ_PROP(zobj, prop_offset); if (Z_TYPE_P(property_val) != IS_UNDEF) { fast_assign_obj: @@ -43308,7 +43256,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_CV_CV_OP_DATA_ zend_object *zobj = Z_OBJ_P(object); zval *property_val; - if (EXPECTED(prop_offset != (uint32_t)ZEND_DYNAMIC_PROPERTY_OFFSET)) { + if (EXPECTED(IS_VALID_PROPERTY_OFFSET(prop_offset))) { property_val = OBJ_PROP(zobj, prop_offset); if (Z_TYPE_P(property_val) != IS_UNDEF) { fast_assign_obj: @@ -43471,8 +43419,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_CV_CV_OP_DATA_ } } else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) { - ZVAL_NEW_ARR(object_ptr); - zend_hash_init(Z_ARRVAL_P(object_ptr), 8, NULL, ZVAL_PTR_DTOR, 0); + ZVAL_ARR(object_ptr, zend_new_array(8)); goto try_assign_dim_array; } else { if (IS_CV != IS_VAR || EXPECTED(!Z_ISERROR_P(object_ptr))) { @@ -43564,8 +43511,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_CV_CV_OP_DATA_ zval_ptr_dtor_nogc(free_op_data); } } else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) { - ZVAL_NEW_ARR(object_ptr); - zend_hash_init(Z_ARRVAL_P(object_ptr), 8, NULL, ZVAL_PTR_DTOR, 0); + ZVAL_ARR(object_ptr, zend_new_array(8)); goto try_assign_dim_array; } else { if (IS_CV != IS_VAR || EXPECTED(!Z_ISERROR_P(object_ptr))) { @@ -43657,8 +43603,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_CV_CV_OP_DATA_ zval_ptr_dtor_nogc(free_op_data); } } else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) { - ZVAL_NEW_ARR(object_ptr); - zend_hash_init(Z_ARRVAL_P(object_ptr), 8, NULL, ZVAL_PTR_DTOR, 0); + ZVAL_ARR(object_ptr, zend_new_array(8)); goto try_assign_dim_array; } else { if (IS_CV != IS_VAR || EXPECTED(!Z_ISERROR_P(object_ptr))) { @@ -43749,8 +43694,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_CV_CV_OP_DATA_ } } else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) { - ZVAL_NEW_ARR(object_ptr); - zend_hash_init(Z_ARRVAL_P(object_ptr), 8, NULL, ZVAL_PTR_DTOR, 0); + ZVAL_ARR(object_ptr, zend_new_array(8)); goto try_assign_dim_array; } else { if (IS_CV != IS_VAR || EXPECTED(!Z_ISERROR_P(object_ptr))) { @@ -44293,8 +44237,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_CV_CV_HANDLER( } else { size = 0; } - ZVAL_NEW_ARR(array); - zend_hash_init(Z_ARRVAL_P(array), size, NULL, ZVAL_PTR_DTOR, 0); + ZVAL_ARR(array, zend_new_array(size)); if (IS_CV != IS_UNUSED) { /* Explicitly initialize array as not-packed if flag is set */ @@ -45578,8 +45521,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_binary_assign_op_dim_helper_SP } else if (IS_CV == IS_CV && UNEXPECTED(Z_TYPE_INFO_P(container) == IS_UNDEF)) { container = GET_OP1_UNDEF_CV(container, BP_VAR_RW); assign_dim_op_convert_to_array: - ZVAL_NEW_ARR(container); - zend_hash_init(Z_ARRVAL_P(container), 8, NULL, ZVAL_PTR_DTOR, 0); + ZVAL_ARR(container, zend_new_array(8)); goto assign_dim_op_new_array; } @@ -46223,7 +46165,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_R_SPEC_CV_TMPVAR_HAN EXPECTED(zobj->ce == CACHED_PTR(Z_CACHE_SLOT_P(offset)))) { uint32_t prop_offset = (uint32_t)(intptr_t)CACHED_PTR(Z_CACHE_SLOT_P(offset) + sizeof(void*)); - if (EXPECTED(prop_offset != (uint32_t)ZEND_DYNAMIC_PROPERTY_OFFSET)) { + if (EXPECTED(IS_VALID_PROPERTY_OFFSET(prop_offset))) { retval = OBJ_PROP(zobj, prop_offset); if (EXPECTED(Z_TYPE_INFO_P(retval) != IS_UNDEF)) { ZVAL_COPY_UNREF(EX_VAR(opline->result.var), retval); @@ -46344,7 +46286,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_IS_SPEC_CV_TMPVAR_HA EXPECTED(zobj->ce == CACHED_PTR(Z_CACHE_SLOT_P(offset)))) { uint32_t prop_offset = (uint32_t)(intptr_t)CACHED_PTR(Z_CACHE_SLOT_P(offset) + sizeof(void*)); - if (EXPECTED(prop_offset != (uint32_t)ZEND_DYNAMIC_PROPERTY_OFFSET)) { + if (EXPECTED(IS_VALID_PROPERTY_OFFSET(prop_offset))) { retval = OBJ_PROP(zobj, prop_offset); if (EXPECTED(Z_TYPE_P(retval) != IS_UNDEF)) { ZVAL_COPY(EX_VAR(opline->result.var), retval); @@ -46514,7 +46456,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_CV_TMPVAR_OP_D zend_object *zobj = Z_OBJ_P(object); zval *property_val; - if (EXPECTED(prop_offset != (uint32_t)ZEND_DYNAMIC_PROPERTY_OFFSET)) { + if (EXPECTED(IS_VALID_PROPERTY_OFFSET(prop_offset))) { property_val = OBJ_PROP(zobj, prop_offset); if (Z_TYPE_P(property_val) != IS_UNDEF) { fast_assign_obj: @@ -46672,7 +46614,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_CV_TMPVAR_OP_D zend_object *zobj = Z_OBJ_P(object); zval *property_val; - if (EXPECTED(prop_offset != (uint32_t)ZEND_DYNAMIC_PROPERTY_OFFSET)) { + if (EXPECTED(IS_VALID_PROPERTY_OFFSET(prop_offset))) { property_val = OBJ_PROP(zobj, prop_offset); if (Z_TYPE_P(property_val) != IS_UNDEF) { fast_assign_obj: @@ -46830,7 +46772,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_CV_TMPVAR_OP_D zend_object *zobj = Z_OBJ_P(object); zval *property_val; - if (EXPECTED(prop_offset != (uint32_t)ZEND_DYNAMIC_PROPERTY_OFFSET)) { + if (EXPECTED(IS_VALID_PROPERTY_OFFSET(prop_offset))) { property_val = OBJ_PROP(zobj, prop_offset); if (Z_TYPE_P(property_val) != IS_UNDEF) { fast_assign_obj: @@ -46988,7 +46930,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_CV_TMPVAR_OP_D zend_object *zobj = Z_OBJ_P(object); zval *property_val; - if (EXPECTED(prop_offset != (uint32_t)ZEND_DYNAMIC_PROPERTY_OFFSET)) { + if (EXPECTED(IS_VALID_PROPERTY_OFFSET(prop_offset))) { property_val = OBJ_PROP(zobj, prop_offset); if (Z_TYPE_P(property_val) != IS_UNDEF) { fast_assign_obj: @@ -47151,8 +47093,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_CV_TMPVAR_OP_D } } else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) { - ZVAL_NEW_ARR(object_ptr); - zend_hash_init(Z_ARRVAL_P(object_ptr), 8, NULL, ZVAL_PTR_DTOR, 0); + ZVAL_ARR(object_ptr, zend_new_array(8)); goto try_assign_dim_array; } else { if (IS_CV != IS_VAR || EXPECTED(!Z_ISERROR_P(object_ptr))) { @@ -47244,8 +47185,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_CV_TMPVAR_OP_D zval_ptr_dtor_nogc(free_op_data); } } else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) { - ZVAL_NEW_ARR(object_ptr); - zend_hash_init(Z_ARRVAL_P(object_ptr), 8, NULL, ZVAL_PTR_DTOR, 0); + ZVAL_ARR(object_ptr, zend_new_array(8)); goto try_assign_dim_array; } else { if (IS_CV != IS_VAR || EXPECTED(!Z_ISERROR_P(object_ptr))) { @@ -47337,8 +47277,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_CV_TMPVAR_OP_D zval_ptr_dtor_nogc(free_op_data); } } else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) { - ZVAL_NEW_ARR(object_ptr); - zend_hash_init(Z_ARRVAL_P(object_ptr), 8, NULL, ZVAL_PTR_DTOR, 0); + ZVAL_ARR(object_ptr, zend_new_array(8)); goto try_assign_dim_array; } else { if (IS_CV != IS_VAR || EXPECTED(!Z_ISERROR_P(object_ptr))) { @@ -47429,8 +47368,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_CV_TMPVAR_OP_D } } else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) { - ZVAL_NEW_ARR(object_ptr); - zend_hash_init(Z_ARRVAL_P(object_ptr), 8, NULL, ZVAL_PTR_DTOR, 0); + ZVAL_ARR(object_ptr, zend_new_array(8)); goto try_assign_dim_array; } else { if (IS_CV != IS_VAR || EXPECTED(!Z_ISERROR_P(object_ptr))) { @@ -47862,8 +47800,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_CV_TMPVAR_HAND } else { size = 0; } - ZVAL_NEW_ARR(array); - zend_hash_init(Z_ARRVAL_P(array), size, NULL, ZVAL_PTR_DTOR, 0); + ZVAL_ARR(array, zend_new_array(size)); if (IS_CV != IS_UNUSED) { /* Explicitly initialize array as not-packed if flag is set */ @@ -49590,7 +49527,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_IS_SPEC_TMPVAR_CONST EXPECTED(zobj->ce == CACHED_PTR(Z_CACHE_SLOT_P(offset)))) { uint32_t prop_offset = (uint32_t)(intptr_t)CACHED_PTR(Z_CACHE_SLOT_P(offset) + sizeof(void*)); - if (EXPECTED(prop_offset != (uint32_t)ZEND_DYNAMIC_PROPERTY_OFFSET)) { + if (EXPECTED(IS_VALID_PROPERTY_OFFSET(prop_offset))) { retval = OBJ_PROP(zobj, prop_offset); if (EXPECTED(Z_TYPE_P(retval) != IS_UNDEF)) { ZVAL_COPY(EX_VAR(opline->result.var), retval); @@ -51927,7 +51864,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_IS_SPEC_TMPVAR_CV_HA EXPECTED(zobj->ce == CACHED_PTR(Z_CACHE_SLOT_P(offset)))) { uint32_t prop_offset = (uint32_t)(intptr_t)CACHED_PTR(Z_CACHE_SLOT_P(offset) + sizeof(void*)); - if (EXPECTED(prop_offset != (uint32_t)ZEND_DYNAMIC_PROPERTY_OFFSET)) { + if (EXPECTED(IS_VALID_PROPERTY_OFFSET(prop_offset))) { retval = OBJ_PROP(zobj, prop_offset); if (EXPECTED(Z_TYPE_P(retval) != IS_UNDEF)) { ZVAL_COPY(EX_VAR(opline->result.var), retval); @@ -53257,7 +53194,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_IS_SPEC_TMPVAR_TMPVA EXPECTED(zobj->ce == CACHED_PTR(Z_CACHE_SLOT_P(offset)))) { uint32_t prop_offset = (uint32_t)(intptr_t)CACHED_PTR(Z_CACHE_SLOT_P(offset) + sizeof(void*)); - if (EXPECTED(prop_offset != (uint32_t)ZEND_DYNAMIC_PROPERTY_OFFSET)) { + if (EXPECTED(IS_VALID_PROPERTY_OFFSET(prop_offset))) { retval = OBJ_PROP(zobj, prop_offset); if (EXPECTED(Z_TYPE_P(retval) != IS_UNDEF)) { ZVAL_COPY(EX_VAR(opline->result.var), retval); diff --git a/configure.ac b/configure.ac index 80fe2a7a07571..a63354f296866 100644 --- a/configure.ac +++ b/configure.ac @@ -106,7 +106,7 @@ int zend_sprintf(char *buffer, const char *format, ...); ]) PHP_MAJOR_VERSION=7 -PHP_MINOR_VERSION=2 +PHP_MINOR_VERSION=3 PHP_RELEASE_VERSION=0 PHP_EXTRA_VERSION="-dev" PHP_VERSION="$PHP_MAJOR_VERSION.$PHP_MINOR_VERSION.$PHP_RELEASE_VERSION$PHP_EXTRA_VERSION" @@ -1443,7 +1443,7 @@ PHP_ADD_SOURCES(main, main.c snprintf.c spprintf.c php_sprintf.c \ php_ini.c SAPI.c rfc1867.c php_content_types.c strlcpy.c \ strlcat.c explicit_bzero.c mergesort.c reentrancy.c php_variables.c php_ticks.c \ network.c php_open_temporary_file.c \ - output.c getopt.c, -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1) + output.c getopt.c php_syslog.c, -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1) PHP_ADD_SOURCES_X(main, fastcgi.c, -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1, PHP_FASTCGI_OBJS, no) diff --git a/ext/bcmath/bcmath.c b/ext/bcmath/bcmath.c index e8b87dceff00e..1186241620ab9 100644 --- a/ext/bcmath/bcmath.c +++ b/ext/bcmath/bcmath.c @@ -89,7 +89,7 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_bccomp, 0, 0, 2) ZEND_ARG_INFO(0, scale) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO(arginfo_bcscale, 0) +ZEND_BEGIN_ARG_INFO_EX(arginfo_bcscale, 0, 0, 0) ZEND_ARG_INFO(0, scale) ZEND_END_ARG_INFO() @@ -207,21 +207,6 @@ static void php_str2num(bc_num *num, char *str) } /* }}} */ -/* {{{ split_bc_num - Convert to bc_num detecting scale */ -static bc_num split_bc_num(bc_num num) { - bc_num newnum; - if (num->n_refs >= 1) { - return num; - } - newnum = _bc_new_num_ex(0, 0, 0); - *newnum = *num; - newnum->n_refs = 1; - num->n_refs--; - return newnum; -} -/* }}} */ - /* {{{ proto string bcadd(string left_operand, string right_operand [, int scale]) Returns the sum of two arbitrary precision numbers */ PHP_FUNCTION(bcadd) @@ -249,12 +234,7 @@ PHP_FUNCTION(bcadd) php_str2num(&second, ZSTR_VAL(right)); bc_add (first, second, &result, scale); - if (result->n_scale > scale) { - result = split_bc_num(result); - result->n_scale = scale; - } - - RETVAL_STR(bc_num2str(result)); + RETVAL_STR(bc_num2str_ex(result, scale)); bc_free_num(&first); bc_free_num(&second); bc_free_num(&result); @@ -289,12 +269,7 @@ PHP_FUNCTION(bcsub) php_str2num(&second, ZSTR_VAL(right)); bc_sub (first, second, &result, scale); - if (result->n_scale > scale) { - result = split_bc_num(result); - result->n_scale = scale; - } - - RETVAL_STR(bc_num2str(result)); + RETVAL_STR(bc_num2str_ex(result, scale)); bc_free_num(&first); bc_free_num(&second); bc_free_num(&result); @@ -329,12 +304,7 @@ PHP_FUNCTION(bcmul) php_str2num(&second, ZSTR_VAL(right)); bc_multiply (first, second, &result, scale); - if (result->n_scale > scale) { - result = split_bc_num(result); - result->n_scale = scale; - } - - RETVAL_STR(bc_num2str(result)); + RETVAL_STR(bc_num2str_ex(result, scale)); bc_free_num(&first); bc_free_num(&second); bc_free_num(&result); @@ -370,11 +340,7 @@ PHP_FUNCTION(bcdiv) switch (bc_divide(first, second, &result, scale)) { case 0: /* OK */ - if (result->n_scale > scale) { - result = split_bc_num(result); - result->n_scale = scale; - } - RETVAL_STR(bc_num2str(result)); + RETVAL_STR(bc_num2str_ex(result, scale)); break; case -1: /* division by zero */ php_error_docref(NULL, E_WARNING, "Division by zero"); @@ -450,11 +416,7 @@ PHP_FUNCTION(bcpowmod) scale_int = (int) ((int)scale < 0 ? 0 : scale); if (bc_raisemod(first, second, mod, &result, scale_int) != -1) { - if (result->n_scale > scale_int) { - result = split_bc_num(result); - result->n_scale = scale_int; - } - RETVAL_STR(bc_num2str(result)); + RETVAL_STR(bc_num2str_ex(result, scale_int)); } else { RETVAL_FALSE; } @@ -494,12 +456,7 @@ PHP_FUNCTION(bcpow) php_str2num(&second, ZSTR_VAL(right)); bc_raise (first, second, &result, scale); - if (result->n_scale > scale) { - result = split_bc_num(result); - result->n_scale = scale; - } - - RETVAL_STR(bc_num2str(result)); + RETVAL_STR(bc_num2str_ex(result, scale)); bc_free_num(&first); bc_free_num(&second); bc_free_num(&result); @@ -530,11 +487,7 @@ PHP_FUNCTION(bcsqrt) php_str2num(&result, ZSTR_VAL(left)); if (bc_sqrt (&result, scale) != 0) { - if (result->n_scale > scale) { - result = split_bc_num(result); - result->n_scale = scale; - } - RETVAL_STR(bc_num2str(result)); + RETVAL_STR(bc_num2str_ex(result, scale)); } else { php_error_docref(NULL, E_WARNING, "Square root of negative number"); } @@ -577,19 +530,24 @@ PHP_FUNCTION(bccomp) } /* }}} */ -/* {{{ proto bool bcscale(int scale) +/* {{{ proto int bcscale([int scale]) Sets default scale parameter for all bc math functions */ PHP_FUNCTION(bcscale) { - zend_long new_scale; + zend_long old_scale, new_scale; - ZEND_PARSE_PARAMETERS_START(1, 1) + ZEND_PARSE_PARAMETERS_START(0, 1) + Z_PARAM_OPTIONAL Z_PARAM_LONG(new_scale) ZEND_PARSE_PARAMETERS_END(); - BCG(bc_precision) = ((int)new_scale < 0) ? 0 : new_scale; + old_scale = BCG(bc_precision); + + if (ZEND_NUM_ARGS() == 1) { + BCG(bc_precision) = ((int)new_scale < 0) ? 0 : new_scale; + } - RETURN_TRUE; + RETURN_LONG(old_scale); } /* }}} */ diff --git a/ext/bcmath/config.m4 b/ext/bcmath/config.m4 index bc126454b4d01..85c535d0f5f33 100644 --- a/ext/bcmath/config.m4 +++ b/ext/bcmath/config.m4 @@ -7,7 +7,7 @@ PHP_ARG_ENABLE(bcmath, whether to enable bc style precision math functions, if test "$PHP_BCMATH" != "no"; then PHP_NEW_EXTENSION(bcmath, bcmath.c \ -libbcmath/src/add.c libbcmath/src/div.c libbcmath/src/init.c libbcmath/src/neg.c libbcmath/src/outofmem.c libbcmath/src/raisemod.c libbcmath/src/rt.c libbcmath/src/sub.c \ +libbcmath/src/add.c libbcmath/src/div.c libbcmath/src/init.c libbcmath/src/neg.c libbcmath/src/outofmem.c libbcmath/src/raisemod.c libbcmath/src/sub.c \ libbcmath/src/compare.c libbcmath/src/divmod.c libbcmath/src/int2num.c libbcmath/src/num2long.c libbcmath/src/output.c libbcmath/src/recmul.c \ libbcmath/src/sqrt.c libbcmath/src/zero.c libbcmath/src/debug.c libbcmath/src/doaddsub.c libbcmath/src/nearzero.c libbcmath/src/num2str.c libbcmath/src/raise.c \ libbcmath/src/rmzero.c libbcmath/src/str2num.c, diff --git a/ext/bcmath/config.w32 b/ext/bcmath/config.w32 index 3973c10cbfa79..f79df604b8e92 100644 --- a/ext/bcmath/config.w32 +++ b/ext/bcmath/config.w32 @@ -6,7 +6,7 @@ ARG_ENABLE("bcmath", "bc style precision math functions", "yes"); if (PHP_BCMATH == "yes") { EXTENSION("bcmath", "bcmath.c", null, "-Iext/bcmath/libbcmath/src /DZEND_ENABLE_STATIC_TSRMLS_CACHE=1"); ADD_SOURCES("ext/bcmath/libbcmath/src", "add.c div.c init.c neg.c \ - outofmem.c raisemod.c rt.c sub.c compare.c divmod.c int2num.c \ + outofmem.c raisemod.c sub.c compare.c divmod.c int2num.c \ num2long.c output.c recmul.c sqrt.c zero.c debug.c doaddsub.c \ nearzero.c num2str.c raise.c rmzero.c str2num.c", "bcmath"); diff --git a/ext/bcmath/libbcmath/src/bcmath.h b/ext/bcmath/libbcmath/src/bcmath.h index 28d275d32c1e9..78868edcb339a 100644 --- a/ext/bcmath/libbcmath/src/bcmath.h +++ b/ext/bcmath/libbcmath/src/bcmath.h @@ -42,7 +42,6 @@ typedef struct bc_struct 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 @@ -111,7 +110,7 @@ _PROTOTYPE(void bc_init_num, (bc_num *num)); _PROTOTYPE(void bc_str2num, (bc_num *num, char *str, int scale)); -_PROTOTYPE(zend_string *bc_num2str, (bc_num num)); +_PROTOTYPE(zend_string *bc_num2str_ex, (bc_num num, int scale)); _PROTOTYPE(void bc_int2num, (bc_num *num, int val)); @@ -152,11 +151,10 @@ _PROTOTYPE(void bc_out_num, (bc_num num, int o_base, void (* out_char)(int), /* 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) +#define bc_num2str(num) bc_num2str_ex((num), (num->n_scale)) #endif diff --git a/ext/bcmath/libbcmath/src/init.c b/ext/bcmath/libbcmath/src/init.c index 229ef05002722..bd73da2a9d72c 100644 --- a/ext/bcmath/libbcmath/src/init.c +++ b/ext/bcmath/libbcmath/src/init.c @@ -51,14 +51,6 @@ _bc_new_num_ex (length, scale, persistent) } /* PHP Change: malloc() -> pemalloc(), removed free_list code */ temp = (bc_num) safe_pemalloc (1, sizeof(bc_struct)+length, scale, persistent); -#if 0 - if (_bc_Free_list != NULL) { - temp = _bc_Free_list; - _bc_Free_list = temp->n_next; - } else { - temp = (bc_num) pemalloc (sizeof(bc_struct), persistent); - } -#endif temp->n_sign = PLUS; temp->n_len = length; temp->n_scale = scale; @@ -86,10 +78,6 @@ _bc_free_num_ex (num, persistent) /* PHP Change: free() -> pefree(), removed free_list code */ pefree ((*num)->n_ptr, persistent); pefree(*num, persistent); -#if 0 - (*num)->n_next = _bc_Free_list; - _bc_Free_list = *num; -#endif } *num = NULL; } diff --git a/ext/bcmath/libbcmath/src/num2str.c b/ext/bcmath/libbcmath/src/num2str.c index c72a924933a55..7316d32a14abe 100644 --- a/ext/bcmath/libbcmath/src/num2str.c +++ b/ext/bcmath/libbcmath/src/num2str.c @@ -41,8 +41,9 @@ /* Convert a numbers to a string. Base 10 only.*/ zend_string -*bc_num2str (num) +*bc_num2str_ex (num, scale) bc_num num; + int scale; { zend_string *str; char *sptr; @@ -51,8 +52,8 @@ zend_string /* Allocate the string memory. */ signch = ( num->n_sign == PLUS ? 0 : 1 ); /* Number of sign chars. */ - if (num->n_scale > 0) - str = zend_string_alloc(num->n_len + num->n_scale + signch + 1, 0); + if (scale > 0) + str = zend_string_alloc(num->n_len + scale + signch + 1, 0); else str = zend_string_alloc(num->n_len + signch, 0); if (str == NULL) bc_out_of_memory(); @@ -67,11 +68,13 @@ zend_string *sptr++ = BCD_CHAR(*nptr++); /* Now the fraction. */ - if (num->n_scale > 0) + if (scale > 0) { *sptr++ = '.'; - for (index=0; indexn_scale; index++) + for (index=0; indexn_scale; index++) *sptr++ = BCD_CHAR(*nptr++); + for (index = num->n_scale; indexn_scale != 0) - bc_rt_warn ("non-zero scale in exponent"); + php_error_docref (NULL, E_WARNING, "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"); + php_error_docref (NULL, E_WARNING, "exponent too large"); /* Special case if exponent is a zero. */ if (exponent == 0) diff --git a/ext/bcmath/libbcmath/src/raisemod.c b/ext/bcmath/libbcmath/src/raisemod.c index 84788b4770cf5..a3154b55cd830 100644 --- a/ext/bcmath/libbcmath/src/raisemod.c +++ b/ext/bcmath/libbcmath/src/raisemod.c @@ -38,6 +38,24 @@ #include "bcmath.h" #include "private.h" + +/* Truncate a number to zero scale. To avoid sharing issues (refcount and + shared n_value) the number is copied, this copy is truncated, and the + original number is "freed". */ + +static void +_bc_truncate (bc_num *num) +{ + bc_num temp; + + temp = bc_new_num ((*num)->n_len, 0); + temp->n_sign = (*num)->n_sign; + memcpy (temp->n_value, (*num)->n_value, (*num)->n_len); + bc_free_num (num); + *num = temp; +} + + /* 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. */ @@ -62,22 +80,22 @@ bc_raisemod (bc_num base, bc_num expo, bc_num mod, bc_num *result, int scale) /* Check the base for scale digits. */ if (power->n_scale != 0) { - bc_rt_warn ("non-zero scale in base"); - bc_divide (power, BCG(_one_), &power, 0); /*truncate */ + php_error_docref (NULL, E_WARNING, "non-zero scale in base"); + _bc_truncate (&power); } /* 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); /*truncate */ + php_error_docref (NULL, E_WARNING, "non-zero scale in exponent"); + _bc_truncate (&exponent); } /* Check the modulus for scale digits. */ if (modulus->n_scale != 0) { - bc_rt_warn ("non-zero scale in modulus"); - bc_divide (modulus, BCG(_one_), &modulus, 0); /*truncate */ + php_error_docref (NULL, E_WARNING, "non-zero scale in modulus"); + _bc_truncate (&modulus); } /* Do the calculation. */ diff --git a/ext/bcmath/libbcmath/src/rt.c b/ext/bcmath/libbcmath/src/rt.c deleted file mode 100644 index 5f4d46527c737..0000000000000 --- a/ext/bcmath/libbcmath/src/rt.c +++ /dev/null @@ -1,65 +0,0 @@ -/* 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 -#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/ext/bcmath/package.xml b/ext/bcmath/package.xml deleted file mode 100644 index 3ef9773fe7fa6..0000000000000 --- a/ext/bcmath/package.xml +++ /dev/null @@ -1,94 +0,0 @@ - - - - bcmath - Arbitrary Precision Mathematics Functions - - - andi - Andi Gutmans - andi@php.net - lead - - - -For arbitrary precision mathematics PHP offers the Binary Calculator -which supports numbers of any size and precision, represented as strings. - - PHP - - beta - 5.0.0rc1 - 2004-03-19 - -package.xml added to support installation using pear installer - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/ext/bcmath/tests/bcpow.phpt b/ext/bcmath/tests/bcpow.phpt index 141ec61d92ab6..ad642a57be2c8 100644 --- a/ext/bcmath/tests/bcpow.phpt +++ b/ext/bcmath/tests/bcpow.phpt @@ -13,6 +13,6 @@ echo bcpow("-2.555", "5", 2),"\n"; ?> --EXPECT-- 1 --32 +-32.0000 18446744073709551616 -108.88 diff --git a/ext/bcmath/tests/bcpow_error1.phpt b/ext/bcmath/tests/bcpow_error1.phpt new file mode 100644 index 0000000000000..d3189f062aa76 --- /dev/null +++ b/ext/bcmath/tests/bcpow_error1.phpt @@ -0,0 +1,15 @@ +--TEST-- +bcpow() does not support non-integral exponents +--SKIPIF-- + +--FILE-- + +===DONE=== +--EXPECTF-- +Warning: bcpow(): non-zero scale in exponent in %s on line %d +string(4) "1.00" +===DONE=== diff --git a/ext/bcmath/tests/bcpow_error2.phpt b/ext/bcmath/tests/bcpow_error2.phpt new file mode 100644 index 0000000000000..49fd0b88d3dbc --- /dev/null +++ b/ext/bcmath/tests/bcpow_error2.phpt @@ -0,0 +1,15 @@ +--TEST-- +bcpow() does not support exponents >= 2**63 +--SKIPIF-- + +--FILE-- + +===DONE=== +--EXPECTF-- +Warning: bcpow(): exponent too large in %s on line %d +string(4) "1.00" +===DONE=== diff --git a/ext/bcmath/tests/bcscale_variation003.phpt b/ext/bcmath/tests/bcscale_variation003.phpt new file mode 100644 index 0000000000000..b1c541644c6d8 --- /dev/null +++ b/ext/bcmath/tests/bcscale_variation003.phpt @@ -0,0 +1,18 @@ +--TEST-- +bcscale() return value +--SKIPIF-- + +--INI-- +bcmath.scale=0 +--FILE-- + +--EXPECT-- +int(0) +int(1) +int(4) +int(4) diff --git a/ext/bcmath/tests/bug.66364.phpt b/ext/bcmath/tests/bug.66364.phpt new file mode 100644 index 0000000000000..564f40e6daaa3 --- /dev/null +++ b/ext/bcmath/tests/bug.66364.phpt @@ -0,0 +1,14 @@ +--TEST-- +Bug #66364 (BCMath bcmul ignores scale parameter) +--SKIPIF-- + +--FILE-- + +===DONE=== +--EXPECT-- +string(6) "0.0600" +===DONE=== diff --git a/ext/bcmath/tests/bug72093-win32.phpt b/ext/bcmath/tests/bug72093-win32.phpt deleted file mode 100644 index a9b2077823f77..0000000000000 --- a/ext/bcmath/tests/bug72093-win32.phpt +++ /dev/null @@ -1,18 +0,0 @@ ---TEST-- -Bug 72093: bcpowmod accepts negative scale and corrupts _one_ definition ---SKIPIF-- - ---FILE-- - ---EXPECTF-- -string(1) "1" -string(3) "0.0" -bc math warning: non-zero scale in exponent diff --git a/ext/bcmath/tests/bug72093.phpt b/ext/bcmath/tests/bug72093.phpt index 911af5698fc19..3aca87a39c41f 100644 --- a/ext/bcmath/tests/bug72093.phpt +++ b/ext/bcmath/tests/bug72093.phpt @@ -3,9 +3,6 @@ Bug 72093: bcpowmod accepts negative scale and corrupts _one_ definition --SKIPIF-- --FILE-- --EXPECTF-- string(1) "1" -bc math warning: non-zero scale in exponent + +Warning: bcpowmod(): non-zero scale in exponent in %s on line %d string(3) "0.0" diff --git a/ext/bcmath/tests/bug75178-win32.phpt b/ext/bcmath/tests/bug75178-win32.phpt deleted file mode 100644 index bae590fb5b3e0..0000000000000 --- a/ext/bcmath/tests/bug75178-win32.phpt +++ /dev/null @@ -1,21 +0,0 @@ ---TEST-- -Bug #75178 (bcpowmod() misbehaves for non-integer base or modulus) ---SKIPIF-- - ---FILE-- - -===DONE=== ---EXPECT-- -string(5) "1.000" -string(5) "1.000" -===DONE=== -bc math warning: non-zero scale in base -bc math warning: non-zero scale in modulus diff --git a/ext/bcmath/tests/bug75178.phpt b/ext/bcmath/tests/bug75178.phpt index bdfa25a2e1777..e7661755ad658 100644 --- a/ext/bcmath/tests/bug75178.phpt +++ b/ext/bcmath/tests/bug75178.phpt @@ -3,9 +3,6 @@ Bug #75178 (bcpowmod() misbehaves for non-integer base or modulus) --SKIPIF-- --FILE-- ===DONE=== ---EXPECT-- -bc math warning: non-zero scale in base +--EXPECTF-- +Warning: bcpowmod(): non-zero scale in base in %s on line %d string(5) "1.000" -bc math warning: non-zero scale in modulus + +Warning: bcpowmod(): non-zero scale in modulus in %s on line %d string(5) "1.000" ===DONE=== diff --git a/ext/bcmath/tests/scale.phpt b/ext/bcmath/tests/scale.phpt new file mode 100644 index 0000000000000..d49e5305119ae --- /dev/null +++ b/ext/bcmath/tests/scale.phpt @@ -0,0 +1,27 @@ +--TEST-- +BCMath functions return result with requested scale +--SKIPIF-- + +--FILE-- + +===DONE=== +--EXPECT-- +bcadd: 3.00000 +bcdiv: 2.00000 +bcmul: 2.00000 +bcpow: 2.00000 +bcpowmod: 2.00000 +bcsqrt: 2.00000 +bcsub: 1.00000 +===DONE=== diff --git a/ext/bcmath/tests/scale_ini.phpt b/ext/bcmath/tests/scale_ini.phpt new file mode 100644 index 0000000000000..66d9d482bff07 --- /dev/null +++ b/ext/bcmath/tests/scale_ini.phpt @@ -0,0 +1,29 @@ +--TEST-- +BCMath functions return result with default scale +--SKIPIF-- + +--INI-- +bcmath.scale = 5 +--FILE-- + +===DONE=== +--EXPECT-- +bcadd: 3.00000 +bcdiv: 2.00000 +bcmul: 2.00000 +bcpow: 2.00000 +bcpowmod: 2.00000 +bcsqrt: 2.00000 +bcsub: 1.00000 +===DONE=== diff --git a/ext/bz2/package.xml b/ext/bz2/package.xml deleted file mode 100644 index b1b3688b56640..0000000000000 --- a/ext/bz2/package.xml +++ /dev/null @@ -1,37 +0,0 @@ - - - - bz2 - A Bzip2 management extension - -Bz2 is an extension to create and parse bzip2 compressed data. - - PHP License - - - sterling - Sterling Hughes - sterling@php.net - - - - 1.0 - 2003-05-17 - stable - - Initial Release in PECL - - - - - - - - CREDITS - config.m4 - php_bz2.h - bz2.c - - - diff --git a/ext/calendar/package.xml b/ext/calendar/package.xml deleted file mode 100644 index 82d0675290c5e..0000000000000 --- a/ext/calendar/package.xml +++ /dev/null @@ -1,73 +0,0 @@ - - - - calendar - Date conversion between different calendar formats - - - hholzgra - Hartmut Holzgraefe - hartmut@php.net - lead - - - shane - Shane Caraveo - developer - shane@caraveo.com - - - colin - Colin Viebrock - developer - colin@easydns.com - - - wez - Wez Furlong - developer - wez@php.net - - - -The calendar extension presents a series of functions to simplify -converting between different calendar formats. The intermediary or -standard it is based on is the Julian Day Count. The Julian Day Count -is a count of days starting from January 1st, 4713 B.C. To convert -between calendar systems, you must first convert to Julian Day Count, -then to the calendar system of your choice. Julian Day Count is very -different from the Julian Calendar! - - PHP - - beta - 5.0.0rc1 - 2004-03-19 - -package.xml added to support installation using pear installer - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/ext/com_dotnet/com_olechar.c b/ext/com_dotnet/com_olechar.c index f155f2ed4571c..31115e29c59c8 100644 --- a/ext/com_dotnet/com_olechar.c +++ b/ext/com_dotnet/com_olechar.c @@ -50,7 +50,7 @@ PHP_COM_DOTNET_API OLECHAR *php_com_string_to_olestring(char *string, size_t str This should be fixed by reallocating the olestring, but as emalloc is used, that doesn't matter much. */ ok = MultiByteToWideChar(codepage, flags, string, (int)string_len, olestring, (int)string_len); - if (ok > 0 && ok < string_len) { + if (ok > 0 && (size_t)ok < string_len) { olestring[ok] = '\0'; } } else { diff --git a/ext/com_dotnet/package.xml b/ext/com_dotnet/package.xml deleted file mode 100644 index 2839447bbddd4..0000000000000 --- a/ext/com_dotnet/package.xml +++ /dev/null @@ -1,52 +0,0 @@ - - - - com_dotnet - Com and .NET support functions for Windows - - - wez - Wez Furlong - wez@php.net - lead - - - -... - - PHP - - beta - 5.0.0rc1 - 2004-03-19 - -package.xml added to support installation using pear installer - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/ext/ctype/package.xml b/ext/ctype/package.xml deleted file mode 100644 index 62a9812be78ad..0000000000000 --- a/ext/ctype/package.xml +++ /dev/null @@ -1,45 +0,0 @@ - - - - ctype - Character type detection - - - hholzgra - Hartmut Holzgraefe - hartmut@php.net - lead - - - -The functions provided by this extension check whether a -character or string falls into a certain character class -according to the current locale. - - PHP - - beta - 5.0.0rc1 - 2004-03-19 - -package.xml added to support installation using pear installer - - - - - - - - - - - - - - - - - - diff --git a/ext/curl/interface.c b/ext/curl/interface.c index 0d1152b987cb5..fa30e45e048e0 100644 --- a/ext/curl/interface.c +++ b/ext/curl/interface.c @@ -210,7 +210,7 @@ static int php_curl_option_url(php_curl *ch, const char *url, const size_t len) return FAILURE; } - if (uri->scheme && !strncasecmp("file", uri->scheme, sizeof("file"))) { + if (uri->scheme && zend_string_equals_literal_ci(uri->scheme, "file")) { php_error_docref(NULL, E_WARNING, "Protocol 'file' disabled in cURL"); php_url_free(uri); return FAILURE; diff --git a/ext/curl/package.xml b/ext/curl/package.xml deleted file mode 100644 index f54abaf8720c2..0000000000000 --- a/ext/curl/package.xml +++ /dev/null @@ -1,52 +0,0 @@ - - - - curl - Clib PDF functions - - - sterling - Sterling Hughes - sterling@php.net - lead - - - -PHP supports libcurl, a library created by Daniel Stenberg, -that allows you to connect and communicate to many different -types of servers with many different types of protocols. -libcurl currently supports the http, https, ftp, gopher, -telnet, dict, file, and ldap protocols. libcurl also supports -HTTPS certificates, HTTP POST, HTTP PUT, FTP uploading (this -can also be done with PHP's ftp extension), HTTP form based -upload, proxies, cookies, and user+password authentication. - - PHP - - beta - 5.0rc1 - 2004-03-19 - -package.xml added to support installation using pear installer - - - - - - - - - - - - - - - - - - - - diff --git a/ext/curl/tests/curl_multi_close_basic001.phpt b/ext/curl/tests/curl_multi_close_basic001.phpt new file mode 100644 index 0000000000000..0cabf2cbadca9 --- /dev/null +++ b/ext/curl/tests/curl_multi_close_basic001.phpt @@ -0,0 +1,25 @@ +--TEST-- +curl_multi_close return false when suplied resorce not valid cURL multi handle +--SKIPIF-- + +--FILE-- + +===DONE=== +--EXPECTF-- +resource(%d) of type (curl_multi) +NULL +resource(%d) of type (Unknown) + +Warning: curl_multi_close(): supplied resource is not a valid cURL Multi Handle resource in %s on line %d +bool(false) +===DONE=== diff --git a/ext/curl/tests/curl_share_close_basic001.phpt b/ext/curl/tests/curl_share_close_basic001.phpt new file mode 100644 index 0000000000000..8addd5de4e1af --- /dev/null +++ b/ext/curl/tests/curl_share_close_basic001.phpt @@ -0,0 +1,19 @@ +--TEST-- +curl_share_close basic test +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +resource(%d) of type (curl_share) +resource(%d) of type (Unknown) \ No newline at end of file diff --git a/ext/date/php_date.c b/ext/date/php_date.c index c99dad59d4681..0df7801977497 100644 --- a/ext/date/php_date.c +++ b/ext/date/php_date.c @@ -310,6 +310,11 @@ ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO(arginfo_date_method_timestamp_get, 0) ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_date_method_create_from_immutable, 0, 0, 1) + ZEND_ARG_INFO(0, DateTimeImmutable) +ZEND_END_ARG_INFO() + ZEND_BEGIN_ARG_INFO_EX(arginfo_date_method_create_from_mutable, 0, 0, 1) ZEND_ARG_INFO(0, DateTime) ZEND_END_ARG_INFO() @@ -473,6 +478,7 @@ const zend_function_entry date_funcs_date[] = { PHP_ME(DateTime, __construct, arginfo_date_create, ZEND_ACC_CTOR|ZEND_ACC_PUBLIC) PHP_ME(DateTime, __wakeup, NULL, ZEND_ACC_PUBLIC) PHP_ME(DateTime, __set_state, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) + PHP_ME(DateTime, createFromImmutable, arginfo_date_method_create_from_immutable, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) PHP_ME_MAPPING(createFromFormat, date_create_from_format, arginfo_date_create_from_format, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) PHP_ME_MAPPING(getLastErrors, date_get_last_errors, arginfo_date_get_last_errors, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) PHP_ME_MAPPING(format, date_format, arginfo_date_method_format, 0) @@ -1751,6 +1757,10 @@ PHP_FUNCTION(gmstrftime) Return current UNIX timestamp */ PHP_FUNCTION(time) { + if (zend_parse_parameters_none() == FAILURE) { + return; + } + RETURN_LONG((zend_long)time(NULL)); } /* }}} */ @@ -2841,7 +2851,28 @@ PHP_METHOD(DateTimeImmutable, __construct) } /* }}} */ -/* {{{ proto DateTimeImmutable::createFromMutable(DateTimeZone object) +/* {{{ proto DateTime::createFromImmutable(DateTimeImmutable object) + Creates new DateTime object from an existing immutable DateTimeImmutable object. +*/ +PHP_METHOD(DateTime, createFromImmutable) +{ + zval *datetimeimmutable_object = NULL; + php_date_obj *new_obj = NULL; + php_date_obj *old_obj = NULL; + + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_OBJECT_OF_CLASS(datetimeimmutable_object, date_ce_immutable) + ZEND_PARSE_PARAMETERS_END(); + + php_date_instantiate(date_ce_date, return_value); + old_obj = Z_PHPDATE_P(datetimeimmutable_object); + new_obj = Z_PHPDATE_P(return_value); + + new_obj->time = timelib_time_clone(old_obj->time); +} +/* }}} */ + +/* {{{ proto DateTimeImmutable::createFromMutable(DateTime object) Creates new DateTimeImmutable object from an existing mutable DateTime object. */ PHP_METHOD(DateTimeImmutable, createFromMutable) @@ -2858,14 +2889,7 @@ PHP_METHOD(DateTimeImmutable, createFromMutable) old_obj = Z_PHPDATE_P(datetime_object); new_obj = Z_PHPDATE_P(return_value); - new_obj->time = timelib_time_ctor(); - *new_obj->time = *old_obj->time; - if (old_obj->time->tz_abbr) { - new_obj->time->tz_abbr = timelib_strdup(old_obj->time->tz_abbr); - } - if (old_obj->time->tz_info) { - new_obj->time->tz_info = old_obj->time->tz_info; - } + new_obj->time = timelib_time_clone(old_obj->time); } /* }}} */ @@ -4815,6 +4839,9 @@ PHP_FUNCTION(date_default_timezone_set) PHP_FUNCTION(date_default_timezone_get) { timelib_tzinfo *default_tz; + if (zend_parse_parameters_none() == FAILURE) { + return; + } default_tz = get_timezone_info(); RETVAL_STRING(default_tz->name); diff --git a/ext/date/php_date.h b/ext/date/php_date.h index 827d0b9deb5b2..6f39a333d9cf5 100644 --- a/ext/date/php_date.h +++ b/ext/date/php_date.h @@ -53,6 +53,7 @@ PHP_FUNCTION(getdate); PHP_METHOD(DateTime, __construct); PHP_METHOD(DateTime, __wakeup); PHP_METHOD(DateTime, __set_state); +PHP_METHOD(DateTime, createFromImmutable); PHP_FUNCTION(date_create); PHP_FUNCTION(date_create_immutable); PHP_FUNCTION(date_create_from_format); diff --git a/ext/date/tests/DateTime_createFromImmutable.phpt b/ext/date/tests/DateTime_createFromImmutable.phpt new file mode 100644 index 0000000000000..ee7731855a630 --- /dev/null +++ b/ext/date/tests/DateTime_createFromImmutable.phpt @@ -0,0 +1,32 @@ +--TEST-- +Tests for DateTime::createFromImmutable. +--INI-- +date.timezone=Europe/London +--FILE-- +modify('+ 1 hour'); + +var_dump( $i->format('Y-m-d H:i:s') === $current ); + +$m = DateTime::createFromImmutable( date_create( $current ) ); +var_dump( $m ); +?> +--EXPECTF-- +object(DateTime)#%d (3) { + ["date"]=> + string(26) "2014-03-02 16:24:08.000000" + ["timezone_type"]=> + int(3) + ["timezone"]=> + string(13) "Europe/London" +} +bool(true) + +Warning: DateTime::createFromImmutable() expects parameter 1 to be DateTimeImmutable, object given in %stests%eDateTime_createFromImmutable.php on line %d +NULL diff --git a/ext/date/tests/DateTime_verify.phpt b/ext/date/tests/DateTime_verify.phpt index bb3ed9909a3ac..b8626623ef726 100644 --- a/ext/date/tests/DateTime_verify.phpt +++ b/ext/date/tests/DateTime_verify.phpt @@ -27,7 +27,7 @@ object(ReflectionClass)#%d (1) { string(8) "DateTime" } ..and get names of all its methods -array(18) { +array(19) { [0]=> object(ReflectionMethod)#%d (2) { ["name"]=> @@ -52,102 +52,109 @@ array(18) { [3]=> object(ReflectionMethod)#%d (2) { ["name"]=> - string(16) "createFromFormat" + string(19) "createFromImmutable" ["class"]=> string(8) "DateTime" } [4]=> object(ReflectionMethod)#%d (2) { ["name"]=> - string(13) "getLastErrors" + string(16) "createFromFormat" ["class"]=> string(8) "DateTime" } [5]=> object(ReflectionMethod)#%d (2) { ["name"]=> - string(6) "format" + string(13) "getLastErrors" ["class"]=> string(8) "DateTime" } [6]=> object(ReflectionMethod)#%d (2) { ["name"]=> - string(6) "modify" + string(6) "format" ["class"]=> string(8) "DateTime" } [7]=> object(ReflectionMethod)#%d (2) { ["name"]=> - string(3) "add" + string(6) "modify" ["class"]=> string(8) "DateTime" } [8]=> object(ReflectionMethod)#%d (2) { ["name"]=> - string(3) "sub" + string(3) "add" ["class"]=> string(8) "DateTime" } [9]=> object(ReflectionMethod)#%d (2) { ["name"]=> - string(11) "getTimezone" + string(3) "sub" ["class"]=> string(8) "DateTime" } [10]=> object(ReflectionMethod)#%d (2) { ["name"]=> - string(11) "setTimezone" + string(11) "getTimezone" ["class"]=> string(8) "DateTime" } [11]=> object(ReflectionMethod)#%d (2) { ["name"]=> - string(9) "getOffset" + string(11) "setTimezone" ["class"]=> string(8) "DateTime" } [12]=> object(ReflectionMethod)#%d (2) { ["name"]=> - string(7) "setTime" + string(9) "getOffset" ["class"]=> string(8) "DateTime" } [13]=> object(ReflectionMethod)#%d (2) { ["name"]=> - string(7) "setDate" + string(7) "setTime" ["class"]=> string(8) "DateTime" } [14]=> object(ReflectionMethod)#%d (2) { ["name"]=> - string(10) "setISODate" + string(7) "setDate" ["class"]=> string(8) "DateTime" } [15]=> object(ReflectionMethod)#%d (2) { ["name"]=> - string(12) "setTimestamp" + string(10) "setISODate" ["class"]=> string(8) "DateTime" } [16]=> object(ReflectionMethod)#%d (2) { ["name"]=> - string(12) "getTimestamp" + string(12) "setTimestamp" ["class"]=> string(8) "DateTime" } [17]=> + object(ReflectionMethod)#%d (2) { + ["name"]=> + string(12) "getTimestamp" + ["class"]=> + string(8) "DateTime" + } + [18]=> object(ReflectionMethod)#%d (2) { ["name"]=> string(4) "diff" diff --git a/ext/date/tests/date_default_timezone_get_error.phpt b/ext/date/tests/date_default_timezone_get_error.phpt index 1d96d18cd7bf7..e45722a06c44c 100644 --- a/ext/date/tests/date_default_timezone_get_error.phpt +++ b/ext/date/tests/date_default_timezone_get_error.phpt @@ -22,6 +22,8 @@ var_dump( date_default_timezone_get($extra_arg)); *** Testing date_default_timezone_get() : error conditions *** -- Testing date_create() function with more than expected no. of arguments -- -string(3) "UTC" -===Done=== \ No newline at end of file +Warning: date_default_timezone_get() expects exactly 0 parameters, 1 given in %sdate_default_timezone_get_error.php on line %d +NULL + +===Done=== diff --git a/ext/date/tests/time_error.phpt b/ext/date/tests/time_error.phpt index 853c1babe787f..b1d136feb2e88 100644 --- a/ext/date/tests/time_error.phpt +++ b/ext/date/tests/time_error.phpt @@ -15,5 +15,7 @@ var_dump (time($extra_arg)); ===DONE=== --EXPECTF-- Too many arguments -int(%d) -===DONE=== \ No newline at end of file + +Warning: time() expects exactly 0 parameters, 1 given in %stime_error.php on line %d +NULL +===DONE=== diff --git a/ext/dom/php_dom.c b/ext/dom/php_dom.c index 77f918ae9bf9b..9892285cbb6fd 100644 --- a/ext/dom/php_dom.c +++ b/ext/dom/php_dom.c @@ -1105,8 +1105,7 @@ zend_object *dom_xpath_objects_new(zend_class_entry *class_type) { dom_xpath_object *intern = ecalloc(1, sizeof(dom_xpath_object) + zend_object_properties_size(class_type)); - ALLOC_HASHTABLE(intern->registered_phpfunctions); - zend_hash_init(intern->registered_phpfunctions, 0, NULL, ZVAL_PTR_DTOR, 0); + intern->registered_phpfunctions = zend_new_array(0); intern->dom.prop_handler = &dom_xpath_prop_handlers; intern->dom.std.handlers = &dom_xpath_object_handlers; diff --git a/ext/dom/xpath.c b/ext/dom/xpath.c index 068ca61bfef72..57d1c8796afbd 100644 --- a/ext/dom/xpath.c +++ b/ext/dom/xpath.c @@ -204,8 +204,7 @@ static void dom_xpath_ext_function_php(xmlXPathParserContextPtr ctxt, int nargs, xmlNode *nodep; dom_object *obj; if (intern->node_list == NULL) { - ALLOC_HASHTABLE(intern->node_list); - zend_hash_init(intern->node_list, 0, NULL, ZVAL_PTR_DTOR, 0); + intern->node_list = zend_new_array(0); } Z_ADDREF(retval); zend_hash_next_index_insert(intern->node_list, &retval); diff --git a/ext/enchant/package.xml b/ext/enchant/package.xml deleted file mode 100755 index 101283938261e..0000000000000 --- a/ext/enchant/package.xml +++ /dev/null @@ -1,162 +0,0 @@ - - - enchant - pecl.php.net - libenchant binder, support near all spelling tools - Enchant is a binder for libenchant. Libenchant provides a common -API for many spell libraries: -- aspell/pspell (intended to replace ispell) -- hspell (hebrew) -- ispell -- myspell/hunspell (OpenOffice project, mozilla) -- uspell (primarily Yiddish, Hebrew, and Eastern European languages) -A plugin system allows to add custom spell support. -see www.abisource.com/enchant/ - - - Pierre-Alain Joye - pajoye - paj@pearfr.org - yes - - - Ilia Alshanetsky - iliaa - ilia@php.net - yes - - 2008-04-16 - - 1.0.2 - 1.1.0 - - - stable - stable - - PHP - - #13181, Leaving a context frees the dictionnary resources -- Fix protos descriptions in the sources - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - - - 1.4.0b1 - - - - enchant - - - - - - 2006-03-21 - - 1.0.1 - 1.1.0 - - - stable - stable - - PHP - - add enchant_broker_list_dicts to get a list of available dictionaries -- fix compilation warnings -- add examples -- add tests - - - 2004-08-11 - - 1.0 - 1.0 - - - stable - stable - - PHP - - Fixed leak inside MINFO function. -- Fixed crash inside enchant_dict_suggest() when there are no suggestions. -- Added missing safe_mode/open_basedir check inside enchant_broker_request_pwl_dict(). -- Fixed various function prototypes. -- Fixed possible leak in suggestions result. - - - - - 0.2.1 - 0.2.1 - - - beta - beta - - 2004-03-11 - PHP - - Fix possible leak in suggestions result -- Move to beta status - - - - - 0.2.0 - 0.2.0 - - - alpha - alpha - - 2006-03-21 - PHP - - Add Ilia Alshanetsky as maintainer -- Cleanup sources codes (ilia) -- Add enchant_dict_quick_check (ilia) - - - - - 0.1 - 0.1 - - - alpha - alpha - - 2003-03-08 - PHP - Initial release - - - - diff --git a/ext/enchant/tests/broker_describe.phpt b/ext/enchant/tests/broker_describe.phpt index 224902f579c93..721d618df32c6 100644 --- a/ext/enchant/tests/broker_describe.phpt +++ b/ext/enchant/tests/broker_describe.phpt @@ -4,8 +4,25 @@ enchant_broker_describe() function marcosptf - --SKIPIF-- --FILE-- --SKIPIF-- --FILE-- +if (!enchant_broker_list_dicts($broker)) { + enchant_broker_free($broker); + + echo "skip: No broker dicts installed\n"; +} + +enchant_broker_free($broker); +?> --FILE-- - - - exif - Read header information from JPEG and DIFF headers - - - rasmus - Rasmus Lerdorf - helly@php.net - lead - - - helly - Markus Boerger - helly@php.net - lead - - - -The EXIF functions provide access to information stored in headers -of JPEG and TIFF images. This way you can read meta data generated -by digital cameras and certain image processing applications. - - PHP - - beta - 5.0.0rc1 - 2004-03-19 - -package.xml added to support installation using pear installer - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/ext/exif/tests/bug64739.jpg b/ext/exif/tests/bug64739.jpg new file mode 100644 index 0000000000000..65273e6127529 Binary files /dev/null and b/ext/exif/tests/bug64739.jpg differ diff --git a/ext/exif/tests/bug64739.phpt b/ext/exif/tests/bug64739.phpt new file mode 100644 index 0000000000000..8cd29ff1ac4a4 --- /dev/null +++ b/ext/exif/tests/bug64739.phpt @@ -0,0 +1,41 @@ +--TEST-- +Bug #64739 (Invalid Title and Author data returned) +--SKIPIF-- + +--FILE-- + +Done +--EXPECTF-- +Test +bool(true) +bool(true) +string(8) "55845364" +string(13) "100420.000000" +Done \ No newline at end of file diff --git a/ext/ext_skel b/ext/ext_skel deleted file mode 100755 index d1b8a2874c19e..0000000000000 --- a/ext/ext_skel +++ /dev/null @@ -1,332 +0,0 @@ -#!/bin/sh - -givup() { - echo $* - exit 1 -} - -usage() { -echo "$0 --extname=module [--proto=file] [--stubs=file] [--xml[=file]]" -echo " [--skel=dir] [--full-xml] [--no-help]" -echo "" -echo " --extname=module module is the name of your extension" -echo " --proto=file file contains prototypes of functions to create" -echo " --stubs=file generate only function stubs in file" -echo " --xml generate xml documentation to be added to phpdoc-svn" -echo " --skel=dir path to the skeleton directory" -echo " --full-xml generate xml documentation for a self-contained extension" -echo " (not yet implemented)" -echo " --no-help don't try to be nice and create comments in the code" -echo " and helper functions to test if the module compiled" -exit 1 -} - -if test $# = 0; then - usage -fi - -while test $# -gt 0; do - case "$1" in - -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;; - *) optarg= ;; - esac - - case $1 in - --extname=?*) - extname=$optarg - EXTNAME=`echo $extname | tr "[:lower:]" "[:upper:]"` - ;; - --proto=?*) - proto=$optarg - ;; - --stubs=*) - stubs=yes - stubfile=$optarg - ;; - --xml) - xml="yes" - ;; - --xml=?*) - xml=$optarg - ;; - --full-xml) - full_xml="yes" - ;; - --no-help) - no_help="yes" - ;; - --skel=?*) - skel_dir=$optarg - ;; - *) - usage - ;; - esac - shift -done - -if test -d "$extname" ; then - givup "Directory $extname already exists." -fi - -if test -z "$skel_dir"; then - skel_dir="skeleton" -fi - -## convert skel_dir to full path -skel_dir=`cd $skel_dir && pwd` - -test -d $skel_dir || givup "directory $skel_dir does not exist or is not directory" - -if echo '\c' | grep -s c >/dev/null 2>&1 -then - ECHO_N="echo -n" - ECHO_C="" -else - ECHO_N="echo" - ECHO_C='\c' -fi - -if test -z "$stubs"; then - echo "Creating directory $extname" - stubfile=$extname"/function_stubs" - mkdir $extname || givup "Cannot create directory $extname" -fi - -if test -n "$proto"; then - cat $proto | awk -v extname=$extname -v stubs=$stubs -v stubfile=$stubfile -v xml=$xml -v full_xml=$full_xml -v i_know_what_to_do_shut_up_i_dont_need_your_help_mode=$no_help -f $skel_dir/create_stubs -fi - -if test -z "$stubs"; then - cd $extname - chmod 755 . - -$ECHO_N "Creating basic files:$ECHO_C" - -$ECHO_N " config.m4$ECHO_C" -cat >config.m4 < check with-path - dnl SEARCH_PATH="/usr/local /usr" # you might want to change this - dnl SEARCH_FOR="/include/$extname.h" # you most likely want to change this - dnl if test -r \$PHP_$EXTNAME/\$SEARCH_FOR; then # path given as parameter - dnl ${EXTNAME}_DIR=\$PHP_$EXTNAME - dnl else # search default path list - dnl AC_MSG_CHECKING([for $extname files in default path]) - dnl for i in \$SEARCH_PATH ; do - dnl if test -r \$i/\$SEARCH_FOR; then - dnl ${EXTNAME}_DIR=\$i - dnl AC_MSG_RESULT(found in \$i) - dnl fi - dnl done - dnl fi - dnl - dnl if test -z "\$${EXTNAME}_DIR"; then - dnl AC_MSG_RESULT([not found]) - dnl AC_MSG_ERROR([Please reinstall the $extname distribution]) - dnl fi - - dnl # --with-$extname -> add include path - dnl PHP_ADD_INCLUDE(\$${EXTNAME}_DIR/include) - - dnl # --with-$extname -> check for lib and symbol presence - dnl LIBNAME=$extname # you may want to change this - dnl LIBSYMBOL=$extname # you most likely want to change this - - dnl PHP_CHECK_LIBRARY(\$LIBNAME,\$LIBSYMBOL, - dnl [ - dnl PHP_ADD_LIBRARY_WITH_PATH(\$LIBNAME, \$${EXTNAME}_DIR/\$PHP_LIBDIR, ${EXTNAME}_SHARED_LIBADD) - dnl AC_DEFINE(HAVE_${EXTNAME}LIB,1,[ ]) - dnl ],[ - dnl AC_MSG_ERROR([wrong $extname lib version or lib not found]) - dnl ],[ - dnl -L\$${EXTNAME}_DIR/\$PHP_LIBDIR -lm - dnl ]) - dnl - dnl PHP_SUBST(${EXTNAME}_SHARED_LIBADD) - - PHP_NEW_EXTENSION($extname, $extname.c, \$ext_shared,, -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1) -fi -eof - -$ECHO_N " config.w32$ECHO_C" -cat >config.w32 <.gitignore < sedscript -echo "s/EXTNAME/$EXTNAME/g" >> sedscript -echo '/__function_entries_here__/r function_entries' >> sedscript -echo '/__function_stubs_here__/r function_stubs' >> sedscript -echo '/__header_here__/r ../../header' >> sedscript -echo '/__footer_here__/r ../../footer' >> sedscript -echo '/__function_entries_here__/D' >> sedscript -echo '/__function_stubs_here__/D' >> sedscript -echo '/__header_here__/D' >> sedscript -echo '/__footer_here__/D' >> sedscript -if [ ! -z "$no_help" ]; then - echo "/confirm_$extname_compiled/D" >> sedscript - echo '/Remove the following/,/^\*\//D' >> sedscript - echo 's/[[:space:]]\/\*.\+\*\///' >> sedscript - echo 's/^\/\*.*\*\/$//' >> sedscript - echo '/^[[:space:]]*\/\*/,/^[[:space:]]*\*\//D' >> sedscript -fi - -sed -f sedscript < $skel_dir/skeleton.c > $extname.c - - -$ECHO_N " php_$extname.h$ECHO_C" -echo "s/extname/$extname/g" > sedscript -echo "s/EXTNAME/$EXTNAME/g" >> sedscript -echo '/__function_declarations_here__/r function_declarations' >> sedscript -echo '/__header_here__/r ../../header' >> sedscript -echo '/__footer_here__/r ../../footer' >> sedscript -echo '/__function_declarations_here__/D' >> sedscript -echo '/__header_here__/D' >> sedscript -echo '/__footer_here__/D' >> sedscript -if [ ! -z "$no_help" ]; then - echo "/confirm_$extname_compiled/D" >> sedscript - echo 's/[[:space:]]\/\*.\+\*\///' >> sedscript - echo 's/^\/\*.*\*\/$//' >> sedscript - echo '/^[[:space:]]*\/\*/,/^[[:space:]]*\*\//D' >> sedscript -fi -sed -f sedscript <$skel_dir/php_skeleton.h > php_$extname.h - -$ECHO_N " CREDITS$ECHO_C" -echo "s/extname/$extname/g" > sedscript -sed -f sedscript <$skel_dir/CREDITS > CREDITS - -$ECHO_N " EXPERIMENTAL$ECHO_C" -echo "s/extname/$extname/g" > sedscript -sed -f sedscript <$skel_dir/EXPERIMENTAL > EXPERIMENTAL - -$ECHO_N " tests/001.phpt$ECHO_C" -mkdir tests || givup "Cannot create tests directory" -chmod 755 tests -sed -f sedscript <$skel_dir/tests/001.phpt > tests/001.phpt - -if test -z "$stubs" && test -z "$no_help"; then - $ECHO_N " $extname.php$ECHO_C" - sed \ - -e "s/extname/$extname/g" \ - <$skel_dir/skeleton.php \ - > $extname.php -fi - -rm sedscript - -if test -n "$proto"; then - if test -z "$stubs"; then - rm function_entries - rm function_declarations - rm function_stubs - fi - if test -f function_warning; then - rm function_warning - warning=" -NOTE! Because some arguments to functions were resources, the code generated -cannot yet be compiled without editing. Please consider this to be step 4.5 -in the instructions above. -" - fi -fi - -find . -type f | xargs chmod 644 -find . -type d | xargs chmod 755 -fi - -echo " [done]." - -if test -z "$no_help" && test -z "$stubs"; then - cat < | + +----------------------------------------------------------------------+ +*/ + +/* $Id$ */ + +/* {{{ error + */ +function error($message) { + printf('Error: %s%s', $message, PHP_EOL); + exit; +} +/* }}} */ + +/* {{{ print_help + */ +function print_help() { + printf('php ext_skel.php --ext [--experimental] [--author ]%s', PHP_EOL); + printf(' [--dir ] [--std] [--onlyunix]%s', PHP_EOL); + printf(' [--onlywindows] [--help]%1$s%1$s', PHP_EOL); + printf(' --ext The name of the extension defined as %s', PHP_EOL); + printf(' --experimental Passed if this extension is experimental, this creates%s', PHP_EOL); + printf(' the EXPERIMENTAL file in the root of the extension%s', PHP_EOL); + printf(' --author Your name, this is used if --header is passed and%s', PHP_EOL); + printf(' for the CREDITS file%s', PHP_EOL); + printf(' --dir Path to the directory for where extension should be%s', PHP_EOL); + printf(' created. Defaults to the directory of where this script%s', PHP_EOL); + printf(' lives%s', PHP_EOL); + printf(' --std If passed, the standard header and vim rules footer used%s', PHP_EOL); + printf(' in extensions that is included in the core, will be used%s', PHP_EOL); + printf(' --onlyunix Only generate configure scripts for Unix%s', PHP_EOL); + printf(' --onlywindows Only generate configure scripts for Windows%s', PHP_EOL); + printf(' --help This help%s', PHP_EOL); + + exit; +} +/* }}} */ + +/* {{{ task + */ +function task($label, $callback) { + printf('%s... ', $label); + + $callback(); + + printf('done%s', PHP_EOL); +} +/* }}} */ + +/* {{{ print_success + */ +function print_success() { + global $options; + + if (PHP_OS_FAMILY != 'Windows') { + $file_prefix = './'; + $make_prefix = ''; + } else { + $file_prefix = ''; + $make_prefix = 'n'; + } + + printf('%1$sSuccess. The extension is now ready to be compiled into PHP. To do so, use the%s', PHP_EOL); + printf('following steps:%1$s%1$s', PHP_EOL); + printf('cd /path/to/php-src%s', PHP_EOL); + printf('%sbuildconf%s', $file_prefix, PHP_EOL); + printf('%sconfigure --enable-%s%s', $file_prefix, $options['ext'], PHP_EOL); + printf('%smake%2$s%2$s', $make_prefix, PHP_EOL); + printf('Don\'t forget to run tests once the compilation is done:%s', PHP_EOL); + printf('%smake test TESTS=ext/%s/tests%3$s%3$s', $make_prefix, $options['ext'], PHP_EOL); + printf('Thank you for using PHP!%s', PHP_EOL); +} +/* }}} */ + +/* {{{ process_args + */ +function process_args($argv, $argc) { + $options = [ + 'unix' => true, + 'windows' => true, + 'ext' => '', + 'dir' => __DIR__ . DIRECTORY_SEPARATOR, + 'skel' => __DIR__ . DIRECTORY_SEPARATOR . 'skeleton' . DIRECTORY_SEPARATOR, + 'author' => false, + 'experimental' => false, + 'std' => false + ]; + + for($i = 1; $i < $argc; ++$i) + { + $val = $argv[$i]; + + if($val{0} != '-' || $val{1} != '-') + { + continue; + } + + switch($opt = strtolower(substr($val, 2))) + { + case 'help': { + print_help(); + } + case 'onlyunix': { + $options['windows'] = false; + } + break; + case 'onlywindows': { + $options['unix'] = false; + } + break; + case 'experimental': { + $options['experimental'] = true; + } + break; + case 'std': { + $options['std'] = true; + } + break; + case 'ext': + case 'dir': + case 'author': { + if (!isset($argv[$i + 1]) || ($argv[$i + 1]{0} == '-' && $argv[$i + 1]{1} == '-')) { + error('Argument "' . $val . '" expects a value, none passed'); + } else if ($opt == 'dir' && empty($argv[$i + 1])) { + continue; + } + + $options[$opt] = ($opt == 'dir' ? realpath($argv[$i + 1]) : $argv[$i + 1]); + } + break; + default: { + error('Unsupported argument "' . $val . '" passed'); + } + } + } + + if (empty($options['ext'])) { + error('No extension name passed, use "--ext "'); + } else if (!$options['unix'] && !$options['windows']) { + error('Cannot pass both --onlyunix and --onlywindows'); + } else if (!is_dir($options['skel'])) { + error('The skeleton directory was not found'); + } + + $options['ext'] = str_replace(['\\', '/'], '', strtolower($options['ext'])); + + return $options; +} +/* }}} */ + +/* {{{ process_source_tags + */ +function process_source_tags($file, $short_name) { + global $options; + + $source = file_get_contents($file); + + if ($source === false) { + error('Unable to open file for reading: ' . $short_name); + } + + $source = str_replace('%EXTNAME%', $options['ext'], $source); + $source = str_replace('%EXTNAMECAPS%', strtoupper($options['ext']), $source); + + if (strpos($short_name, '.c') !== false || strpos($short_name, '.h') !== false) { + static $header, $footer; + + if (!$header) { + if ($options['std']) { + $year = date('Y'); + $author_len = strlen($options['author']); + $credits = $options['author'] . ($author_len && $author_len <= 60 ? str_repeat(' ', 60 - $author_len) : ''); + + $header = <<<"HEADER" +/* + +----------------------------------------------------------------------+ + | PHP Version 7 | + +----------------------------------------------------------------------+ + | Copyright (c) 1997-$year 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: $credits | + +----------------------------------------------------------------------+ +*/ +HEADER; + $footer = <<<'FOOTER' + +/* + * Local variables: + * tab-width: 4 + * c-basic-offset: 4 + * End: + */ +FOOTER; + } else { + if ($options['author']) { + $header = sprintf('/* %s extension for PHP (c) %d %s */', $options['ext'], date('Y'), $options['author']); + } else { + $header = sprintf('/* %s extension for PHP */', $options['ext']); + } + + $footer = ''; + } + } + + $source = str_replace(['%HEADER%', '%FOOTER%'], [$header, $footer], $source); + } + + if (!file_put_contents($file, $source)) { + error('Unable to save contents to file: ' . $short_name); + } +} +/* }}} */ + +/* {{{ copy_config_scripts + */ +function copy_config_scripts() { + global $options; + + $files = []; + + if ($options['unix']) { + $files[] = 'config.m4'; + } + + if ($options['windows']) { + $files[] = 'config.w32'; + } + + if (!$files) { + return; + } + + foreach($files as $config_script) { + $new_config_script = $options['dir'] . $options['ext'] . DIRECTORY_SEPARATOR . $config_script; + + if (!copy($options['skel'] . $config_script . '.in', $new_config_script)) { + error('Unable to copy config script: ' . $config_script); + } + + process_source_tags($new_config_script, $config_script); + } +} +/* }}} */ + +/* {{{ copy_sources + */ +function copy_sources() { + global $options; + + $files = [ + 'skeleton.c' => $options['ext'] . '.c', + 'php_skeleton.h' => 'php_' . $options['ext'] . '.h' + ]; + + foreach ($files as $src_file => $dst_file) { + if (!copy($options['skel'] . $src_file, $options['dir'] . $options['ext'] . DIRECTORY_SEPARATOR . $dst_file)) { + error('Unable to copy source file: ' . $src_file); + } + + process_source_tags($options['dir'] . $options['ext'] . DIRECTORY_SEPARATOR . $dst_file, $dst_file); + } +} +/* }}} */ + +/* {{{ copy_tests + */ +function copy_tests() { + global $options; + + $test_files = glob($options['skel'] . 'tests/*', GLOB_MARK); + + if (!$test_files) { + return; + } + + foreach ($test_files as $test) { + if (is_dir($test)) { + continue; + } + + $new_test = str_replace([$options['skel'], '/'], ['', DIRECTORY_SEPARATOR], $test); + + if (!copy($test, $options['dir'] . $options['ext'] . DIRECTORY_SEPARATOR . $new_test)) { + error('Unable to copy file: ' . $new_test); + } + + process_source_tags($options['dir'] . $options['ext'] . DIRECTORY_SEPARATOR . $new_test, $new_test); + } +} +/* }}} */ + + +if (PHP_SAPI != 'cli') { + error('This script is only suited for CLI'); +} + +if ($argc < 1) { + print_help(); + exit; +} + +$options = process_args($argv, $argc); + +if (!$options['dir'] || !is_dir($options['dir'])) { + error('The selected output directory does not exists'); +} else if (is_dir($options['dir'] . $options['ext'])) { + error('There is already a folder named "' . $options['ext'] . '" in the output directory'); +} else if (!mkdir($options['dir'] . $options['ext'])) { + error('Unable to create extension directory in the output directory'); +} else if (!mkdir($options['dir'] . $options['ext'] . DIRECTORY_SEPARATOR . 'tests')) { + error('Unable to create the tests directory'); +} + +if ($options['experimental']) { + print('Creating EXPERIMENTAL... '); + + if (file_put_contents($options['dir'] . $options['ext'] . DIRECTORY_SEPARATOR . 'EXPERIMENTAL', '') === false) { + error('Unable to create the EXPERIMENTAL file'); + } + + printf('done%s', PHP_EOL); +} + +if (!empty($options['author'])) { + print('Creating CREDITS... '); + + if (!file_put_contents($options['dir'] . $options['ext'] . DIRECTORY_SEPARATOR . 'CREDITS', $options['ext'] . PHP_EOL . $options['author'])) { + error('Unable to create the CREDITS file'); + } + + printf('done%s', PHP_EOL); +} + +date_default_timezone_set('UTC'); + +task('Copying config scripts', 'copy_config_scripts'); +task('Copying sources', 'copy_sources'); +task('Copying tests', 'copy_tests'); + +print_success(); + +?> \ No newline at end of file diff --git a/ext/ext_skel_win32.php b/ext/ext_skel_win32.php deleted file mode 100644 index 770c6f48bbe6a..0000000000000 --- a/ext/ext_skel_win32.php +++ /dev/null @@ -1,52 +0,0 @@ - - diff --git a/ext/fileinfo/package.xml b/ext/fileinfo/package.xml deleted file mode 100644 index a274e47161a53..0000000000000 --- a/ext/fileinfo/package.xml +++ /dev/null @@ -1,44 +0,0 @@ - - - - Fileinfo - libmagic bindings - - - iliaa - Ilia Alshanetsky - ilia@php.net - lead - - - -This extension allows retrieval of information regarding vast majority of file. -This information may include dimensions, quality, length etc... - -Additionally it can also be used to retrieve the mime type for a particular -file and for text files proper language encoding. - - PHP - - stable - 1.0.4 - 2006-11-07 - - 1) Fixed detection of magic files - 2) Fixed build problems with older version of libmagic - - - - - - - - - - - - - - diff --git a/ext/filter/logical_filters.c b/ext/filter/logical_filters.c index c203adc910e4f..e0a858aad2060 100644 --- a/ext/filter/logical_filters.c +++ b/ext/filter/logical_filters.c @@ -532,7 +532,8 @@ void php_filter_validate_url(PHP_INPUT_FILTER_PARAM_DECL) /* {{{ */ RETURN_VALIDATION_FAILED } - if (url->scheme != NULL && (!strcasecmp(url->scheme, "http") || !strcasecmp(url->scheme, "https"))) { + if (url->scheme != NULL && + (zend_string_equals_literal_ci(url->scheme, "http") || zend_string_equals_literal_ci(url->scheme, "https"))) { char *e, *s, *t; size_t l; @@ -540,9 +541,9 @@ void php_filter_validate_url(PHP_INPUT_FILTER_PARAM_DECL) /* {{{ */ goto bad_url; } - s = url->host; - l = strlen(s); - e = url->host + l; + s = ZSTR_VAL(url->host); + l = ZSTR_LEN(url->host); + e = s + l; t = e - 1; /* An IPv6 enclosed by square brackets is a valid hostname */ @@ -552,7 +553,7 @@ void php_filter_validate_url(PHP_INPUT_FILTER_PARAM_DECL) /* {{{ */ } // Validate domain - if (!_php_filter_validate_domain(url->host, l, FILTER_FLAG_HOSTNAME)) { + if (!_php_filter_validate_domain(ZSTR_VAL(url->host), l, FILTER_FLAG_HOSTNAME)) { php_url_free(url); RETURN_VALIDATION_FAILED } @@ -561,7 +562,7 @@ void php_filter_validate_url(PHP_INPUT_FILTER_PARAM_DECL) /* {{{ */ if ( url->scheme == NULL || /* some schemas allow the host to be empty */ - (url->host == NULL && (strcmp(url->scheme, "mailto") && strcmp(url->scheme, "news") && strcmp(url->scheme, "file"))) || + (url->host == NULL && (strcmp(ZSTR_VAL(url->scheme), "mailto") && strcmp(ZSTR_VAL(url->scheme), "news") && strcmp(ZSTR_VAL(url->scheme), "file"))) || ((flags & FILTER_FLAG_PATH_REQUIRED) && url->path == NULL) || ((flags & FILTER_FLAG_QUERY_REQUIRED) && url->query == NULL) ) { bad_url: diff --git a/ext/ftp/package.xml b/ext/ftp/package.xml deleted file mode 100644 index 9b70e33229dfe..0000000000000 --- a/ext/ftp/package.xml +++ /dev/null @@ -1,55 +0,0 @@ - - - - ftp - File Transfer Protocol functions - - - ??? - Andrew Skalski - askalski@chek.com - lead - - - sesser - Stefan Esser - sesser@php.net - lead - - - -The functions in this extension implement client access to file -servers speaking the File Transfer Protocol (FTP) as defined in -http://www.faqs.org/rfcs/rfc959. This extension is meant for -detailed access to an FTP server providing a wide range of -control to the executing script. If you only wish to read from -or write to a file on an FTP server, consider using the ftp:// -wrapper with the filesystem functions which provide a simpler -and more intuitive interface. - - PHP - - beta - 5.0.0rc1 - 2004-03-19 - -package.xml added to support installation using pear installer - - - - - - - - - - - - - - - - - diff --git a/ext/ftp/php_ftp.c b/ext/ftp/php_ftp.c index eb6589ebc2263..403b9602e86e5 100644 --- a/ext/ftp/php_ftp.c +++ b/ext/ftp/php_ftp.c @@ -126,7 +126,7 @@ ZEND_BEGIN_ARG_INFO(arginfo_ftp_systype, 0) ZEND_ARG_INFO(0, ftp) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_ftp_fget, 0, 0, 4) +ZEND_BEGIN_ARG_INFO_EX(arginfo_ftp_fget, 0, 0, 3) ZEND_ARG_INFO(0, ftp) ZEND_ARG_INFO(0, fp) ZEND_ARG_INFO(0, remote_file) @@ -134,7 +134,7 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_ftp_fget, 0, 0, 4) ZEND_ARG_INFO(0, resumepos) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_ftp_nb_fget, 0, 0, 4) +ZEND_BEGIN_ARG_INFO_EX(arginfo_ftp_nb_fget, 0, 0, 3) ZEND_ARG_INFO(0, ftp) ZEND_ARG_INFO(0, fp) ZEND_ARG_INFO(0, remote_file) @@ -142,12 +142,12 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_ftp_nb_fget, 0, 0, 4) ZEND_ARG_INFO(0, resumepos) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO(arginfo_ftp_pasv, 0) +ZEND_BEGIN_ARG_INFO_EX(arginfo_ftp_pasv, 0, 0, 1) ZEND_ARG_INFO(0, ftp) ZEND_ARG_INFO(0, pasv) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_ftp_get, 0, 0, 4) +ZEND_BEGIN_ARG_INFO_EX(arginfo_ftp_get, 0, 0, 3) ZEND_ARG_INFO(0, ftp) ZEND_ARG_INFO(0, local_file) ZEND_ARG_INFO(0, remote_file) @@ -155,7 +155,7 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_ftp_get, 0, 0, 4) ZEND_ARG_INFO(0, resume_pos) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_ftp_nb_get, 0, 0, 4) +ZEND_BEGIN_ARG_INFO_EX(arginfo_ftp_nb_get, 0, 0, 3) ZEND_ARG_INFO(0, ftp) ZEND_ARG_INFO(0, local_file) ZEND_ARG_INFO(0, remote_file) @@ -167,7 +167,7 @@ ZEND_BEGIN_ARG_INFO(arginfo_ftp_nb_continue, 0) ZEND_ARG_INFO(0, ftp) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_ftp_fput, 0, 0, 4) +ZEND_BEGIN_ARG_INFO_EX(arginfo_ftp_fput, 0, 0, 3) ZEND_ARG_INFO(0, ftp) ZEND_ARG_INFO(0, remote_file) ZEND_ARG_INFO(0, fp) @@ -175,7 +175,7 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_ftp_fput, 0, 0, 4) ZEND_ARG_INFO(0, startpos) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_ftp_nb_fput, 0, 0, 4) +ZEND_BEGIN_ARG_INFO_EX(arginfo_ftp_nb_fput, 0, 0, 3) ZEND_ARG_INFO(0, ftp) ZEND_ARG_INFO(0, remote_file) ZEND_ARG_INFO(0, fp) @@ -183,7 +183,7 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_ftp_nb_fput, 0, 0, 4) ZEND_ARG_INFO(0, startpos) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_ftp_put, 0, 0, 4) +ZEND_BEGIN_ARG_INFO_EX(arginfo_ftp_put, 0, 0, 3) ZEND_ARG_INFO(0, ftp) ZEND_ARG_INFO(0, remote_file) ZEND_ARG_INFO(0, local_file) @@ -191,14 +191,14 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_ftp_put, 0, 0, 4) ZEND_ARG_INFO(0, startpos) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_ftp_append, 0, 0, 4) +ZEND_BEGIN_ARG_INFO_EX(arginfo_ftp_append, 0, 0, 3) ZEND_ARG_INFO(0, ftp) ZEND_ARG_INFO(0, remote_file) ZEND_ARG_INFO(0, local_file) ZEND_ARG_INFO(0, mode) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_ftp_nb_put, 0, 0, 4) +ZEND_BEGIN_ARG_INFO_EX(arginfo_ftp_nb_put, 0, 0, 3) ZEND_ARG_INFO(0, ftp) ZEND_ARG_INFO(0, remote_file) ZEND_ARG_INFO(0, local_file) @@ -824,7 +824,7 @@ PHP_FUNCTION(ftp_systype) } /* }}} */ -/* {{{ proto bool ftp_fget(resource stream, resource fp, string remote_file, int mode[, int resumepos]) +/* {{{ proto bool ftp_fget(resource stream, resource fp, string remote_file, [, int mode [, int resumepos]]) Retrieves a file from the FTP server and writes it to an open file */ PHP_FUNCTION(ftp_fget) { @@ -834,9 +834,9 @@ PHP_FUNCTION(ftp_fget) php_stream *stream; char *file; size_t file_len; - zend_long mode, resumepos=0; + zend_long mode=FTPTYPE_IMAGE, resumepos=0; - if (zend_parse_parameters(ZEND_NUM_ARGS(), "rrsl|l", &z_ftp, &z_file, &file, &file_len, &mode, &resumepos) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS(), "rrs|ll", &z_ftp, &z_file, &file, &file_len, &mode, &resumepos) == FAILURE) { return; } @@ -870,7 +870,7 @@ PHP_FUNCTION(ftp_fget) } /* }}} */ -/* {{{ proto int ftp_nb_fget(resource stream, resource fp, string remote_file, int mode[, int resumepos]) +/* {{{ proto int ftp_nb_fget(resource stream, resource fp, string remote_file [, int mode [, int resumepos]]) Retrieves a file from the FTP server asynchronly and writes it to an open file */ PHP_FUNCTION(ftp_nb_fget) { @@ -880,9 +880,9 @@ PHP_FUNCTION(ftp_nb_fget) php_stream *stream; char *file; size_t file_len; - zend_long mode, resumepos=0, ret; + zend_long mode=FTPTYPE_IMAGE, resumepos=0, ret; - if (zend_parse_parameters(ZEND_NUM_ARGS(), "rrsl|l", &z_ftp, &z_file, &file, &file_len, &mode, &resumepos) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS(), "rrs|ll", &z_ftp, &z_file, &file, &file_len, &mode, &resumepos) == FAILURE) { return; } @@ -944,7 +944,7 @@ PHP_FUNCTION(ftp_pasv) } /* }}} */ -/* {{{ proto bool ftp_get(resource stream, string local_file, string remote_file, int mode[, int resume_pos]) +/* {{{ proto bool ftp_get(resource stream, string local_file, string remote_file [, int mode [, int resume_pos]]) Retrieves a file from the FTP server and writes it to a local file */ PHP_FUNCTION(ftp_get) { @@ -954,9 +954,9 @@ PHP_FUNCTION(ftp_get) php_stream *outstream; char *local, *remote; size_t local_len, remote_len; - zend_long mode, resumepos=0; + zend_long mode=FTPTYPE_IMAGE, resumepos=0; - if (zend_parse_parameters(ZEND_NUM_ARGS(), "rppl|l", &z_ftp, &local, &local_len, &remote, &remote_len, &mode, &resumepos) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS(), "rpp|ll", &z_ftp, &local, &local_len, &remote, &remote_len, &mode, &resumepos) == FAILURE) { return; } @@ -1009,7 +1009,7 @@ PHP_FUNCTION(ftp_get) } /* }}} */ -/* {{{ proto int ftp_nb_get(resource stream, string local_file, string remote_file, int mode[, int resume_pos]) +/* {{{ proto int ftp_nb_get(resource stream, string local_file, string remote_file, [, int mode [, int resume_pos]]) Retrieves a file from the FTP server nbhronly and writes it to a local file */ PHP_FUNCTION(ftp_nb_get) { @@ -1020,9 +1020,9 @@ PHP_FUNCTION(ftp_nb_get) char *local, *remote; size_t local_len, remote_len; int ret; - zend_long mode, resumepos=0; + zend_long mode=FTPTYPE_IMAGE, resumepos=0; - if (zend_parse_parameters(ZEND_NUM_ARGS(), "rssl|l", &z_ftp, &local, &local_len, &remote, &remote_len, &mode, &resumepos) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS(), "rss|ll", &z_ftp, &local, &local_len, &remote, &remote_len, &mode, &resumepos) == FAILURE) { return; } @@ -1122,7 +1122,7 @@ PHP_FUNCTION(ftp_nb_continue) } /* }}} */ -/* {{{ proto bool ftp_fput(resource stream, string remote_file, resource fp, int mode[, int startpos]) +/* {{{ proto bool ftp_fput(resource stream, string remote_file, resource fp [, int mode [, int startpos]]) Stores a file from an open file to the FTP server */ PHP_FUNCTION(ftp_fput) { @@ -1130,11 +1130,11 @@ PHP_FUNCTION(ftp_fput) ftpbuf_t *ftp; ftptype_t xtype; size_t remote_len; - zend_long mode, startpos=0; + zend_long mode=FTPTYPE_IMAGE, startpos=0; php_stream *stream; char *remote; - if (zend_parse_parameters(ZEND_NUM_ARGS(), "rsrl|l", &z_ftp, &remote, &remote_len, &z_file, &mode, &startpos) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS(), "rsr|ll", &z_ftp, &remote, &remote_len, &z_file, &mode, &startpos) == FAILURE) { return; } @@ -1171,7 +1171,7 @@ PHP_FUNCTION(ftp_fput) } /* }}} */ -/* {{{ proto int ftp_nb_fput(resource stream, string remote_file, resource fp, int mode[, int startpos]) +/* {{{ proto int ftp_nb_fput(resource stream, string remote_file, resource fp [, int mode [, int startpos]]) Stores a file from an open file to the FTP server nbronly */ PHP_FUNCTION(ftp_nb_fput) { @@ -1180,11 +1180,11 @@ PHP_FUNCTION(ftp_nb_fput) ftptype_t xtype; size_t remote_len; int ret; - zend_long mode, startpos=0; + zend_long mode=FTPTYPE_IMAGE, startpos=0; php_stream *stream; char *remote; - if (zend_parse_parameters(ZEND_NUM_ARGS(), "rsrl|l", &z_ftp, &remote, &remote_len, &z_file, &mode, &startpos) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS(), "rsr|ll", &z_ftp, &remote, &remote_len, &z_file, &mode, &startpos) == FAILURE) { return; } @@ -1226,7 +1226,7 @@ PHP_FUNCTION(ftp_nb_fput) /* }}} */ -/* {{{ proto bool ftp_put(resource stream, string remote_file, string local_file, int mode[, int startpos]) +/* {{{ proto bool ftp_put(resource stream, string remote_file, string local_file [, int mode [, int startpos]]) Stores a file on the FTP server */ PHP_FUNCTION(ftp_put) { @@ -1235,10 +1235,10 @@ PHP_FUNCTION(ftp_put) ftptype_t xtype; char *remote, *local; size_t remote_len, local_len; - zend_long mode, startpos=0; + zend_long mode=FTPTYPE_IMAGE, startpos=0; php_stream *instream; - if (zend_parse_parameters(ZEND_NUM_ARGS(), "rppl|l", &z_ftp, &remote, &remote_len, &local, &local_len, &mode, &startpos) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS(), "rpp|ll", &z_ftp, &remote, &remote_len, &local, &local_len, &mode, &startpos) == FAILURE) { return; } @@ -1280,7 +1280,7 @@ PHP_FUNCTION(ftp_put) } /* }}} */ -/* {{{ proto bool ftp_append(resource stream, string remote_file, string local_file, int mode) +/* {{{ proto bool ftp_append(resource stream, string remote_file, string local_file [, int mode]) Append content of a file a another file on the FTP server */ PHP_FUNCTION(ftp_append) { @@ -1289,10 +1289,10 @@ PHP_FUNCTION(ftp_append) ftptype_t xtype; char *remote, *local; size_t remote_len, local_len; - zend_long mode; + zend_long mode=FTPTYPE_IMAGE; php_stream *instream; - if (zend_parse_parameters(ZEND_NUM_ARGS(), "rppl", &z_ftp, &remote, &remote_len, &local, &local_len, &mode) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS(), "rpp|l", &z_ftp, &remote, &remote_len, &local, &local_len, &mode) == FAILURE) { return; } @@ -1316,7 +1316,7 @@ PHP_FUNCTION(ftp_append) } /* }}} */ -/* {{{ proto int ftp_nb_put(resource stream, string remote_file, string local_file, int mode[, int startpos]) +/* {{{ proto int ftp_nb_put(resource stream, string remote_file, string local_file [, int mode [, int startpos]]) Stores a file on the FTP server */ PHP_FUNCTION(ftp_nb_put) { @@ -1325,10 +1325,10 @@ PHP_FUNCTION(ftp_nb_put) ftptype_t xtype; char *remote, *local; size_t remote_len, local_len; - zend_long mode, startpos=0, ret; + zend_long mode=FTPTYPE_IMAGE, startpos=0, ret; php_stream *instream; - if (zend_parse_parameters(ZEND_NUM_ARGS(), "rppl|l", &z_ftp, &remote, &remote_len, &local, &local_len, &mode, &startpos) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS(), "rpp|ll", &z_ftp, &remote, &remote_len, &local, &local_len, &mode, &startpos) == FAILURE) { return; } diff --git a/ext/ftp/tests/004.phpt b/ext/ftp/tests/004.phpt index dcb6302eca516..21b8aabbeb889 100644 --- a/ext/ftp/tests/004.phpt +++ b/ext/ftp/tests/004.phpt @@ -20,7 +20,6 @@ var_dump(ftp_alloc($ftp, array())); var_dump(ftp_cdup($ftp, 0)); var_dump(ftp_chdir($ftp, array())); var_dump(ftp_chmod($ftp, 0666)); -var_dump(ftp_get($ftp, 1234,12)); var_dump(ftp_close()); var_dump(ftp_connect('sfjkfjaksfjkasjf')); var_dump(ftp_delete($ftp, array())); @@ -50,30 +49,27 @@ NULL Warning: ftp_chmod() expects exactly 3 parameters, 2 given in %s on line %d bool(false) -Warning: ftp_get() expects at least 4 parameters, 3 given in %s on line %d +Warning: ftp_close() expects exactly 1 parameter, 0 given in %s004.php on line 16 NULL -Warning: ftp_close() expects exactly 1 parameter, 0 given in %s004.php on line 17 -NULL - -Warning: ftp_connect(): php_network_getaddresses: getaddrinfo failed: %s in %s004.php on line 18 +Warning: ftp_connect(): php_network_getaddresses: getaddrinfo failed: %s in %s004.php on line 17 bool(false) -Warning: ftp_delete() expects parameter 2 to be string, array given in %s004.php on line 19 +Warning: ftp_delete() expects parameter 2 to be string, array given in %s004.php on line 18 NULL -Warning: ftp_exec() expects parameter 2 to be string, array given in %s004.php on line 20 +Warning: ftp_exec() expects parameter 2 to be string, array given in %s004.php on line 19 NULL -Warning: ftp_systype() expects exactly 1 parameter, 2 given in %s004.php on line 22 +Warning: ftp_systype() expects exactly 1 parameter, 2 given in %s004.php on line 21 NULL -Warning: ftp_pwd() expects exactly 1 parameter, 2 given in %s004.php on line 23 +Warning: ftp_pwd() expects exactly 1 parameter, 2 given in %s004.php on line 22 NULL -Warning: ftp_login() expects exactly 3 parameters, 1 given in %s004.php on line 25 +Warning: ftp_login() expects exactly 3 parameters, 1 given in %s004.php on line 24 NULL -Warning: ftp_login(): Not logged in. in %s004.php on line 26 +Warning: ftp_login(): Not logged in. in %s004.php on line 25 bool(false) bool(true) diff --git a/ext/ftp/tests/006.phpt b/ext/ftp/tests/006.phpt index 899ecbbec3b7e..6b76a7e0aeb68 100644 --- a/ext/ftp/tests/006.phpt +++ b/ext/ftp/tests/006.phpt @@ -31,6 +31,7 @@ var_dump(ftp_site($ftp)); var_dump(ftp_set_option($ftp)); var_dump(ftp_get_option($ftp)); var_dump(ftp_mlsd($ftp)); +var_dump(ftp_append($ftp)); ?> --EXPECTF-- @@ -55,13 +56,13 @@ NULL Warning: ftp_rawlist() expects at least 2 parameters, 1 given in %s006.php on line 10 NULL -Warning: ftp_fget() expects at least 4 parameters, 1 given in %s006.php on line 11 +Warning: ftp_fget() expects at least 3 parameters, 1 given in %s006.php on line 11 NULL -Warning: ftp_nb_fget() expects at least 4 parameters, 1 given in %s006.php on line 12 +Warning: ftp_nb_fget() expects at least 3 parameters, 1 given in %s006.php on line 12 NULL -Warning: ftp_nb_get() expects at least 4 parameters, 1 given in %s006.php on line 13 +Warning: ftp_nb_get() expects at least 3 parameters, 1 given in %s006.php on line 13 NULL Warning: ftp_pasv() expects exactly 2 parameters, 1 given in %s006.php on line 14 @@ -70,16 +71,16 @@ NULL Warning: ftp_nb_continue() expects exactly 1 parameter, 0 given in %s006.php on line 15 NULL -Warning: ftp_fput() expects at least 4 parameters, 0 given in %s006.php on line 16 +Warning: ftp_fput() expects at least 3 parameters, 0 given in %s006.php on line 16 NULL -Warning: ftp_nb_fput() expects at least 4 parameters, 1 given in %s006.php on line 17 +Warning: ftp_nb_fput() expects at least 3 parameters, 1 given in %s006.php on line 17 NULL -Warning: ftp_put() expects at least 4 parameters, 1 given in %s006.php on line 18 +Warning: ftp_put() expects at least 3 parameters, 1 given in %s006.php on line 18 NULL -Warning: ftp_nb_put() expects at least 4 parameters, 1 given in %s006.php on line 19 +Warning: ftp_nb_put() expects at least 3 parameters, 1 given in %s006.php on line 19 NULL Warning: ftp_size() expects exactly 2 parameters, 1 given in %s006.php on line 20 @@ -102,3 +103,6 @@ NULL Warning: ftp_mlsd() expects exactly 2 parameters, 1 given in %s006.php on line 26 NULL + +Warning: ftp_append() expects at least 3 parameters, 1 given in %s006.php on line 27 +NULL \ No newline at end of file diff --git a/ext/ftp/tests/007.phpt b/ext/ftp/tests/007.phpt new file mode 100644 index 0000000000000..6a6f0da940202 --- /dev/null +++ b/ext/ftp/tests/007.phpt @@ -0,0 +1,148 @@ +--TEST-- +FTP with bogus resource +--CREDITS-- +Michael Paul da Rosa +PHP TestFest Dublin 2017 +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +Warning: ftp_login(): supplied resource is not a valid FTP Buffer resource in %s007.php on line %d +bool(false) + +Warning: ftp_pwd(): supplied resource is not a valid FTP Buffer resource in %s007.php on line %d +bool(false) + +Warning: ftp_cdup(): supplied resource is not a valid FTP Buffer resource in %s007.php on line %d +bool(false) + +Warning: ftp_chdir(): supplied resource is not a valid FTP Buffer resource in %s007.php on line %d +bool(false) + +Warning: ftp_exec(): supplied resource is not a valid FTP Buffer resource in %s007.php on line %d +bool(false) + +Warning: ftp_raw(): supplied resource is not a valid FTP Buffer resource in %s007.php on line %d +bool(false) + +Warning: ftp_mkdir(): supplied resource is not a valid FTP Buffer resource in %s007.php on line %d +bool(false) + +Warning: ftp_rmdir(): supplied resource is not a valid FTP Buffer resource in %s007.php on line %d +bool(false) + +Warning: ftp_chmod(): supplied resource is not a valid FTP Buffer resource in %s007.php on line %d +bool(false) + +Warning: ftp_alloc(): supplied resource is not a valid FTP Buffer resource in %s007.php on line %d +bool(false) + +Warning: ftp_nlist(): supplied resource is not a valid FTP Buffer resource in %s007.php on line %d +bool(false) + +Warning: ftp_rawlist(): supplied resource is not a valid FTP Buffer resource in %s007.php on line %d +bool(false) + +Warning: ftp_mlsd(): supplied resource is not a valid FTP Buffer resource in %s007.php on line %d +bool(false) + +Warning: ftp_systype(): supplied resource is not a valid FTP Buffer resource in %s007.php on line %d +bool(false) + +Warning: ftp_fget(): supplied resource is not a valid FTP Buffer resource in %s007.php on line %d +bool(false) + +Warning: ftp_nb_fget(): supplied resource is not a valid FTP Buffer resource in %s007.php on line %d +bool(false) + +Warning: ftp_pasv(): supplied resource is not a valid FTP Buffer resource in %s007.php on line %d +bool(false) + +Warning: ftp_get(): supplied resource is not a valid FTP Buffer resource in %s007.php on line %d +bool(false) + +Warning: ftp_nb_get(): supplied resource is not a valid FTP Buffer resource in %s007.php on line %d +bool(false) + +Warning: ftp_nb_continue(): supplied resource is not a valid FTP Buffer resource in %s007.php on line %d +bool(false) + +Warning: ftp_fput(): supplied resource is not a valid FTP Buffer resource in %s007.php on line %d +bool(false) + +Warning: ftp_nb_fput(): supplied resource is not a valid FTP Buffer resource in %s007.php on line %d +bool(false) + +Warning: ftp_put(): supplied resource is not a valid FTP Buffer resource in %s007.php on line %d +bool(false) + +Warning: ftp_append(): supplied resource is not a valid FTP Buffer resource in %s007.php on line %d +bool(false) + +Warning: ftp_nb_put(): supplied resource is not a valid FTP Buffer resource in %s007.php on line %d +bool(false) + +Warning: ftp_size(): supplied resource is not a valid FTP Buffer resource in %s007.php on line %d +bool(false) + +Warning: ftp_mdtm(): supplied resource is not a valid FTP Buffer resource in %s007.php on line %d +bool(false) + +Warning: ftp_rename(): supplied resource is not a valid FTP Buffer resource in %s007.php on line %d +bool(false) + +Warning: ftp_delete(): supplied resource is not a valid FTP Buffer resource in %s007.php on line %d +bool(false) + +Warning: ftp_site(): supplied resource is not a valid FTP Buffer resource in %s007.php on line %d +bool(false) + +Warning: ftp_close(): supplied resource is not a valid FTP Buffer resource in %s007.php on line %d +bool(false) + +Warning: ftp_set_option(): supplied resource is not a valid FTP Buffer resource in %s007.php on line %d +bool(false) + +Warning: ftp_get_option(): supplied resource is not a valid FTP Buffer resource in %s007.php on line %d +bool(false) \ No newline at end of file diff --git a/ext/ftp/tests/ftp_append.phpt b/ext/ftp/tests/ftp_append.phpt index 5f52ac923c0e5..ff695c4d5bd00 100644 --- a/ext/ftp/tests/ftp_append.phpt +++ b/ext/ftp/tests/ftp_append.phpt @@ -13,18 +13,28 @@ if (!$ftp) die("Couldn't connect to the server"); var_dump(ftp_login($ftp, 'user', 'pass')); -@unlink(__DIR__.'/ftp_append_foobar'); +$fooPath = __DIR__ . '/ftp_append_foo'; +file_put_contents($fooPath, 'foo'); +var_dump(ftp_append($ftp, 'ftp_append_foobar', $fooPath, FTP_BINARY)); -file_put_contents(__DIR__.'/ftp_append_foo', 'foo'); -var_dump(ftp_append($ftp, 'ftp_append_foobar', __DIR__.'/ftp_append_foo', FTP_BINARY)); +$barPath = __DIR__ . '/ftp_append_bar'; +file_put_contents($barPath, 'bar'); +var_dump(ftp_append($ftp, 'ftp_append_foobar', $barPath, FTP_BINARY)); -file_put_contents(__DIR__.'/ftp_append_bar', 'bar'); -var_dump(ftp_append($ftp, 'ftp_append_foobar', __DIR__.'/ftp_append_bar', FTP_BINARY)); - -var_dump(file_get_contents(__DIR__.'/ftp_append_foobar')); +$fooBarPath = __DIR__ . '/ftp_append_foobar'; +var_dump(file_get_contents($fooBarPath)); ftp_close($ftp); ?> +--CLEAN-- + --EXPECTF-- bool(true) bool(true) diff --git a/ext/gd/gd.c b/ext/gd/gd.c index 3e7d778ba3435..a530f82424286 100644 --- a/ext/gd/gd.c +++ b/ext/gd/gd.c @@ -133,7 +133,7 @@ static void php_image_filter_pixelate(INTERNAL_FUNCTION_PARAMETERS); static gdImagePtr _php_image_create_from_string (zval *Data, char *tn, gdImagePtr (*ioctx_func_p)()); static void _php_image_create_from(INTERNAL_FUNCTION_PARAMETERS, int image_type, char *tn, gdImagePtr (*func_p)(), gdImagePtr (*ioctx_func_p)()); static void _php_image_output(INTERNAL_FUNCTION_PARAMETERS, int image_type, char *tn, void (*func_p)()); -static int _php_image_type(char data[8]); +static int _php_image_type(char data[12]); static void _php_image_convert(INTERNAL_FUNCTION_PARAMETERS, int image_type); static void _php_image_bw_convert(gdImagePtr im_org, gdIOCtx *out, int threshold); @@ -1101,14 +1101,14 @@ PHP_MINIT_FUNCTION(gd) REGISTER_INI_ENTRIES(); - REGISTER_LONG_CONSTANT("IMG_GIF", 1, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IMG_JPG", 2, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IMG_JPEG", 2, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IMG_PNG", 4, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IMG_WBMP", 8, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IMG_XPM", 16, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IMG_WEBP", 32, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IMG_BMP", 64, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IMG_GIF", PHP_IMG_GIF, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IMG_JPG", PHP_IMG_JPG, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IMG_JPEG", PHP_IMG_JPEG, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IMG_PNG", PHP_IMG_PNG, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IMG_WBMP", PHP_IMG_WBMP, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IMG_XPM", PHP_IMG_XPM, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IMG_WEBP", PHP_IMG_WEBP, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IMG_BMP", PHP_IMG_BMP, CONST_CS | CONST_PERSISTENT); /* special colours for gd */ REGISTER_LONG_CONSTANT("IMG_COLOR_TILED", gdTiled, CONST_CS | CONST_PERSISTENT); @@ -1323,7 +1323,7 @@ PHP_MINFO_FUNCTION(gd) PHP_FUNCTION(gd_info) { if (zend_parse_parameters_none() == FAILURE) { - RETURN_FALSE; + return; } array_init(return_value); @@ -2174,23 +2174,23 @@ PHP_FUNCTION(imagecreate) Return the types of images supported in a bitfield - 1=GIF, 2=JPEG, 4=PNG, 8=WBMP, 16=XPM */ PHP_FUNCTION(imagetypes) { - int ret=0; - ret = 1; + int ret = 0; + ret = PHP_IMG_GIF; #ifdef HAVE_GD_JPG - ret |= 2; + ret |= PHP_IMG_JPG; #endif #ifdef HAVE_GD_PNG - ret |= 4; + ret |= PHP_IMG_PNG; #endif - ret |= 8; + ret |= PHP_IMG_WBMP; #if defined(HAVE_GD_XPM) - ret |= 16; + ret |= PHP_IMG_XPM; #endif #ifdef HAVE_GD_WEBP - ret |= 32; + ret |= PHP_IMG_WEBP; #endif #ifdef HAVE_GD_BMP - ret |= 64; + ret |= PHP_IMG_BMP; #endif if (zend_parse_parameters_none() == FAILURE) { @@ -2224,7 +2224,7 @@ static int _php_ctx_getmbi(gdIOCtx *ctx) */ static const char php_sig_gd2[3] = {'g', 'd', '2'}; -static int _php_image_type (char data[8]) +static int _php_image_type (char data[12]) { /* Based on ext/standard/image.c */ @@ -2232,18 +2232,18 @@ static int _php_image_type (char data[8]) return -1; } - if (!memcmp(data, php_sig_gd2, 3)) { + if (!memcmp(data, php_sig_gd2, sizeof(php_sig_gd2))) { return PHP_GDIMG_TYPE_GD2; - } else if (!memcmp(data, php_sig_jpg, 3)) { + } else if (!memcmp(data, php_sig_jpg, sizeof(php_sig_jpg))) { 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)) { + } else if (!memcmp(data, php_sig_png, sizeof(php_sig_png))) { + return PHP_GDIMG_TYPE_PNG; + } else if (!memcmp(data, php_sig_gif, sizeof(php_sig_gif))) { return PHP_GDIMG_TYPE_GIF; } else if (!memcmp(data, php_sig_bmp, sizeof(php_sig_bmp))) { return PHP_GDIMG_TYPE_BMP; + } else if(!memcmp(data, php_sig_riff, sizeof(php_sig_riff)) && !memcmp(data + sizeof(php_sig_riff) + sizeof(uint32_t), php_sig_webp, sizeof(php_sig_webp))) { + return PHP_GDIMG_TYPE_WEBP; } else { gdIOCtx *io_ctx; @@ -2294,19 +2294,19 @@ PHP_FUNCTION(imagecreatefromstring) zval *data; gdImagePtr im; int imtype; - char sig[8]; + char sig[12]; if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &data) == FAILURE) { return; } convert_to_string_ex(data); - if (Z_STRLEN_P(data) < 8) { + if (Z_STRLEN_P(data) < sizeof(sig)) { php_error_docref(NULL, E_WARNING, "Empty string or invalid image"); RETURN_FALSE; } - memcpy(sig, Z_STRVAL_P(data), 8); + memcpy(sig, Z_STRVAL_P(data), sizeof(sig)); imtype = _php_image_type(sig); @@ -2345,6 +2345,15 @@ PHP_FUNCTION(imagecreatefromstring) im = _php_image_create_from_string(data, "BMP", gdImageCreateFromBmpCtx); break; + case PHP_GDIMG_TYPE_WEBP: +#ifdef HAVE_GD_WEBP + im = _php_image_create_from_string(data, "WEBP", gdImageCreateFromWebpCtx); + break; +#else + php_error_docref(NULL, E_WARNING, "No WEBP support in this PHP build"); + RETURN_FALSE; +#endif + default: php_error_docref(NULL, E_WARNING, "Data is not in a recognized format"); RETURN_FALSE; @@ -3027,7 +3036,7 @@ PHP_FUNCTION(imagecolorexact) } /* }}} */ -/* {{{ proto void imagecolorset(resource im, int col, int red, int green, int blue) +/* {{{ proto bool imagecolorset(resource im, int col, int red, int green, int blue) Set the color for the specified palette index */ PHP_FUNCTION(imagecolorset) { @@ -4387,10 +4396,6 @@ static void php_image_filter_brightness(INTERNAL_FUNCTION_PARAMETERS) RETURN_FALSE; } - if (im_src == NULL) { - RETURN_FALSE; - } - if (gdImageBrightness(im_src, (int)brightness) == 1) { RETURN_TRUE; } @@ -4412,10 +4417,6 @@ static void php_image_filter_contrast(INTERNAL_FUNCTION_PARAMETERS) RETURN_FALSE; } - if (im_src == NULL) { - RETURN_FALSE; - } - if (gdImageContrast(im_src, (int)contrast) == 1) { RETURN_TRUE; } @@ -4438,10 +4439,6 @@ static void php_image_filter_colorize(INTERNAL_FUNCTION_PARAMETERS) RETURN_FALSE; } - if (im_src == NULL) { - RETURN_FALSE; - } - if (gdImageColor(im_src, (int) r, (int) g, (int) b, (int) a) == 1) { RETURN_TRUE; } @@ -4519,10 +4516,6 @@ static void php_image_filter_smooth(INTERNAL_FUNCTION_PARAMETERS) RETURN_FALSE; } - if (im_src == NULL) { - RETURN_FALSE; - } - if (gdImageSmooth(im_src, (float)weight)==1) { RETURN_TRUE; } @@ -4545,10 +4538,6 @@ static void php_image_filter_pixelate(INTERNAL_FUNCTION_PARAMETERS) RETURN_FALSE; } - if (im == NULL) { - RETURN_FALSE; - } - if (gdImagePixelate(im, (int) blocksize, (const unsigned int) mode)) { RETURN_TRUE; } @@ -4645,7 +4634,7 @@ PHP_FUNCTION(imageconvolution) /* }}} */ /* End section: Filters */ -/* {{{ proto void imageflip(resource im, int mode) +/* {{{ proto bool imageflip(resource im, int mode) Flip an image (in place) horizontally, vertically or both directions. */ PHP_FUNCTION(imageflip) { @@ -4703,7 +4692,7 @@ PHP_FUNCTION(imageantialias) } /* }}} */ -/* {{{ proto void imagecrop(resource im, array rect) +/* {{{ proto resource imagecrop(resource im, array rect) Crop an image using the given coordinates and size, x, y, width and height. */ PHP_FUNCTION(imagecrop) { @@ -4760,7 +4749,7 @@ PHP_FUNCTION(imagecrop) } /* }}} */ -/* {{{ proto void imagecropauto(resource im [, int mode [, float threshold [, int color]]]) +/* {{{ proto resource imagecropauto(resource im [, int mode [, float threshold [, int color]]]) Crop an image automatically using one of the available modes. */ PHP_FUNCTION(imagecropauto) { diff --git a/ext/gd/php_gd.h b/ext/gd/php_gd.h index a99f2e846c941..253b27d920c90 100644 --- a/ext/gd/php_gd.h +++ b/ext/gd/php_gd.h @@ -50,6 +50,15 @@ #define PHP_GDIMG_TYPE_WEBP 11 #define PHP_GDIMG_TYPE_BMP 12 +#define PHP_IMG_GIF 1 +#define PHP_IMG_JPG 2 +#define PHP_IMG_JPEG 2 +#define PHP_IMG_PNG 4 +#define PHP_IMG_WBMP 8 +#define PHP_IMG_XPM 16 +#define PHP_IMG_WEBP 32 +#define PHP_IMG_BMP 64 + #ifdef PHP_WIN32 # define PHP_GD_API __declspec(dllexport) #elif defined(__GNUC__) && __GNUC__ >= 4 @@ -62,6 +71,8 @@ PHPAPI extern const char php_sig_gif[3]; PHPAPI extern const char php_sig_jpg[3]; PHPAPI extern const char php_sig_png[8]; PHPAPI extern const char php_sig_bmp[2]; +PHPAPI extern const char php_sig_riff[4]; +PHPAPI extern const char php_sig_webp[4]; extern zend_module_entry gd_module_entry; #define phpext_gd_ptr &gd_module_entry diff --git a/ext/gd/tests/createfromstring.phpt b/ext/gd/tests/createfromstring.phpt index a3c2e977b6d17..7828725db51fd 100644 --- a/ext/gd/tests/createfromstring.phpt +++ b/ext/gd/tests/createfromstring.phpt @@ -52,8 +52,8 @@ unlink($dir . '/p.png'); //empty string $im = imagecreatefromstring(''); -//random string > 8 -$im = imagecreatefromstring(' asdf jklp'); +//random string > 12 +$im = imagecreatefromstring(' asdf jklp foo'); ?> --EXPECTF-- createfromstring truecolor png: ok diff --git a/ext/gd/tests/gd_info_error.phpt b/ext/gd/tests/gd_info_error.phpt index 15a26e4a49614..edc18fac0fde1 100644 --- a/ext/gd/tests/gd_info_error.phpt +++ b/ext/gd/tests/gd_info_error.phpt @@ -31,8 +31,8 @@ var_dump(gd_info($extra_arg_string, $extra_arg_number)); -- Testing gd_info() function with more than expected number of arguments -- Warning: gd_info() expects exactly 0 parameters, 1 given in %s on line %d -bool(false) +NULL Warning: gd_info() expects exactly 0 parameters, 2 given in %s on line %d -bool(false) -===DONE=== \ No newline at end of file +NULL +===DONE=== diff --git a/ext/gd/tests/imagecreatefromstring.bmp b/ext/gd/tests/imagecreatefromstring.bmp new file mode 100644 index 0000000000000..22b5c66f9d7f8 Binary files /dev/null and b/ext/gd/tests/imagecreatefromstring.bmp differ diff --git a/ext/gd/tests/imagecreatefromstring.gif b/ext/gd/tests/imagecreatefromstring.gif new file mode 100644 index 0000000000000..a17060ad6105e Binary files /dev/null and b/ext/gd/tests/imagecreatefromstring.gif differ diff --git a/ext/gd/tests/imagecreatefromstring.webp b/ext/gd/tests/imagecreatefromstring.webp new file mode 100644 index 0000000000000..e3c3c175ba965 Binary files /dev/null and b/ext/gd/tests/imagecreatefromstring.webp differ diff --git a/ext/gd/tests/imagecreatefromstring_gif.phpt b/ext/gd/tests/imagecreatefromstring_gif.phpt new file mode 100644 index 0000000000000..c913f4ed13966 --- /dev/null +++ b/ext/gd/tests/imagecreatefromstring_gif.phpt @@ -0,0 +1,20 @@ +--TEST-- +imagecreatefromstring() - GIF format +--SKIPIF-- + +--FILE-- + +===DONE=== +--EXPECT-- +int(10) +int(10) +===DONE=== diff --git a/ext/gd/tests/imagecreatefromstring_png.phpt b/ext/gd/tests/imagecreatefromstring_png.phpt new file mode 100644 index 0000000000000..efb8cc3622c8f --- /dev/null +++ b/ext/gd/tests/imagecreatefromstring_png.phpt @@ -0,0 +1,20 @@ +--TEST-- +imagecreatefromstring() - PNG format +--SKIPIF-- + +--FILE-- + +===DONE=== +--EXPECT-- +int(10) +int(10) +===DONE=== diff --git a/ext/gd/tests/imagecreatefromstring_webp.phpt b/ext/gd/tests/imagecreatefromstring_webp.phpt new file mode 100644 index 0000000000000..fbae919ab48cd --- /dev/null +++ b/ext/gd/tests/imagecreatefromstring_webp.phpt @@ -0,0 +1,20 @@ +--TEST-- +imagecreatefromstring() - WEBP format +--SKIPIF-- + +--FILE-- + +===DONE=== +--EXPECT-- +int(10) +int(10) +===DONE=== diff --git a/ext/gmp/bug67917.phpt b/ext/gmp/tests/bug67917.phpt similarity index 100% rename from ext/gmp/bug67917.phpt rename to ext/gmp/tests/bug67917.phpt diff --git a/ext/hash/hash_gost.c b/ext/hash/hash_gost.c index e00a55ed96599..2561e6187cf97 100644 --- a/ext/hash/hash_gost.c +++ b/ext/hash/hash_gost.c @@ -265,7 +265,7 @@ PHP_HASH_API void PHP_GOSTUpdate(PHP_GOST_CTX *context, const unsigned char *inp if (context->length + len < 32) { memcpy(&context->buffer[context->length], input, len); - context->length += len; + context->length += (unsigned char)len; } else { size_t i = 0, r = (context->length + len) % 32; @@ -281,7 +281,7 @@ PHP_HASH_API void PHP_GOSTUpdate(PHP_GOST_CTX *context, const unsigned char *inp memcpy(context->buffer, input + i, r); ZEND_SECURE_ZERO(&context->buffer[r], 32 - r); - context->length = r; + context->length = (unsigned char)r; } } diff --git a/ext/hash/hash_snefru.c b/ext/hash/hash_snefru.c index 5de2a283ffab5..1b44d37aea28e 100644 --- a/ext/hash/hash_snefru.c +++ b/ext/hash/hash_snefru.c @@ -151,7 +151,7 @@ PHP_HASH_API void PHP_SNEFRUUpdate(PHP_SNEFRU_CTX *context, const unsigned char if (context->length + len < 32) { memcpy(&context->buffer[context->length], input, len); - context->length += len; + context->length += (unsigned char)len; } else { size_t i = 0, r = (context->length + len) % 32; @@ -167,7 +167,7 @@ PHP_HASH_API void PHP_SNEFRUUpdate(PHP_SNEFRU_CTX *context, const unsigned char memcpy(context->buffer, input + i, r); ZEND_SECURE_ZERO(&context->buffer[r], 32 - r); - context->length = r; + context->length = (unsigned char)r; } } diff --git a/ext/hash/package.xml b/ext/hash/package.xml deleted file mode 100644 index 25a598a4a1522..0000000000000 --- a/ext/hash/package.xml +++ /dev/null @@ -1,94 +0,0 @@ - - hash - pHASH Message Digest Framework - - Native implementations of common message digest algorithms using a generic factory method - - PHP - - - pollita - Sara Golemon - pollita@php.net - lead - - - mike - Michael Wallner - mike@php.net - lead - - - - - 1.1 - stable - 2005-12-00 - -Fixed PECL bug #6183 - haval source file entries missing in package.xml - -Supported Algorithms: - * md4, md5 - * sha1, sha256, sha384, sha512 - * ripemd128, ripemd160 - * tiger128, tiger160, tiger192 (3 and 4 passes) - * haval128, haval160, haval192, haval224, haval256 (3, 4 and 5 passes) - * crc32, crc32b, adler32, gost, snefru, whirlpool - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/ext/interbase/interbase.c b/ext/interbase/interbase.c index 8986a4d32bd87..1b8d7acfabd96 100644 --- a/ext/interbase/interbase.c +++ b/ext/interbase/interbase.c @@ -833,6 +833,9 @@ PHP_MINFO_FUNCTION(ibase) info_func(s = tmp); } php_info_print_table_row(2, "Run-time Client Library Version", s); +#ifdef PHP_WIN32 + FreeLibrary(l); +#endif } while (0); #endif php_info_print_table_end(); diff --git a/ext/intl/breakiterator/breakiterator_class.cpp b/ext/intl/breakiterator/breakiterator_class.cpp index ae9e2586081fb..355072dec5de8 100644 --- a/ext/intl/breakiterator/breakiterator_class.cpp +++ b/ext/intl/breakiterator/breakiterator_class.cpp @@ -144,8 +144,7 @@ static HashTable *BreakIterator_get_debug_info(zval *object, int *is_temp) *is_temp = 1; - ALLOC_HASHTABLE(debug_info); - zend_hash_init(debug_info, 8, NULL, ZVAL_PTR_DTOR, 0); + debug_info = zend_new_array(8); bio = Z_INTL_BREAKITERATOR_P(object); biter = bio->biter; diff --git a/ext/intl/calendar/calendar_class.cpp b/ext/intl/calendar/calendar_class.cpp index e9c817af03b05..5c67051d84998 100644 --- a/ext/intl/calendar/calendar_class.cpp +++ b/ext/intl/calendar/calendar_class.cpp @@ -154,8 +154,7 @@ static HashTable *Calendar_get_debug_info(zval *object, int *is_temp) *is_temp = 1; - ALLOC_HASHTABLE(debug_info); - zend_hash_init(debug_info, 8, NULL, ZVAL_PTR_DTOR, 0); + debug_info = zend_new_array(8); co = Z_INTL_CALENDAR_P(object); cal = co->ucal; @@ -456,12 +455,7 @@ void calendar_register_IntlCalendar_class(void) INIT_CLASS_ENTRY(ce, "IntlCalendar", Calendar_class_functions); ce.create_object = Calendar_object_create; Calendar_ce_ptr = zend_register_internal_class(&ce); - if (!Calendar_ce_ptr) { - //can't happen now without bigger problems before - php_error_docref0(NULL, E_ERROR, - "IntlCalendar: class registration has failed."); - return; - } + memcpy( &Calendar_handlers, zend_get_std_object_handlers(), sizeof Calendar_handlers); Calendar_handlers.offset = XtOffsetOf(Calendar_object, zo); @@ -525,11 +519,5 @@ void calendar_register_IntlCalendar_class(void) INIT_CLASS_ENTRY(ce, "IntlGregorianCalendar", GregorianCalendar_class_functions); GregorianCalendar_ce_ptr = zend_register_internal_class_ex(&ce, Calendar_ce_ptr); - if (!GregorianCalendar_ce_ptr) { - //can't happen know without bigger problems before - php_error_docref0(NULL, E_ERROR, - "IntlGregorianCalendar: class registration has failed."); - return; - } } /* }}} */ diff --git a/ext/intl/dateformat/dateformat_class.c b/ext/intl/dateformat/dateformat_class.c index 3b1345f2c90e6..572a3b37d52e8 100644 --- a/ext/intl/dateformat/dateformat_class.c +++ b/ext/intl/dateformat/dateformat_class.c @@ -202,12 +202,5 @@ void dateformat_register_IntlDateFormatter_class( void ) IntlDateFormatter_handlers.clone_obj = IntlDateFormatter_object_clone; IntlDateFormatter_handlers.dtor_obj = IntlDateFormatter_object_dtor; IntlDateFormatter_handlers.free_obj = IntlDateFormatter_object_free; - - /* Declare 'IntlDateFormatter' class properties. */ - if( !IntlDateFormatter_ce_ptr ) - { - zend_error(E_ERROR, "Failed to register IntlDateFormatter class"); - return; - } } /* }}} */ diff --git a/ext/intl/formatter/formatter_class.c b/ext/intl/formatter/formatter_class.c index bf4387b3d8a71..ef54de9418aed 100644 --- a/ext/intl/formatter/formatter_class.c +++ b/ext/intl/formatter/formatter_class.c @@ -189,13 +189,6 @@ void formatter_register_class( void ) NumberFormatter_handlers.offset = XtOffsetOf(NumberFormatter_object, zo); NumberFormatter_handlers.clone_obj = NumberFormatter_object_clone; NumberFormatter_handlers.free_obj = NumberFormatter_object_free; - - /* Declare 'NumberFormatter' class properties. */ - if( !NumberFormatter_ce_ptr ) - { - zend_error(E_ERROR, "Failed to register NumberFormatter class"); - return; - } } /* }}} */ diff --git a/ext/intl/msgformat/msgformat_class.c b/ext/intl/msgformat/msgformat_class.c index 90dac812521c8..954dcfd3fd76e 100644 --- a/ext/intl/msgformat/msgformat_class.c +++ b/ext/intl/msgformat/msgformat_class.c @@ -157,14 +157,6 @@ void msgformat_register_class( void ) MessageFormatter_handlers.offset = XtOffsetOf(MessageFormatter_object, zo); MessageFormatter_handlers.clone_obj = MessageFormatter_object_clone; MessageFormatter_handlers.free_obj = MessageFormatter_object_free; - - - /* Declare 'MessageFormatter' class properties. */ - if( !MessageFormatter_ce_ptr ) - { - zend_error(E_ERROR, "Failed to register MessageFormatter class"); - return; - } } /* }}} */ diff --git a/ext/intl/msgformat/msgformat_format.c b/ext/intl/msgformat/msgformat_format.c index cb74a3fb1bb54..bfc9dbe3ac25a 100644 --- a/ext/intl/msgformat/msgformat_format.c +++ b/ext/intl/msgformat/msgformat_format.c @@ -41,8 +41,7 @@ static void msgfmt_do_format(MessageFormatter_object *mfo, zval *args, zval *ret count = zend_hash_num_elements(Z_ARRVAL_P(args)); - ALLOC_HASHTABLE(args_copy); - zend_hash_init(args_copy, count, NULL, ZVAL_PTR_DTOR, 0); + args_copy = zend_new_array(count); zend_hash_copy(args_copy, Z_ARRVAL_P(args), (copy_ctor_func_t)zval_add_ref); umsg_format_helper(mfo, args_copy, &formatted, &formatted_len); diff --git a/ext/intl/resourcebundle/resourcebundle_class.c b/ext/intl/resourcebundle/resourcebundle_class.c index 47d9bf0403de0..f9d4bb16ca901 100644 --- a/ext/intl/resourcebundle/resourcebundle_class.c +++ b/ext/intl/resourcebundle/resourcebundle_class.c @@ -446,12 +446,6 @@ void resourcebundle_register_class( void ) ResourceBundle_ce_ptr = zend_register_internal_class( &ce ); - if( !ResourceBundle_ce_ptr ) - { - zend_error(E_ERROR, "Failed to register ResourceBundle class"); - return; - } - ResourceBundle_object_handlers = std_object_handlers; ResourceBundle_object_handlers.offset = XtOffsetOf(ResourceBundle_object, zend); ResourceBundle_object_handlers.clone_obj = NULL; /* ICU ResourceBundle has no clone implementation */ diff --git a/ext/intl/spoofchecker/spoofchecker_class.c b/ext/intl/spoofchecker/spoofchecker_class.c index 5cfc27dad144f..3edb41e5fb378 100644 --- a/ext/intl/spoofchecker/spoofchecker_class.c +++ b/ext/intl/spoofchecker/spoofchecker_class.c @@ -141,13 +141,6 @@ void spoofchecker_register_Spoofchecker_class(void) Spoofchecker_handlers.offset = XtOffsetOf(Spoofchecker_object, zo); Spoofchecker_handlers.clone_obj = spoofchecker_clone_obj; Spoofchecker_handlers.free_obj = Spoofchecker_objects_free; - - if (!Spoofchecker_ce_ptr) { - zend_error(E_ERROR, - "Spoofchecker: attempt to create properties " - "on a non-registered class."); - return; - } } /* }}} */ diff --git a/ext/intl/timezone/timezone_class.cpp b/ext/intl/timezone/timezone_class.cpp index b036de81cf986..c6f4dd5447d7a 100644 --- a/ext/intl/timezone/timezone_class.cpp +++ b/ext/intl/timezone/timezone_class.cpp @@ -295,8 +295,7 @@ static HashTable *TimeZone_get_debug_info(zval *object, int *is_temp) *is_temp = 1; - ALLOC_HASHTABLE(debug_info); - zend_hash_init(debug_info, 8, NULL, ZVAL_PTR_DTOR, 0); + debug_info = zend_new_array(8); to = Z_INTL_TIMEZONE_P(object); tz = to->utimezone; diff --git a/ext/json/json_parser.tab.c b/ext/json/json_parser.tab.c index c5247e5f04626..5db1842900224 100644 --- a/ext/json/json_parser.tab.c +++ b/ext/json/json_parser.tab.c @@ -1856,7 +1856,8 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); static int php_json_parser_array_create(php_json_parser *parser, zval *array) { - return array_init(array); + array_init(array); + return SUCCESS; } static int php_json_parser_array_append(php_json_parser *parser, zval *array, zval *zvalue) @@ -1868,7 +1869,8 @@ static int php_json_parser_array_append(php_json_parser *parser, zval *array, zv static int php_json_parser_object_create(php_json_parser *parser, zval *object) { if (parser->scanner.options & PHP_JSON_OBJECT_AS_ARRAY) { - return array_init(object); + array_init(object); + return SUCCESS; } else { return object_init(object); } diff --git a/ext/json/json_parser.y b/ext/json/json_parser.y index e24d42c831201..9b9df983ad6c0 100644 --- a/ext/json/json_parser.y +++ b/ext/json/json_parser.y @@ -248,7 +248,8 @@ errlex: static int php_json_parser_array_create(php_json_parser *parser, zval *array) { - return array_init(array); + array_init(array); + return SUCCESS; } static int php_json_parser_array_append(php_json_parser *parser, zval *array, zval *zvalue) @@ -260,7 +261,8 @@ static int php_json_parser_array_append(php_json_parser *parser, zval *array, zv static int php_json_parser_object_create(php_json_parser *parser, zval *object) { if (parser->scanner.options & PHP_JSON_OBJECT_AS_ARRAY) { - return array_init(object); + array_init(object); + return SUCCESS; } else { return object_init(object); } diff --git a/ext/ldap/config.m4 b/ext/ldap/config.m4 index 7ea238f5a59eb..59af4211f19aa 100644 --- a/ext/ldap/config.m4 +++ b/ext/ldap/config.m4 @@ -204,7 +204,7 @@ if test "$PHP_LDAP" != "no"; then dnl Solaris 2.8 claims to be 2004 API, but doesn't have dnl ldap_parse_reference() nor ldap_start_tls_s() - AC_CHECK_FUNCS([ldap_parse_result ldap_parse_reference ldap_start_tls_s ldap_control_find ldap_parse_extended_result ldap_extended_operation ldap_extended_operation_s ldap_passwd_s ldap_whoami_s]) + AC_CHECK_FUNCS([ldap_parse_result ldap_parse_reference ldap_start_tls_s ldap_control_find ldap_parse_extended_result ldap_extended_operation ldap_extended_operation_s ldap_passwd ldap_whoami_s ldap_refresh_s]) dnl dnl SASL check diff --git a/ext/ldap/config.w32 b/ext/ldap/config.w32 index 7713bdc42bbc9..a608ff7132969 100644 --- a/ext/ldap/config.w32 +++ b/ext/ldap/config.w32 @@ -23,8 +23,9 @@ if (PHP_LDAP != "no") { AC_DEFINE('HAVE_LDAP_CONTROL_FIND', 1); AC_DEFINE('HAVE_LDAP_PARSE_EXTENDED_RESULT', 1); AC_DEFINE('HAVE_LDAP_EXTENDED_OPERATION_S', 1); - AC_DEFINE('HAVE_LDAP_PASSWD_S', 1); + AC_DEFINE('HAVE_LDAP_PASSWD', 1); AC_DEFINE('HAVE_LDAP_WHOAMI_S', 1); + AC_DEFINE('HAVE_LDAP_REFRESH_S', 1); AC_DEFINE('HAVE_LDAP_EXTENDED_OPERATION', 1); } else { diff --git a/ext/ldap/ldap.c b/ext/ldap/ldap.c index a8b9923b10cc4..1b19e0599a25f 100644 --- a/ext/ldap/ldap.c +++ b/ext/ldap/ldap.c @@ -19,6 +19,7 @@ | Jani Taskinen | | Stig Venaas | | Doug Goldstein | + | Côme Chilliet | | PHP 4.0 updates: Zeev Suraski | +----------------------------------------------------------------------+ */ @@ -135,6 +136,524 @@ static void _free_ldap_result_entry(zend_resource *rsrc) /* {{{ */ } /* }}} */ +/* {{{ Parse controls from and to arrays */ +static void _php_ldap_control_to_array(LDAP *ld, LDAPControl* ctrl, zval* array, int request) +{ + array_init(array); + + add_assoc_string(array, "oid", ctrl->ldctl_oid); + if (request) { + /* iscritical field only makes sense in request controls (which may be obtained by ldap_get_option) */ + add_assoc_bool(array, "iscritical", (ctrl->ldctl_iscritical != 0)); + } + + // If it is a known oid, parse to values + if (strcmp(ctrl->ldctl_oid, LDAP_CONTROL_PASSWORDPOLICYRESPONSE) == 0) { + int expire = 0, grace = 0, rc; + LDAPPasswordPolicyError pperr; + zval value; + + rc = ldap_parse_passwordpolicy_control(ld, ctrl, &expire, &grace, &pperr); + if ( rc == LDAP_SUCCESS ) { + array_init(&value); + add_assoc_long(&value, "expire", expire); + add_assoc_long(&value, "grace", grace); + + if ( pperr != PP_noError ) { + add_assoc_long(&value, "error", pperr); + } + add_assoc_zval(array, "value", &value); + } else { + add_assoc_null(array, "value"); + } + } else if (strcmp(ctrl->ldctl_oid, LDAP_CONTROL_PAGEDRESULTS) == 0) { + int lestimated, rc; + struct berval lcookie; + zval value; + + if (ctrl->ldctl_value.bv_len) { + rc = ldap_parse_pageresponse_control(ld, ctrl, &lestimated, &lcookie); + } else { + /* ldap_parse_pageresponse_control will crash if value is empty */ + rc = -1; + } + if ( rc == LDAP_SUCCESS ) { + array_init(&value); + add_assoc_long(&value, "size", lestimated); + add_assoc_stringl(&value, "cookie", lcookie.bv_val, lcookie.bv_len); + add_assoc_zval(array, "value", &value); + } else { + add_assoc_null(array, "value"); + } + } else if ((strcmp(ctrl->ldctl_oid, LDAP_CONTROL_PRE_READ) == 0) || (strcmp(ctrl->ldctl_oid, LDAP_CONTROL_POST_READ) == 0)) { + BerElement *ber; + struct berval bv; + + ber = ber_init(&ctrl->ldctl_value); + if (ber == NULL) { + add_assoc_null(array, "value"); + } else if (ber_scanf(ber, "{m{" /*}}*/, &bv) == LBER_ERROR) { + add_assoc_null(array, "value"); + } else { + zval value; + + array_init(&value); + add_assoc_stringl(&value, "dn", bv.bv_val, bv.bv_len); + + while (ber_scanf(ber, "{m" /*}*/, &bv) != LBER_ERROR) { + int i; + BerVarray vals = NULL; + zval tmp; + + if (ber_scanf(ber, "[W]", &vals) == LBER_ERROR || vals == NULL) + { + break; + } + + array_init(&tmp); + for (i = 0; vals[i].bv_val != NULL; i++) { + add_next_index_stringl(&tmp, vals[i].bv_val, vals[i].bv_len); + } + add_assoc_zval(&value, bv.bv_val, &tmp); + + ber_bvarray_free(vals); + } + add_assoc_zval(array, "value", &value); + } + + if (ber != NULL) { + ber_free(ber, 1); + } + } else if (strcmp(ctrl->ldctl_oid, LDAP_CONTROL_SORTRESPONSE) == 0) { + zval value; + int errcode, rc; + char* attribute; + + if (ctrl->ldctl_value.bv_len) { + rc = ldap_parse_sortresponse_control(ld, ctrl, &errcode, &attribute); + } else { + rc = -1; + } + if ( rc == LDAP_SUCCESS ) { + array_init(&value); + add_assoc_long(&value, "errcode", errcode); + if (attribute) { + add_assoc_string(&value, "attribute", attribute); + ldap_memfree(attribute); + } + add_assoc_zval(array, "value", &value); + } else { + add_assoc_null(array, "value"); + } + } else if (strcmp(ctrl->ldctl_oid, LDAP_CONTROL_VLVRESPONSE) == 0) { + int target, count, errcode, rc; + struct berval *context; + zval value; + + if (ctrl->ldctl_value.bv_len) { + rc = ldap_parse_vlvresponse_control(ld, ctrl, &target, &count, &context, &errcode); + } else { + rc = -1; + } + if ( rc == LDAP_SUCCESS ) { + array_init(&value); + add_assoc_long(&value, "target", target); + add_assoc_long(&value, "count", count); + add_assoc_long(&value, "errcode", errcode); + add_assoc_stringl(&value, "context", context->bv_val, context->bv_len); + add_assoc_zval(array, "value", &value); + } else { + add_assoc_null(array, "value"); + } + ber_bvfree(context); + } else { + if (ctrl->ldctl_value.bv_len) { + add_assoc_stringl(array, "value", ctrl->ldctl_value.bv_val, ctrl->ldctl_value.bv_len); + } else { + add_assoc_null(array, "value"); + } + } +} + +static int _php_ldap_control_from_array(LDAP *ld, LDAPControl** ctrl, zval* array) +{ + zval* val; + char * control_oid = NULL; + int control_iscritical = 0, rc = LDAP_SUCCESS; + char** ldap_attrs = NULL; + LDAPSortKey** sort_keys = NULL; + + if ((val = zend_hash_str_find(Z_ARRVAL_P(array), "oid", sizeof("oid") - 1)) == NULL) { + php_error_docref(NULL, E_WARNING, "Control must have an oid key"); + return -1; + } + convert_to_string_ex(val); + control_oid = Z_STRVAL_P(val); + + if ((val = zend_hash_str_find(Z_ARRVAL_P(array), "iscritical", sizeof("iscritical") - 1)) != NULL) { + convert_to_boolean_ex(val); + control_iscritical = (Z_TYPE_P(val) == IS_TRUE); + } else { + control_iscritical = 0; + } + + struct berval *control_value = NULL; + + if ((val = zend_hash_str_find(Z_ARRVAL_P(array), "value", sizeof("value") - 1)) != NULL) { + if (Z_TYPE_P(val) != IS_ARRAY) { + convert_to_string_ex(val); + control_value = ber_memalloc(sizeof * control_value); + if (control_value == NULL) { + rc = -1; + php_error_docref(NULL, E_WARNING, "Failed to allocate control value"); + } else { + control_value->bv_val = Z_STRVAL_P(val); + control_value->bv_len = Z_STRLEN_P(val); + } + } else if (strcmp(control_oid, LDAP_CONTROL_PAGEDRESULTS) == 0) { + zval* tmp; + int pagesize = 1; + struct berval cookie = { 0, NULL }; + if ((tmp = zend_hash_str_find(Z_ARRVAL_P(val), "size", sizeof("size") - 1)) != NULL) { + convert_to_long_ex(tmp); + pagesize = Z_LVAL_P(tmp); + } + if ((tmp = zend_hash_str_find(Z_ARRVAL_P(val), "cookie", sizeof("cookie") - 1)) != NULL) { + convert_to_string_ex(tmp); + cookie.bv_val = Z_STRVAL_P(tmp); + cookie.bv_len = Z_STRLEN_P(tmp); + } + control_value = ber_memalloc(sizeof * control_value); + if (control_value == NULL) { + rc = -1; + php_error_docref(NULL, E_WARNING, "Failed to allocate control value"); + } else { + rc = ldap_create_page_control_value(ld, pagesize, &cookie, control_value); + if (rc != LDAP_SUCCESS) { + php_error_docref(NULL, E_WARNING, "Failed to create paged result control value: %s (%d)", ldap_err2string(rc), rc); + } + } + } else if (strcmp(control_oid, LDAP_CONTROL_ASSERT) == 0) { + zval* tmp; + char* assert; + if ((tmp = zend_hash_str_find(Z_ARRVAL_P(val), "filter", sizeof("filter") - 1)) == NULL) { + rc = -1; + php_error_docref(NULL, E_WARNING, "Filter missing from assert control value array"); + } else { + convert_to_string_ex(tmp); + assert = Z_STRVAL_P(tmp); + control_value = ber_memalloc(sizeof * control_value); + if (control_value == NULL) { + rc = -1; + php_error_docref(NULL, E_WARNING, "Failed to allocate control value"); + } else { + // ldap_create_assertion_control_value does not reset ld_errno, we need to do it ourselves + // See http://www.openldap.org/its/index.cgi/Incoming?id=8674 + int success = LDAP_SUCCESS; + ldap_set_option(ld, LDAP_OPT_RESULT_CODE, &success); + rc = ldap_create_assertion_control_value(ld, assert, control_value); + if (rc != LDAP_SUCCESS) { + php_error_docref(NULL, E_WARNING, "Failed to create assert control value: %s (%d)", ldap_err2string(rc), rc); + } + } + } + } else if (strcmp(control_oid, LDAP_CONTROL_VALUESRETURNFILTER) == 0) { + zval* tmp; + if ((tmp = zend_hash_str_find(Z_ARRVAL_P(val), "filter", sizeof("filter") - 1)) == NULL) { + rc = -1; + php_error_docref(NULL, E_WARNING, "Filter missing from control value array"); + } else { + BerElement *vrber = ber_alloc_t(LBER_USE_DER); + control_value = ber_memalloc(sizeof * control_value); + if ((control_value == NULL) || (vrber == NULL)) { + rc = -1; + php_error_docref(NULL, E_WARNING, "Failed to allocate control value"); + } else { + convert_to_string_ex(tmp); + if (ldap_put_vrFilter(vrber, Z_STRVAL_P(tmp)) == -1) { + ber_free(vrber, 1); + rc = -1; + php_error_docref(NULL, E_WARNING, "Failed to create control value: Bad ValuesReturnFilter: %s", Z_STRVAL_P(tmp)); + } else { + if (ber_flatten2(vrber, control_value, 0) == -1) { + rc = -1; + } + ber_free(vrber, 1); + } + } + } + } else if ((strcmp(control_oid, LDAP_CONTROL_PRE_READ) == 0) || (strcmp(control_oid, LDAP_CONTROL_POST_READ) == 0)) { + zval* tmp; + if ((tmp = zend_hash_str_find(Z_ARRVAL_P(val), "attrs", sizeof("attrs") - 1)) == NULL) { + rc = -1; + php_error_docref(NULL, E_WARNING, "Attributes list missing from control value array"); + } else { + BerElement *ber = ber_alloc_t(LBER_USE_DER); + + control_value = ber_memalloc(sizeof * control_value); + if ((control_value == NULL) || (ber == NULL)) { + rc = -1; + php_error_docref(NULL, E_WARNING, "Failed to allocate control value"); + } else { + int num_attribs, i; + zval* attr; + + num_attribs = zend_hash_num_elements(Z_ARRVAL_P(tmp)); + ldap_attrs = safe_emalloc((num_attribs+1), sizeof(char *), 0); + + for (i = 0; iattributeType = Z_STRVAL_P(tmp); + + if ((tmp = zend_hash_str_find(Z_ARRVAL_P(sortkey), "oid", sizeof("oid") - 1)) != NULL) { + convert_to_string_ex(tmp); + sort_keys[i]->orderingRule = Z_STRVAL_P(tmp); + } else { + sort_keys[i]->orderingRule = NULL; + } + + if ((tmp = zend_hash_str_find(Z_ARRVAL_P(sortkey), "reverse", sizeof("reverse") - 1)) != NULL) { + convert_to_boolean_ex(tmp); + sort_keys[i]->reverseOrder = (Z_TYPE_P(tmp) == IS_TRUE); + } else { + sort_keys[i]->reverseOrder = 0; + } + } + sort_keys[num_keys] = NULL; + control_value = ber_memalloc(sizeof * control_value); + if (control_value == NULL) { + rc = -1; + php_error_docref(NULL, E_WARNING, "Failed to allocate control value"); + } else { + rc = ldap_create_sort_control_value(ld, sort_keys, control_value); + if (rc != LDAP_SUCCESS) { + php_error_docref(NULL, E_WARNING, "Failed to create sort control value: %s (%d)", ldap_err2string(rc), rc); + } + } + } else if (strcmp(control_oid, LDAP_CONTROL_VLVREQUEST) == 0) { + zval* tmp; + LDAPVLVInfo vlvInfo; + struct berval attrValue; + struct berval context; + + if ((tmp = zend_hash_str_find(Z_ARRVAL_P(val), "before", sizeof("before") - 1)) != NULL) { + convert_to_long_ex(tmp); + vlvInfo.ldvlv_before_count = Z_LVAL_P(tmp); + } else { + rc = -1; + php_error_docref(NULL, E_WARNING, "Before key missing from array value for VLV control"); + goto failure; + } + + if ((tmp = zend_hash_str_find(Z_ARRVAL_P(val), "after", sizeof("after") - 1)) != NULL) { + convert_to_long_ex(tmp); + vlvInfo.ldvlv_after_count = Z_LVAL_P(tmp); + } else { + rc = -1; + php_error_docref(NULL, E_WARNING, "After key missing from array value for VLV control"); + goto failure; + } + + if ((tmp = zend_hash_str_find(Z_ARRVAL_P(val), "attrvalue", sizeof("attrvalue") - 1)) != NULL) { + convert_to_string_ex(tmp); + attrValue.bv_val = Z_STRVAL_P(tmp); + attrValue.bv_len = Z_STRLEN_P(tmp); + vlvInfo.ldvlv_attrvalue = &attrValue; + } else if ((tmp = zend_hash_str_find(Z_ARRVAL_P(val), "offset", sizeof("offset") - 1)) != NULL) { + vlvInfo.ldvlv_attrvalue = NULL; + convert_to_long_ex(tmp); + vlvInfo.ldvlv_offset = Z_LVAL_P(tmp); + if ((tmp = zend_hash_str_find(Z_ARRVAL_P(val), "count", sizeof("count") - 1)) != NULL) { + convert_to_long_ex(tmp); + vlvInfo.ldvlv_count = Z_LVAL_P(tmp); + } else { + rc = -1; + php_error_docref(NULL, E_WARNING, "Count key missing from array value for VLV control"); + goto failure; + } + } else { + rc = -1; + php_error_docref(NULL, E_WARNING, "Missing either attrvalue or offset key from array value for VLV control"); + goto failure; + } + + if ((tmp = zend_hash_str_find(Z_ARRVAL_P(val), "context", sizeof("context") - 1)) != NULL) { + convert_to_string_ex(tmp); + context.bv_val = Z_STRVAL_P(tmp); + context.bv_len = Z_STRLEN_P(tmp); + vlvInfo.ldvlv_context = &context; + } else { + vlvInfo.ldvlv_context = NULL; + } + + control_value = ber_memalloc(sizeof * control_value); + if (control_value == NULL) { + rc = -1; + php_error_docref(NULL, E_WARNING, "Failed to allocate control value"); + } else { + rc = ldap_create_vlv_control_value(ld, &vlvInfo, control_value); + if (rc != LDAP_SUCCESS) { + php_error_docref(NULL, E_WARNING, "Failed to create VLV control value: %s (%d)", ldap_err2string(rc), rc); + } + } + } else { + php_error_docref(NULL, E_WARNING, "Control OID %s does not expect an array as value", control_oid); + rc = -1; + } + } + + if (rc == LDAP_SUCCESS) { + rc = ldap_control_create(control_oid, control_iscritical, control_value, 1, ctrl); + } + +failure: + if (control_value != NULL) { + ber_memfree(control_value); + control_value = NULL; + } + if (ldap_attrs != NULL) { + efree(ldap_attrs); + } + if (sort_keys != NULL) { + LDAPSortKey** sortp = sort_keys; + while (*sortp) { + efree(*sortp); + sortp++; + } + efree(sort_keys); + sort_keys = NULL; + } + + if (rc == LDAP_SUCCESS) { + return LDAP_SUCCESS; + } + + // Failed + *ctrl = NULL; + return -1; +} + +static void _php_ldap_controls_to_array(LDAP *ld, LDAPControl** ctrls, zval* array, int request) +{ + zval tmp1; + LDAPControl **ctrlp; + + array_init(array); + if (ctrls == NULL) { + return; + } + ctrlp = ctrls; + while (*ctrlp != NULL) { + _php_ldap_control_to_array(ld, *ctrlp, &tmp1, request); + add_assoc_zval(array, (*ctrlp)->ldctl_oid, &tmp1); + ctrlp++; + } + ldap_controls_free(ctrls); +} + +static LDAPControl** _php_ldap_controls_from_array(LDAP *ld, zval* array) +{ + int ncontrols; + LDAPControl** ctrlp, **ctrls = NULL; + zval* ctrlarray; + int error = 0; + + ncontrols = zend_hash_num_elements(Z_ARRVAL_P(array)); + ctrls = safe_emalloc((1 + ncontrols), sizeof(*ctrls), 0); + *ctrls = NULL; + ctrlp = ctrls; + ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(array), ctrlarray) { + if (Z_TYPE_P(ctrlarray) != IS_ARRAY) { + php_error_docref(NULL, E_WARNING, "The array value must contain only arrays, where each array is a control"); + error = 1; + break; + } + + if (_php_ldap_control_from_array(ld, ctrlp, ctrlarray) == LDAP_SUCCESS) { + ++ctrlp; + } else { + error = 1; + break; + } + + *ctrlp = NULL; + } ZEND_HASH_FOREACH_END(); + + if (error) { + ctrlp = ctrls; + while (*ctrlp) { + ldap_control_free(*ctrlp); + ctrlp++; + } + efree(ctrls); + ctrls = NULL; + } + + return ctrls; +} + +static void _php_ldap_controls_free (LDAPControl*** ctrls) +{ + LDAPControl **ctrlp; + + if (*ctrls) { + ctrlp = *ctrls; + while (*ctrlp) { + ldap_control_free(*ctrlp); + ctrlp++; + } + efree(*ctrls); + *ctrls = NULL; + } +} +/* }}} */ + /* {{{ PHP_INI_BEGIN */ PHP_INI_BEGIN() @@ -355,7 +874,7 @@ PHP_MINIT_FUNCTION(ldap) REGISTER_STRING_CONSTANT("LDAP_CONTROL_X_TREE_DELETE", LDAP_CONTROL_X_TREE_DELETE, CONST_PERSISTENT | CONST_CS); REGISTER_STRING_CONSTANT("LDAP_CONTROL_X_EXTENDED_DN", LDAP_CONTROL_X_EXTENDED_DN, CONST_PERSISTENT | CONST_CS); #endif -#ifdef LDAP_CONTROL_X_INCREMENTAL_VALUES +#ifdef LDAP_CONTROL_VLVREQUEST /* LDAP VLV */ REGISTER_STRING_CONSTANT("LDAP_CONTROL_VLVREQUEST", LDAP_CONTROL_VLVREQUEST, CONST_PERSISTENT | CONST_CS); REGISTER_STRING_CONSTANT("LDAP_CONTROL_VLVRESPONSE", LDAP_CONTROL_VLVRESPONSE, CONST_PERSISTENT | CONST_CS); @@ -488,7 +1007,7 @@ PHP_FUNCTION(ldap_connect) int rc = LDAP_SUCCESS; char *url = host; if (url && !ldap_is_ldap_url(url)) { - int urllen = hostlen + sizeof( "ldap://:65535" ); + size_t urllen = hostlen + sizeof( "ldap://:65535" ); if (port <= 0 || port > 65535) { efree(ld); @@ -637,6 +1156,83 @@ PHP_FUNCTION(ldap_bind) } /* }}} */ +/* {{{ proto resource ldap_bind_ext(resource link [, string dn [, string password [, serverctrls]]]) + Bind to LDAP directory */ +PHP_FUNCTION(ldap_bind_ext) +{ + zval *serverctrls = NULL; + zval *link; + char *ldap_bind_dn = NULL, *ldap_bind_pw = NULL; + size_t ldap_bind_dnlen, ldap_bind_pwlen; + ldap_linkdata *ld; + LDAPControl **lserverctrls = NULL; + LDAPMessage *ldap_res; + int rc; + + if (zend_parse_parameters(ZEND_NUM_ARGS(), "r|ssa", &link, &ldap_bind_dn, &ldap_bind_dnlen, &ldap_bind_pw, &ldap_bind_pwlen, &serverctrls) != SUCCESS) { + RETURN_FALSE; + } + + if ((ld = (ldap_linkdata *)zend_fetch_resource(Z_RES_P(link), "ldap link", le_link)) == NULL) { + RETURN_FALSE; + } + + if (ldap_bind_dn != NULL && memchr(ldap_bind_dn, '\0', ldap_bind_dnlen) != NULL) { + _set_lderrno(ld->link, LDAP_INVALID_CREDENTIALS); + php_error_docref(NULL, E_WARNING, "DN contains a null byte"); + RETURN_FALSE; + } + + if (ldap_bind_pw != NULL && memchr(ldap_bind_pw, '\0', ldap_bind_pwlen) != NULL) { + _set_lderrno(ld->link, LDAP_INVALID_CREDENTIALS); + php_error_docref(NULL, E_WARNING, "Password contains a null byte"); + RETURN_FALSE; + } + + if (serverctrls) { + lserverctrls = _php_ldap_controls_from_array(ld->link, serverctrls); + if (lserverctrls == NULL) { + RETVAL_FALSE; + goto cleanup; + } + } + + { + /* ldap_simple_bind() is deprecated, use ldap_sasl_bind() instead */ + struct berval cred; + int msgid; + + cred.bv_val = ldap_bind_pw; + cred.bv_len = ldap_bind_pw ? ldap_bind_pwlen : 0; + /* asynchronous call */ + rc = ldap_sasl_bind(ld->link, ldap_bind_dn, LDAP_SASL_SIMPLE, &cred, + lserverctrls, NULL, &msgid); + if (rc != LDAP_SUCCESS ) { + php_error_docref(NULL, E_WARNING, "Unable to bind to server: %s (%d)", ldap_err2string(rc), rc); + RETVAL_FALSE; + goto cleanup; + } + + rc = ldap_result(ld->link, msgid, 1 /* LDAP_MSG_ALL */, NULL, &ldap_res); + if (rc == -1) { + php_error_docref(NULL, E_WARNING, "Bind operation failed"); + RETVAL_FALSE; + goto cleanup; + } + + /* return a PHP control object */ + RETVAL_RES(zend_register_resource(ldap_res, le_result)); + } + +cleanup: + if (lserverctrls) { + _php_ldap_controls_free(&lserverctrls); + } + + return; +} +/* }}} */ + #ifdef HAVE_LDAP_SASL typedef struct { char *mech; @@ -827,22 +1423,24 @@ static void php_set_opts(LDAP *ldap, int sizelimit, int timelimit, int deref, in */ static void php_ldap_do_search(INTERNAL_FUNCTION_PARAMETERS, int scope) { - zval *link, *base_dn, *filter, *attrs = NULL, *attr; + zval *link, *base_dn, *filter, *attrs = NULL, *attr, *serverctrls = NULL; zend_long attrsonly, sizelimit, timelimit, deref; char *ldap_base_dn = NULL, *ldap_filter = NULL, **ldap_attrs = NULL; ldap_linkdata *ld = NULL; LDAPMessage *ldap_res; + LDAPControl **lserverctrls = NULL; int ldap_attrsonly = 0, ldap_sizelimit = -1, ldap_timelimit = -1, ldap_deref = -1; int old_ldap_sizelimit = -1, old_ldap_timelimit = -1, old_ldap_deref = -1; int num_attribs = 0, ret = 1, i, errno, argcount = ZEND_NUM_ARGS(); - if (zend_parse_parameters(argcount, "zzz|allll", &link, &base_dn, &filter, &attrs, &attrsonly, - &sizelimit, &timelimit, &deref) == FAILURE) { + if (zend_parse_parameters(argcount, "zzz|alllla", &link, &base_dn, &filter, &attrs, &attrsonly, + &sizelimit, &timelimit, &deref, &serverctrls) == FAILURE) { return; } /* Reverse -> fall through */ switch (argcount) { + case 9: case 8: ldap_deref = deref; case 7: @@ -945,10 +1543,20 @@ static void php_ldap_do_search(INTERNAL_FUNCTION_PARAMETERS, int scope) ldap_filter = Z_STRVAL_P(entry); } + if (argcount > 8) { + // We have to parse controls again for each link as they use it + _php_ldap_controls_free(&lserverctrls); + lserverctrls = _php_ldap_controls_from_array(ld->link, serverctrls); + if (lserverctrls == NULL) { + rcs[i] = -1; + continue; + } + } + php_set_opts(ld->link, ldap_sizelimit, ldap_timelimit, ldap_deref, &old_ldap_sizelimit, &old_ldap_timelimit, &old_ldap_deref); /* Run the actual search */ - ldap_search_ext(ld->link, ldap_base_dn, scope, ldap_filter, ldap_attrs, ldap_attrsonly, NULL, NULL, NULL, ldap_sizelimit, &rcs[i]); + ldap_search_ext(ld->link, ldap_base_dn, scope, ldap_filter, ldap_attrs, ldap_attrsonly, lserverctrls, NULL, NULL, ldap_sizelimit, &rcs[i]); lds[i] = ld; zend_hash_move_forward(Z_ARRVAL_P(link)); } @@ -986,10 +1594,18 @@ static void php_ldap_do_search(INTERNAL_FUNCTION_PARAMETERS, int scope) goto cleanup; } + if (argcount > 8) { + lserverctrls = _php_ldap_controls_from_array(ld->link, serverctrls); + if (lserverctrls == NULL) { + ret = 0; + goto cleanup; + } + } + php_set_opts(ld->link, ldap_sizelimit, ldap_timelimit, ldap_deref, &old_ldap_sizelimit, &old_ldap_timelimit, &old_ldap_deref); /* Run the actual search */ - errno = ldap_search_ext_s(ld->link, ldap_base_dn, scope, ldap_filter, ldap_attrs, ldap_attrsonly, NULL, NULL, NULL, ldap_sizelimit, &ldap_res); + errno = ldap_search_ext_s(ld->link, ldap_base_dn, scope, ldap_filter, ldap_attrs, ldap_attrsonly, lserverctrls, NULL, NULL, ldap_sizelimit, &ldap_res); if (errno != LDAP_SUCCESS && errno != LDAP_SIZELIMIT_EXCEEDED @@ -1027,10 +1643,13 @@ static void php_ldap_do_search(INTERNAL_FUNCTION_PARAMETERS, int scope) if (!ret) { RETVAL_BOOL(ret); } + if (lserverctrls) { + _php_ldap_controls_free(&lserverctrls); + } } /* }}} */ -/* {{{ proto resource ldap_read(resource|array link, string base_dn, string filter [, array attrs [, int attrsonly [, int sizelimit [, int timelimit [, int deref]]]]]) +/* {{{ proto resource ldap_read(resource|array link, string base_dn, string filter [, array attrs [, int attrsonly [, int sizelimit [, int timelimit [, int deref [, array servercontrols]]]]]]) Read an entry */ PHP_FUNCTION(ldap_read) { @@ -1038,7 +1657,7 @@ PHP_FUNCTION(ldap_read) } /* }}} */ -/* {{{ proto resource ldap_list(resource|array link, string base_dn, string filter [, array attrs [, int attrsonly [, int sizelimit [, int timelimit [, int deref]]]]]) +/* {{{ proto resource ldap_list(resource|array link, string base_dn, string filter [, array attrs [, int attrsonly [, int sizelimit [, int timelimit [, int deref [, array servercontrols]]]]]]) Single-level search */ PHP_FUNCTION(ldap_list) { @@ -1046,7 +1665,7 @@ PHP_FUNCTION(ldap_list) } /* }}} */ -/* {{{ proto resource ldap_search(resource|array link, string base_dn, string filter [, array attrs [, int attrsonly [, int sizelimit [, int timelimit [, int deref]]]]]) +/* {{{ proto resource ldap_search(resource|array link, string base_dn, string filter [, array attrs [, int attrsonly [, int sizelimit [, int timelimit [, int deref [, array servercontrols]]]]]]) Search LDAP tree under base_dn */ PHP_FUNCTION(ldap_search) { @@ -1535,20 +2154,23 @@ PHP_FUNCTION(ldap_dn2ufn) #define PHP_LD_FULL_ADD 0xff /* {{{ php_ldap_do_modify */ -static void php_ldap_do_modify(INTERNAL_FUNCTION_PARAMETERS, int oper) +static void php_ldap_do_modify(INTERNAL_FUNCTION_PARAMETERS, int oper, int ext) { + zval *serverctrls = NULL; zval *link, *entry, *value, *ivalue; ldap_linkdata *ld; char *dn; LDAPMod **ldap_mods; - int i, j, num_attribs, num_values; + LDAPControl **lserverctrls = NULL; + LDAPMessage *ldap_res; + int i, j, num_attribs, num_values, msgid; size_t dn_len; int *num_berval; zend_string *attribute; zend_ulong index; int is_full_add=0; /* flag for full add operation so ldap_mod_add can be put back into oper, gerrit THomson */ - if (zend_parse_parameters(ZEND_NUM_ARGS(), "rsa/", &link, &dn, &dn_len, &entry) != SUCCESS) { + if (zend_parse_parameters(ZEND_NUM_ARGS(), "rsa/|a", &link, &dn, &dn_len, &entry, &serverctrls) != SUCCESS) { return; } @@ -1616,7 +2238,7 @@ static void php_ldap_do_modify(INTERNAL_FUNCTION_PARAMETERS, int oper) num_berval[i] = j; num_attribs = i + 1; RETVAL_FALSE; - goto errexit; + goto cleanup; } convert_to_string_ex(ivalue); ldap_mods[i]->mod_bvalues[j] = (struct berval *) emalloc (sizeof(struct berval)); @@ -1629,20 +2251,58 @@ static void php_ldap_do_modify(INTERNAL_FUNCTION_PARAMETERS, int oper) } ldap_mods[num_attribs] = NULL; + if (serverctrls) { + lserverctrls = _php_ldap_controls_from_array(ld->link, serverctrls); + if (lserverctrls == NULL) { + RETVAL_FALSE; + goto cleanup; + } + } + /* check flag to see if do_mod was called to perform full add , gerrit thomson */ if (is_full_add == 1) { - if ((i = ldap_add_ext_s(ld->link, dn, ldap_mods, NULL, NULL)) != LDAP_SUCCESS) { + if (ext) { + i = ldap_add_ext(ld->link, dn, ldap_mods, lserverctrls, NULL, &msgid); + } else { + i = ldap_add_ext_s(ld->link, dn, ldap_mods, lserverctrls, NULL); + } + if (i != LDAP_SUCCESS) { php_error_docref(NULL, E_WARNING, "Add: %s", ldap_err2string(i)); RETVAL_FALSE; + } else if (ext) { + i = ldap_result(ld->link, msgid, 1 /* LDAP_MSG_ALL */, NULL, &ldap_res); + if (i == -1) { + php_error_docref(NULL, E_WARNING, "Add operation failed"); + RETVAL_FALSE; + goto cleanup; + } + + /* return a PHP control object */ + RETVAL_RES(zend_register_resource(ldap_res, le_result)); } else RETVAL_TRUE; } else { - if ((i = ldap_modify_ext_s(ld->link, dn, ldap_mods, NULL, NULL)) != LDAP_SUCCESS) { + if (ext) { + i = ldap_modify_ext(ld->link, dn, ldap_mods, lserverctrls, NULL, &msgid); + } else { + i = ldap_modify_ext_s(ld->link, dn, ldap_mods, lserverctrls, NULL); + } + if (i != LDAP_SUCCESS) { php_error_docref(NULL, E_WARNING, "Modify: %s", ldap_err2string(i)); RETVAL_FALSE; + } else if (ext) { + i = ldap_result(ld->link, msgid, 1 /* LDAP_MSG_ALL */, NULL, &ldap_res); + if (i == -1) { + php_error_docref(NULL, E_WARNING, "Modify operation failed"); + RETVAL_FALSE; + goto cleanup; + } + + /* return a PHP control object */ + RETVAL_RES(zend_register_resource(ldap_res, le_result)); } else RETVAL_TRUE; } -errexit: +cleanup: for (i = 0; i < num_attribs; i++) { efree(ldap_mods[i]->mod_type); for (j = 0; j < num_berval[i]; j++) { @@ -1654,77 +2314,163 @@ static void php_ldap_do_modify(INTERNAL_FUNCTION_PARAMETERS, int oper) efree(num_berval); efree(ldap_mods); + if (lserverctrls) { + _php_ldap_controls_free(&lserverctrls); + } + return; } /* }}} */ -/* {{{ proto bool ldap_add(resource link, string dn, array entry) +/* {{{ proto bool ldap_add(resource link, string dn, array entry [, array servercontrols]) Add entries to LDAP directory */ PHP_FUNCTION(ldap_add) { /* use a newly define parameter into the do_modify so ldap_mod_add can be used the way it is supposed to be used , Gerrit THomson */ - php_ldap_do_modify(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_LD_FULL_ADD); + php_ldap_do_modify(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_LD_FULL_ADD, 0); +} +/* }}} */ + +/* {{{ proto resource ldap_add_ext(resource link, string dn, array entry [, array servercontrols]) + Add entries to LDAP directory */ +PHP_FUNCTION(ldap_add_ext) +{ + php_ldap_do_modify(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_LD_FULL_ADD, 1); } /* }}} */ /* three functions for attribute base modifications, gerrit Thomson */ -/* {{{ proto bool ldap_mod_replace(resource link, string dn, array entry) +/* {{{ proto bool ldap_mod_replace(resource link, string dn, array entry [, array servercontrols]) Replace attribute values with new ones */ PHP_FUNCTION(ldap_mod_replace) { - php_ldap_do_modify(INTERNAL_FUNCTION_PARAM_PASSTHRU, LDAP_MOD_REPLACE); + php_ldap_do_modify(INTERNAL_FUNCTION_PARAM_PASSTHRU, LDAP_MOD_REPLACE, 0); +} +/* }}} */ + +/* {{{ proto resource ldap_mod_replace_ext(resource link, string dn, array entry [, array servercontrols]) + Replace attribute values with new ones */ +PHP_FUNCTION(ldap_mod_replace_ext) +{ + php_ldap_do_modify(INTERNAL_FUNCTION_PARAM_PASSTHRU, LDAP_MOD_REPLACE, 1); +} +/* }}} */ + +/* {{{ proto bool ldap_mod_add(resource link, string dn, array entry [, array servercontrols]) + Add attribute values to current */ +PHP_FUNCTION(ldap_mod_add) +{ + php_ldap_do_modify(INTERNAL_FUNCTION_PARAM_PASSTHRU, LDAP_MOD_ADD, 0); +} +/* }}} */ + +/* {{{ proto resource ldap_mod_add(resource link, string dn, array entry [, array servercontrols]) + Add attribute values to current */ +PHP_FUNCTION(ldap_mod_add_ext) +{ + php_ldap_do_modify(INTERNAL_FUNCTION_PARAM_PASSTHRU, LDAP_MOD_ADD, 1); +} +/* }}} */ + +/* {{{ proto bool ldap_mod_del(resource link, string dn, array entry [, array servercontrols]) + Delete attribute values */ +PHP_FUNCTION(ldap_mod_del) +{ + php_ldap_do_modify(INTERNAL_FUNCTION_PARAM_PASSTHRU, LDAP_MOD_DELETE, 0); } /* }}} */ -/* {{{ proto bool ldap_mod_add(resource link, string dn, array entry) - Add attribute values to current */ -PHP_FUNCTION(ldap_mod_add) -{ - php_ldap_do_modify(INTERNAL_FUNCTION_PARAM_PASSTHRU, LDAP_MOD_ADD); +/* {{{ proto resource ldap_mod_del_ext(resource link, string dn, array entry [, array servercontrols]) + Delete attribute values */ +PHP_FUNCTION(ldap_mod_del_ext) +{ + php_ldap_do_modify(INTERNAL_FUNCTION_PARAM_PASSTHRU, LDAP_MOD_DELETE, 1); +} +/* }}} */ + +/* {{{ php_ldap_do_delete + */ +static void php_ldap_do_delete(INTERNAL_FUNCTION_PARAMETERS, int ext) +{ + zval *serverctrls = NULL; + zval *link; + ldap_linkdata *ld; + LDAPControl **lserverctrls = NULL; + LDAPMessage *ldap_res; + char *dn; + int rc, msgid; + size_t dn_len; + + if (zend_parse_parameters(ZEND_NUM_ARGS(), "rs|a", &link, &dn, &dn_len, &serverctrls) != SUCCESS) { + return; + } + + if ((ld = (ldap_linkdata *)zend_fetch_resource(Z_RES_P(link), "ldap link", le_link)) == NULL) { + RETURN_FALSE; + } + + if (serverctrls) { + lserverctrls = _php_ldap_controls_from_array(ld->link, serverctrls); + if (lserverctrls == NULL) { + RETVAL_FALSE; + goto cleanup; + } + } + + if (ext) { + rc = ldap_delete_ext(ld->link, dn, lserverctrls, NULL, &msgid); + } else { + rc = ldap_delete_ext_s(ld->link, dn, lserverctrls, NULL); + } + if (rc != LDAP_SUCCESS) { + php_error_docref(NULL, E_WARNING, "Delete: %s", ldap_err2string(rc)); + RETVAL_FALSE; + goto cleanup; + } else if (ext) { + rc = ldap_result(ld->link, msgid, 1 /* LDAP_MSG_ALL */, NULL, &ldap_res); + if (rc == -1) { + php_error_docref(NULL, E_WARNING, "Delete operation failed"); + RETVAL_FALSE; + goto cleanup; + } + + /* return a PHP control object */ + RETVAL_RES(zend_register_resource(ldap_res, le_result)); + } else { + RETVAL_TRUE; + } + +cleanup: + if (lserverctrls) { + _php_ldap_controls_free(&lserverctrls); + } + + return; } /* }}} */ -/* {{{ proto bool ldap_mod_del(resource link, string dn, array entry) - Delete attribute values */ -PHP_FUNCTION(ldap_mod_del) +/* {{{ proto bool ldap_delete(resource link, string dn [, array servercontrols]) + Delete an entry from a directory */ +PHP_FUNCTION(ldap_delete) { - php_ldap_do_modify(INTERNAL_FUNCTION_PARAM_PASSTHRU, LDAP_MOD_DELETE); + php_ldap_do_delete(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0); } /* }}} */ -/* {{{ proto bool ldap_delete(resource link, string dn) +/* {{{ proto resource ldap_delete_ext(resource link, string dn [, array servercontrols]) Delete an entry from a directory */ -PHP_FUNCTION(ldap_delete) +PHP_FUNCTION(ldap_delete_ext) { - zval *link; - ldap_linkdata *ld; - char *dn; - int rc; - size_t dn_len; - - if (zend_parse_parameters(ZEND_NUM_ARGS(), "rs", &link, &dn, &dn_len) != SUCCESS) { - return; - } - - if ((ld = (ldap_linkdata *)zend_fetch_resource(Z_RES_P(link), "ldap link", le_link)) == NULL) { - RETURN_FALSE; - } - - if ((rc = ldap_delete_ext_s(ld->link, dn, NULL, NULL)) != LDAP_SUCCESS) { - php_error_docref(NULL, E_WARNING, "Delete: %s", ldap_err2string(rc)); - RETURN_FALSE; - } - - RETURN_TRUE; + php_ldap_do_delete(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1); } /* }}} */ /* {{{ _ldap_str_equal_to_const */ -static int _ldap_str_equal_to_const(const char *str, uint32_t str_len, const char *cstr) +static size_t _ldap_str_equal_to_const(const char *str, size_t str_len, const char *cstr) { - uint32_t i; + size_t i; if (strlen(cstr) != str_len) return 0; @@ -1741,9 +2487,9 @@ static int _ldap_str_equal_to_const(const char *str, uint32_t str_len, const cha /* {{{ _ldap_strlen_max */ -static int _ldap_strlen_max(const char *str, uint32_t max_len) +static size_t _ldap_strlen_max(const char *str, size_t max_len) { - uint32_t i; + size_t i; for (i = 0; i < max_len; ++i) { if (str[i] == '\0') { @@ -1763,10 +2509,11 @@ static void _ldap_hash_fetch(zval *hashTbl, const char *key, zval **out) } /* }}} */ -/* {{{ proto bool ldap_modify_batch(resource link, string dn, array modifs) +/* {{{ proto bool ldap_modify_batch(resource link, string dn, array modifs [, array servercontrols]) Perform multiple modifications as part of one operation */ PHP_FUNCTION(ldap_modify_batch) { + zval *serverctrls = NULL; ldap_linkdata *ld; zval *link, *mods, *mod, *modinfo, *modval; zval *attrib, *modtype, *vals; @@ -1776,6 +2523,7 @@ PHP_FUNCTION(ldap_modify_batch) int i, j, k; int num_mods, num_modprops, num_modvals; LDAPMod **ldap_mods; + LDAPControl **lserverctrls = NULL; uint32_t oper; /* @@ -1802,7 +2550,7 @@ PHP_FUNCTION(ldap_modify_batch) ); */ - if (zend_parse_parameters(ZEND_NUM_ARGS(), "rsa/", &link, &dn, &dn_len, &mods) != SUCCESS) { + if (zend_parse_parameters(ZEND_NUM_ARGS(), "rsa/|a", &link, &dn, &dn_len, &mods, &serverctrls) != SUCCESS) { return; } @@ -1819,7 +2567,7 @@ PHP_FUNCTION(ldap_modify_batch) zend_ulong tmpUlong; /* make sure the DN contains no NUL bytes */ - if ((size_t)_ldap_strlen_max(dn, dn_len) != dn_len) { + if (_ldap_strlen_max(dn, dn_len) != dn_len) { php_error_docref(NULL, E_WARNING, "DN must not contain NUL bytes"); RETURN_FALSE; } @@ -1879,7 +2627,7 @@ PHP_FUNCTION(ldap_modify_batch) RETURN_FALSE; } - if (Z_STRLEN_P(modinfo) != (size_t)_ldap_strlen_max(Z_STRVAL_P(modinfo), Z_STRLEN_P(modinfo))) { + if (Z_STRLEN_P(modinfo) != _ldap_strlen_max(Z_STRVAL_P(modinfo), Z_STRLEN_P(modinfo))) { php_error_docref(NULL, E_WARNING, "A '" LDAP_MODIFY_BATCH_ATTRIB "' value must not contain NUL bytes"); RETURN_FALSE; } @@ -2030,8 +2778,16 @@ PHP_FUNCTION(ldap_modify_batch) /* NULL-terminate modifications */ ldap_mods[num_mods] = NULL; + if (serverctrls) { + lserverctrls = _php_ldap_controls_from_array(ld->link, serverctrls); + if (lserverctrls == NULL) { + RETVAL_FALSE; + goto cleanup; + } + } + /* perform (finally) */ - if ((i = ldap_modify_ext_s(ld->link, dn, ldap_mods, NULL, NULL)) != LDAP_SUCCESS) { + if ((i = ldap_modify_ext_s(ld->link, dn, ldap_mods, lserverctrls, NULL)) != LDAP_SUCCESS) { php_error_docref(NULL, E_WARNING, "Batch Modify: %s", ldap_err2string(i)); RETVAL_FALSE; } else RETVAL_TRUE; @@ -2062,6 +2818,10 @@ PHP_FUNCTION(ldap_modify_batch) /* the modifications array */ efree(ldap_mods); + + if (lserverctrls) { + _php_ldap_controls_free(&lserverctrls); + } } } /* }}} */ @@ -2125,14 +2885,16 @@ PHP_FUNCTION(ldap_error) Determine if an entry has a specific value for one of its attributes */ PHP_FUNCTION(ldap_compare) { + zval *serverctrls = NULL; zval *link; char *dn, *attr, *value; size_t dn_len, attr_len, value_len; ldap_linkdata *ld; + LDAPControl **lserverctrls = NULL; int errno; struct berval lvalue; - if (zend_parse_parameters(ZEND_NUM_ARGS(), "rsss", &link, &dn, &dn_len, &attr, &attr_len, &value, &value_len) != SUCCESS) { + if (zend_parse_parameters(ZEND_NUM_ARGS(), "rsss|a", &link, &dn, &dn_len, &attr, &attr_len, &value, &value_len, &serverctrls) != SUCCESS) { return; } @@ -2140,23 +2902,39 @@ PHP_FUNCTION(ldap_compare) RETURN_FALSE; } + if (serverctrls) { + lserverctrls = _php_ldap_controls_from_array(ld->link, serverctrls); + if (lserverctrls == NULL) { + RETVAL_FALSE; + goto cleanup; + } + } + lvalue.bv_val = value; lvalue.bv_len = value_len; - errno = ldap_compare_ext_s(ld->link, dn, attr, &lvalue, NULL, NULL); + errno = ldap_compare_ext_s(ld->link, dn, attr, &lvalue, lserverctrls, NULL); switch (errno) { case LDAP_COMPARE_TRUE: - RETURN_TRUE; + RETVAL_TRUE; break; case LDAP_COMPARE_FALSE: - RETURN_FALSE; + RETVAL_FALSE; break; + + default: + php_error_docref(NULL, E_WARNING, "Compare: %s", ldap_err2string(errno)); + RETVAL_LONG(-1); + } + +cleanup: + if (lserverctrls) { + _php_ldap_controls_free(&lserverctrls); } - php_error_docref(NULL, E_WARNING, "Compare: %s", ldap_err2string(errno)); - RETURN_LONG(-1); + return; } /* }}} */ @@ -2346,9 +3124,7 @@ PHP_FUNCTION(ldap_get_option) case LDAP_OPT_SERVER_CONTROLS: case LDAP_OPT_CLIENT_CONTROLS: { - zval tmp1; - int num_entries; - LDAPControl **ctrls = NULL, **ctrlp; + LDAPControl **ctrls = NULL; if (ldap_get_option(ld->link, option, &ctrls) || ctrls == NULL) { if (ctrls) { @@ -2356,24 +3132,7 @@ PHP_FUNCTION(ldap_get_option) } RETURN_FALSE; } - - zval_ptr_dtor(retval); - array_init(retval); - num_entries = 0; - ctrlp = ctrls; - while (*ctrlp != NULL) - { - array_init(&tmp1); - add_assoc_string(&tmp1, "oid", (*ctrlp)->ldctl_oid); - add_assoc_bool(&tmp1, "iscritical", ((*ctrlp)->ldctl_iscritical != 0)); - if ((*ctrlp)->ldctl_value.bv_len) { - add_assoc_stringl(&tmp1, "value", (*ctrlp)->ldctl_value.bv_val, (*ctrlp)->ldctl_value.bv_len); - } - zend_hash_index_update(Z_ARRVAL_P(retval), num_entries, &tmp1); - num_entries++; - ctrlp++; - } - ldap_controls_free(ctrls); + _php_ldap_controls_to_array(ld->link, ctrls, retval, 1); } break; /* options not implemented case LDAP_OPT_API_INFO: @@ -2436,7 +3195,11 @@ PHP_FUNCTION(ldap_set_option) int val; convert_to_long_ex(newval); - val = Z_LVAL_P(newval); + if (ZEND_LONG_EXCEEDS_INT(Z_LVAL_P(newval))) { + php_error_docref(NULL, E_WARNING, "Option value is too big"); + RETURN_FALSE; + } + val = (int)Z_LVAL_P(newval); if (ldap_set_option(ldap, option, &val)) { RETURN_FALSE; } @@ -2535,62 +3298,24 @@ PHP_FUNCTION(ldap_set_option) case LDAP_OPT_SERVER_CONTROLS: case LDAP_OPT_CLIENT_CONTROLS: { - LDAPControl *ctrl, **ctrls, **ctrlp; - zval *ctrlval, *val; - int ncontrols; - char error=0; + LDAPControl **ctrls; + int rc; if (Z_TYPE_P(newval) != IS_ARRAY) { php_error_docref(NULL, E_WARNING, "Expected array value for this option"); RETURN_FALSE; } - ncontrols = zend_hash_num_elements(Z_ARRVAL_P(newval)); - ctrls = safe_emalloc((1 + ncontrols), sizeof(*ctrls), 0); - *ctrls = NULL; - ctrlp = ctrls; - ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(newval), ctrlval) { - if (Z_TYPE_P(ctrlval) != IS_ARRAY) { - php_error_docref(NULL, E_WARNING, "The array value must contain only arrays, where each array is a control"); - error = 1; - break; - } - if ((val = zend_hash_str_find(Z_ARRVAL_P(ctrlval), "oid", sizeof("oid") - 1)) == NULL) { - php_error_docref(NULL, E_WARNING, "Control must have an oid key"); - error = 1; - break; - } - ctrl = *ctrlp = emalloc(sizeof(**ctrlp)); - convert_to_string_ex(val); - ctrl->ldctl_oid = Z_STRVAL_P(val); - if ((val = zend_hash_str_find(Z_ARRVAL_P(ctrlval), "value", sizeof("value") - 1)) != NULL) { - convert_to_string_ex(val); - ctrl->ldctl_value.bv_val = Z_STRVAL_P(val); - ctrl->ldctl_value.bv_len = Z_STRLEN_P(val); - } else { - ctrl->ldctl_value.bv_val = NULL; - ctrl->ldctl_value.bv_len = 0; - } - if ((val = zend_hash_str_find(Z_ARRVAL_P(ctrlval), "iscritical", sizeof("iscritical") - 1)) != NULL) { - convert_to_boolean_ex(val); - ctrl->ldctl_iscritical = Z_TYPE_P(val) == IS_TRUE; - } else { - ctrl->ldctl_iscritical = 0; - } - ++ctrlp; - *ctrlp = NULL; - } ZEND_HASH_FOREACH_END(); - if (!error) { - error = ldap_set_option(ldap, option, ctrls); - } - ctrlp = ctrls; - while (*ctrlp) { - efree(*ctrlp); - ctrlp++; - } - efree(ctrls); - if (error) { + ctrls = _php_ldap_controls_from_array(ldap, newval); + + if (ctrls == NULL) { RETURN_FALSE; + } else { + rc = ldap_set_option(ldap, option, ctrls); + _php_ldap_controls_free(&ctrls); + if (rc != LDAP_SUCCESS) { + RETURN_FALSE; + } } } break; default: @@ -2601,18 +3326,19 @@ PHP_FUNCTION(ldap_set_option) /* }}} */ #ifdef HAVE_LDAP_PARSE_RESULT -/* {{{ proto bool ldap_parse_result(resource link, resource result, int errcode, string matcheddn, string errmsg, array referrals) +/* {{{ proto bool ldap_parse_result(resource link, resource result, int &errcode [, string &matcheddn [, string &errmsg [, array &referrals [, array &controls]]]]) Extract information from result */ PHP_FUNCTION(ldap_parse_result) { - zval *link, *result, *errcode, *matcheddn, *errmsg, *referrals; + zval *link, *result, *errcode, *matcheddn, *errmsg, *referrals, *serverctrls; ldap_linkdata *ld; LDAPMessage *ldap_result; + LDAPControl **lserverctrls = NULL, **ctrlp = NULL; char **lreferrals, **refp; char *lmatcheddn, *lerrmsg; - int rc, lerrcode, myargcount = ZEND_NUM_ARGS(); + int rc, lerrcode, myargcount = ZEND_NUM_ARGS(), ber_decode_error_count = -1; - if (zend_parse_parameters(ZEND_NUM_ARGS(), "rrz/|z/z/z/", &link, &result, &errcode, &matcheddn, &errmsg, &referrals) != SUCCESS) { + if (zend_parse_parameters(ZEND_NUM_ARGS(), "rrz/|z/z/z/z/", &link, &result, &errcode, &matcheddn, &errmsg, &referrals, &serverctrls) != SUCCESS) { return; } @@ -2628,7 +3354,7 @@ PHP_FUNCTION(ldap_parse_result) myargcount > 3 ? &lmatcheddn : NULL, myargcount > 4 ? &lerrmsg : NULL, myargcount > 5 ? &lreferrals : NULL, - NULL /* &serverctrls */, + myargcount > 6 ? &lserverctrls : NULL, 0); if (rc != LDAP_SUCCESS) { php_error_docref(NULL, E_WARNING, "Unable to parse result: %s", ldap_err2string(rc)); @@ -2640,6 +3366,8 @@ PHP_FUNCTION(ldap_parse_result) /* Reverse -> fall through */ switch (myargcount) { + case 7: + _php_ldap_controls_to_array(ld->link, lserverctrls, serverctrls, 0); case 6: zval_ptr_dtor(referrals); array_init(referrals); @@ -2841,18 +3569,21 @@ PHP_FUNCTION(ldap_parse_reference) /* }}} */ #endif -/* {{{ proto bool ldap_rename(resource link, string dn, string newrdn, string newparent, bool deleteoldrdn) - Modify the name of an entry */ -PHP_FUNCTION(ldap_rename) +/* {{{ php_ldap_do_rename + */ +static void php_ldap_do_rename(INTERNAL_FUNCTION_PARAMETERS, int ext) { + zval *serverctrls = NULL; zval *link; ldap_linkdata *ld; - int rc; + LDAPControl **lserverctrls = NULL; + LDAPMessage *ldap_res; + int rc, msgid; char *dn, *newrdn, *newparent; size_t dn_len, newrdn_len, newparent_len; zend_bool deleteoldrdn; - if (zend_parse_parameters(ZEND_NUM_ARGS(), "rsssb", &link, &dn, &dn_len, &newrdn, &newrdn_len, &newparent, &newparent_len, &deleteoldrdn) != SUCCESS) { + if (zend_parse_parameters(ZEND_NUM_ARGS(), "rsssb|a", &link, &dn, &dn_len, &newrdn, &newrdn_len, &newparent, &newparent_len, &deleteoldrdn, &serverctrls) != SUCCESS) { return; } @@ -2865,20 +3596,74 @@ PHP_FUNCTION(ldap_rename) } #if (LDAP_API_VERSION > 2000) || HAVE_NSLDAP || HAVE_ORALDAP - rc = ldap_rename_s(ld->link, dn, newrdn, newparent, deleteoldrdn, NULL, NULL); + if (serverctrls) { + lserverctrls = _php_ldap_controls_from_array(ld->link, serverctrls); + if (lserverctrls == NULL) { + RETVAL_FALSE; + goto cleanup; + } + } + + if (ext) { + rc = ldap_rename(ld->link, dn, newrdn, newparent, deleteoldrdn, lserverctrls, NULL, &msgid); + } else { + rc = ldap_rename_s(ld->link, dn, newrdn, newparent, deleteoldrdn, lserverctrls, NULL); + } #else if (newparent_len != 0) { php_error_docref(NULL, E_WARNING, "You are using old LDAP API, newparent must be the empty string, can only modify RDN"); RETURN_FALSE; } + if (serverctrls) { + php_error_docref(NULL, E_WARNING, "You are using old LDAP API, controls are not supported"); + RETURN_FALSE; + } + if (ext) { + php_error_docref(NULL, E_WARNING, "You are using old LDAP API, ldap_rename_ext is not supported"); + RETURN_FALSE; + } /* could support old APIs but need check for ldap_modrdn2()/ldap_modrdn() */ rc = ldap_modrdn2_s(ld->link, dn, newrdn, deleteoldrdn); #endif - if (rc == LDAP_SUCCESS) { - RETURN_TRUE; + if (rc != LDAP_SUCCESS) { + RETVAL_FALSE; + } else if (ext) { + rc = ldap_result(ld->link, msgid, 1 /* LDAP_MSG_ALL */, NULL, &ldap_res); + if (rc == -1) { + php_error_docref(NULL, E_WARNING, "Rename operation failed"); + RETVAL_FALSE; + goto cleanup; + } + + /* return a PHP control object */ + RETVAL_RES(zend_register_resource(ldap_res, le_result)); + } else { + RETVAL_TRUE; + } + +cleanup: + if (lserverctrls) { + _php_ldap_controls_free(&lserverctrls); } - RETURN_FALSE; + + return; +} +/* }}} */ + +/* {{{ proto bool ldap_rename(resource link, string dn, string newrdn, string newparent, bool deleteoldrdn [, array servercontrols]) + Modify the name of an entry */ +PHP_FUNCTION(ldap_rename) +{ + php_ldap_do_rename(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0); +} +/* }}} */ + +/* {{{ proto resource ldap_rename_ext(resource link, string dn, string newrdn, string newparent, bool deleteoldrdn [, array servercontrols]) + Modify the name of an entry */ +PHP_FUNCTION(ldap_rename_ext) +{ + php_ldap_do_rename(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1); } /* }}} */ @@ -3030,9 +3815,9 @@ static zend_string* php_ldap_do_escape(const zend_bool *map, const char *value, return ret; } -static void php_ldap_escape_map_set_chars(zend_bool *map, const char *chars, const int charslen, char escape) +static void php_ldap_escape_map_set_chars(zend_bool *map, const char *chars, const size_t charslen, char escape) { - int i = 0; + size_t i = 0; while (i < charslen) { map[(unsigned char) chars[i++]] = escape; } @@ -3326,107 +4111,121 @@ PHP_FUNCTION(ldap_control_paged_result_response) Extended operation */ PHP_FUNCTION(ldap_exop) { - zval *servercontrols; - zval *link, *reqoid, *reqdata, *retdata, *retoid; - char *lreqoid, *lretoid = NULL; + zval *serverctrls = NULL; + zval *link, *retdata = NULL, *retoid = NULL; + char *lretoid = NULL; + zend_string *reqoid, *reqdata = NULL; struct berval lreqdata, *lretdata = NULL; ldap_linkdata *ld; LDAPMessage *ldap_res; - int rc, msgid, myargcount = ZEND_NUM_ARGS(); - /* int reqoid_len, reqdata_len, retdata_len, retoid_len, retdat_len; */ + LDAPControl **lserverctrls = NULL; + int rc, msgid; - if (zend_parse_parameters(ZEND_NUM_ARGS(), "rz|zzz/z/", &link, &reqoid, &reqdata, &servercontrols, &retdata, &retoid) != SUCCESS) { - WRONG_PARAM_COUNT; + if (zend_parse_parameters(ZEND_NUM_ARGS(), "rS|S!a!z/z/", &link, &reqoid, &reqdata, &serverctrls, &retdata, &retoid) != SUCCESS) { + return; } if ((ld = (ldap_linkdata *)zend_fetch_resource(Z_RES_P(link), "ldap link", le_link)) == NULL) { RETURN_FALSE; } - switch (myargcount) { - case 6: - case 5: - case 4: - case 3: - convert_to_string_ex(reqdata); - lreqdata.bv_val = Z_STRVAL_P(reqdata); - lreqdata.bv_len = Z_STRLEN_P(reqdata); - /* fallthru */ - case 2: - convert_to_string_ex(reqoid); - lreqoid = Z_STRVAL_P(reqoid); + if (reqdata) { + lreqdata.bv_val = ZSTR_VAL(reqdata); + lreqdata.bv_len = ZSTR_LEN(reqdata); + } else { + lreqdata.bv_len = 0; } - if (myargcount > 4) { + if (serverctrls) { + lserverctrls = _php_ldap_controls_from_array(ld->link, serverctrls); + if (lserverctrls == NULL) { + RETVAL_FALSE; + goto cleanup; + } + } + + if (retdata) { /* synchronous call */ - rc = ldap_extended_operation_s(ld->link, lreqoid, + rc = ldap_extended_operation_s(ld->link, ZSTR_VAL(reqoid), lreqdata.bv_len > 0 ? &lreqdata: NULL, + lserverctrls, NULL, - NULL, - myargcount > 5 ? &lretoid : NULL, + retoid ? &lretoid : NULL, &lretdata ); if (rc != LDAP_SUCCESS ) { - php_error_docref(NULL, E_WARNING, "Extended operation %s failed: %s (%d)", lreqoid, ldap_err2string(rc), rc); - RETURN_FALSE; + php_error_docref(NULL, E_WARNING, "Extended operation %s failed: %s (%d)", ZSTR_VAL(reqoid), ldap_err2string(rc), rc); + RETVAL_FALSE; + goto cleanup; } - /* Reverse -> fall through */ - switch (myargcount) { - case 6: - zval_dtor(retoid); - if (lretoid == NULL) { - ZVAL_EMPTY_STRING(retoid); - } else { - ZVAL_STRING(retoid, lretoid); - ldap_memfree(lretoid); - } - case 5: - /* use arg #5 as the data returned by the server */ - zval_dtor(retdata); - if (lretdata == NULL) { - ZVAL_EMPTY_STRING(retdata); - } else { - ZVAL_STRINGL(retdata, lretdata->bv_val, lretdata->bv_len); - ldap_memfree(lretdata->bv_val); - ldap_memfree(lretdata); - } + if (retoid) { + zval_dtor(retoid); + if (lretoid) { + ZVAL_STRING(retoid, lretoid); + ldap_memfree(lretoid); + } else { + ZVAL_EMPTY_STRING(retoid); + } } - RETURN_TRUE; + zval_dtor(retdata); + if (lretdata) { + ZVAL_STRINGL(retdata, lretdata->bv_val, lretdata->bv_len); + ldap_memfree(lretdata->bv_val); + ldap_memfree(lretdata); + } else { + ZVAL_EMPTY_STRING(retdata); + } + + RETVAL_TRUE; + goto cleanup; } /* asynchronous call */ - rc = ldap_extended_operation(ld->link, lreqoid, + rc = ldap_extended_operation(ld->link, ZSTR_VAL(reqoid), lreqdata.bv_len > 0 ? &lreqdata: NULL, - NULL, NULL, &msgid); + lserverctrls, + NULL, + &msgid); if (rc != LDAP_SUCCESS ) { - php_error_docref(NULL, E_WARNING, "Extended operation %s failed: %s (%d)", lreqoid, ldap_err2string(rc), rc); - RETURN_FALSE; + php_error_docref(NULL, E_WARNING, "Extended operation %s failed: %s (%d)", ZSTR_VAL(reqoid), ldap_err2string(rc), rc); + RETVAL_FALSE; + goto cleanup; } rc = ldap_result(ld->link, msgid, 1 /* LDAP_MSG_ALL */, NULL, &ldap_res); if (rc == -1) { - php_error_docref(NULL, E_WARNING, "Extended operation %s failed", lreqoid); - RETURN_FALSE; + php_error_docref(NULL, E_WARNING, "Extended operation %s failed", ZSTR_VAL(reqoid)); + RETVAL_FALSE; + goto cleanup; } /* return a PHP control object */ RETVAL_RES(zend_register_resource(ldap_res, le_result)); + + cleanup: + if (lserverctrls) { + _php_ldap_controls_free(&lserverctrls); + } } /* }}} */ #endif -#ifdef HAVE_LDAP_PASSWD_S -/* {{{ proto bool|string ldap_exop_passwd(resource link [, string user [, string oldpw [, string newpw ]]]) +#ifdef HAVE_LDAP_PASSWD +/* {{{ proto bool|string ldap_exop_passwd(resource link [, string user [, string oldpw [, string newpw [, array ctrls]]]]) Passwd modify extended operation */ PHP_FUNCTION(ldap_exop_passwd) { - zval *link, *user, *newpw, *oldpw; + zval *link, *user, *newpw, *oldpw, *serverctrls; struct berval luser, loldpw, lnewpw, lgenpasswd; + LDAPControl **lserverctrls = NULL, **requestctrls = NULL; + LDAPControl *ctrl, **ctrlp; + LDAPMessage* ldap_res; ldap_linkdata *ld; - int rc, myargcount = ZEND_NUM_ARGS(); + int rc, myargcount = ZEND_NUM_ARGS(), msgid, err; + char* errmsg; - if (zend_parse_parameters(ZEND_NUM_ARGS(), "r|zzz", &link, &user, &oldpw, &newpw) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS(), "r|zzzz/", &link, &user, &oldpw, &newpw, &serverctrls) == FAILURE) { WRONG_PARAM_COUNT; } @@ -3439,6 +4238,17 @@ PHP_FUNCTION(ldap_exop_passwd) lnewpw.bv_len = 0; switch (myargcount) { + case 5: + requestctrls = safe_emalloc(2, sizeof(*requestctrls), 0); + *requestctrls = NULL; + ctrlp = requestctrls; + + if (ldap_create_passwordpolicy_control(ld->link, &ctrl) == LDAP_SUCCESS) { + *ctrlp = ctrl; + ++ctrlp; + } + + *ctrlp = NULL; case 4: convert_to_string_ex(newpw); lnewpw.bv_val = Z_STRVAL_P(newpw); @@ -3455,24 +4265,52 @@ PHP_FUNCTION(ldap_exop_passwd) luser.bv_len = Z_STRLEN_P(user); } - /* synchronous call */ - rc = ldap_passwd_s(ld->link, &luser, + /* asynchronous call to get result and controls */ + rc = ldap_passwd(ld->link, &luser, loldpw.bv_len > 0 ? &loldpw : NULL, lnewpw.bv_len > 0 ? &lnewpw : NULL, - &lgenpasswd, NULL, NULL); + requestctrls, + NULL, &msgid); if (rc != LDAP_SUCCESS ) { php_error_docref(NULL, E_WARNING, "Passwd modify extended operation failed: %s (%d)", ldap_err2string(rc), rc); RETURN_FALSE; } + rc = ldap_result(ld->link, msgid, 1 /* LDAP_MSG_ALL */, NULL, &ldap_res); + if ((rc < 0) || !ldap_res) { + rc = _get_lderrno(ld->link); + php_error_docref(NULL, E_WARNING, "Passwd modify extended operation failed: %s (%d)", ldap_err2string(rc), rc); + RETURN_FALSE; + } + + rc = ldap_parse_passwd(ld->link, ldap_res, &lgenpasswd); + if( rc != LDAP_SUCCESS ) { + php_error_docref(NULL, E_WARNING, "Passwd modify extended operation failed: %s (%d)", ldap_err2string(rc), rc); + ldap_msgfree(ldap_res); + RETURN_FALSE; + } + + rc = ldap_parse_result(ld->link, ldap_res, &err, NULL, &errmsg, NULL, (myargcount > 4 ? &lserverctrls : NULL), 1); + if( rc != LDAP_SUCCESS ) { + php_error_docref(NULL, E_WARNING, "Passwd modify extended operation failed: %s (%d)", ldap_err2string(rc), rc); + RETURN_FALSE; + } + if (lnewpw.bv_len == 0) { if (lgenpasswd.bv_len == 0) { RETVAL_EMPTY_STRING(); } else { RETVAL_STRINGL(lgenpasswd.bv_val, lgenpasswd.bv_len); } + } else if (err == LDAP_SUCCESS) { + RETVAL_TRUE; } else { - RETURN_TRUE; + php_error_docref(NULL, E_WARNING, "Passwd modify extended operation failed: %s (%d)", (errmsg ? errmsg : ldap_err2string(err)), err); + RETVAL_FALSE; + } + + if (myargcount > 4) { + _php_ldap_controls_to_array(ld->link, lserverctrls, serverctrls, 0); } ldap_memfree(lgenpasswd.bv_val); @@ -3515,7 +4353,44 @@ PHP_FUNCTION(ldap_exop_whoami) } /* }}} */ #endif + +#ifdef HAVE_LDAP_REFRESH_S +/* {{{ proto bool|int ldap_exop_refresh(resource link , string dn , int ttl) + DDS refresh extended operation */ +PHP_FUNCTION(ldap_exop_refresh) +{ + zval *link, *dn, *ttl; + struct berval ldn; + ber_int_t lttl; + ber_int_t newttl; + ldap_linkdata *ld; + int rc; + + if (zend_parse_parameters(ZEND_NUM_ARGS(), "rzz", &link, &dn, &ttl) != SUCCESS) { + WRONG_PARAM_COUNT; + } + + if ((ld = (ldap_linkdata *)zend_fetch_resource(Z_RES_P(link), "ldap link", le_link)) == NULL) { + RETURN_FALSE; + } + + convert_to_string_ex(dn); + ldn.bv_val = Z_STRVAL_P(dn); + ldn.bv_len = Z_STRLEN_P(dn); + + convert_to_long_ex(ttl); + lttl = (ber_int_t)Z_LVAL_P(ttl); + + rc = ldap_refresh_s(ld->link, &ldn, lttl, &newttl, NULL, NULL); + if (rc != LDAP_SUCCESS ) { + php_error_docref(NULL, E_WARNING, "Refresh extended operation failed: %s (%d)", ldap_err2string(rc), rc); + RETURN_FALSE; + } + + RETURN_LONG(newttl); +} /* }}} */ +#endif /* }}} */ @@ -3540,6 +4415,13 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_bind, 0, 0, 1) ZEND_ARG_INFO(0, bind_password) ZEND_END_ARG_INFO() +ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_bind_ext, 0, 0, 1) + ZEND_ARG_INFO(0, link_identifier) + ZEND_ARG_INFO(0, bind_rdn) + ZEND_ARG_INFO(0, bind_password) + ZEND_ARG_INFO(0, servercontrols) +ZEND_END_ARG_INFO() + #ifdef HAVE_LDAP_SASL ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_sasl_bind, 0, 0, 1) ZEND_ARG_INFO(0, link) @@ -3561,6 +4443,7 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_read, 0, 0, 3) ZEND_ARG_INFO(0, sizelimit) ZEND_ARG_INFO(0, timelimit) ZEND_ARG_INFO(0, deref) + ZEND_ARG_INFO(0, servercontrols) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_list, 0, 0, 3) @@ -3572,6 +4455,7 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_list, 0, 0, 3) ZEND_ARG_INFO(0, sizelimit) ZEND_ARG_INFO(0, timelimit) ZEND_ARG_INFO(0, deref) + ZEND_ARG_INFO(0, servercontrols) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_search, 0, 0, 3) @@ -3583,6 +4467,7 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_search, 0, 0, 3) ZEND_ARG_INFO(0, sizelimit) ZEND_ARG_INFO(0, timelimit) ZEND_ARG_INFO(0, deref) + ZEND_ARG_INFO(0, servercontrols) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_count_entries, 0, 0, 2) @@ -3650,41 +4535,82 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_add, 0, 0, 3) ZEND_ARG_INFO(0, link_identifier) ZEND_ARG_INFO(0, dn) ZEND_ARG_INFO(0, entry) + ZEND_ARG_INFO(0, servercontrols) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_add_ext, 0, 0, 3) + ZEND_ARG_INFO(0, link_identifier) + ZEND_ARG_INFO(0, dn) + ZEND_ARG_INFO(0, entry) + ZEND_ARG_INFO(0, servercontrols) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_delete, 0, 0, 2) ZEND_ARG_INFO(0, link_identifier) ZEND_ARG_INFO(0, dn) + ZEND_ARG_INFO(0, servercontrols) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_delete_ext, 0, 0, 2) + ZEND_ARG_INFO(0, link_identifier) + ZEND_ARG_INFO(0, dn) + ZEND_ARG_INFO(0, servercontrols) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_modify, 0, 0, 3) ZEND_ARG_INFO(0, link_identifier) ZEND_ARG_INFO(0, dn) ZEND_ARG_INFO(0, entry) + ZEND_ARG_INFO(0, servercontrols) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_modify_batch, 0, 0, 3) ZEND_ARG_INFO(0, link_identifier) ZEND_ARG_INFO(0, dn) ZEND_ARG_ARRAY_INFO(0, modifications_info, 0) + ZEND_ARG_INFO(0, servercontrols) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_mod_add, 0, 0, 3) ZEND_ARG_INFO(0, link_identifier) ZEND_ARG_INFO(0, dn) ZEND_ARG_INFO(0, entry) + ZEND_ARG_INFO(0, servercontrols) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_mod_add_ext, 0, 0, 3) + ZEND_ARG_INFO(0, link_identifier) + ZEND_ARG_INFO(0, dn) + ZEND_ARG_INFO(0, entry) + ZEND_ARG_INFO(0, servercontrols) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_mod_replace, 0, 0, 3) ZEND_ARG_INFO(0, link_identifier) ZEND_ARG_INFO(0, dn) ZEND_ARG_INFO(0, entry) + ZEND_ARG_INFO(0, servercontrols) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_mod_replace_ext, 0, 0, 3) + ZEND_ARG_INFO(0, link_identifier) + ZEND_ARG_INFO(0, dn) + ZEND_ARG_INFO(0, entry) + ZEND_ARG_INFO(0, servercontrols) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_mod_del, 0, 0, 3) ZEND_ARG_INFO(0, link_identifier) ZEND_ARG_INFO(0, dn) ZEND_ARG_INFO(0, entry) + ZEND_ARG_INFO(0, servercontrols) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_mod_del_ext, 0, 0, 3) + ZEND_ARG_INFO(0, link_identifier) + ZEND_ARG_INFO(0, dn) + ZEND_ARG_INFO(0, entry) + ZEND_ARG_INFO(0, servercontrols) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_err2str, 0, 0, 1) @@ -3696,6 +4622,7 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_compare, 0, 0, 4) ZEND_ARG_INFO(0, dn) ZEND_ARG_INFO(0, attribute) ZEND_ARG_INFO(0, value) + ZEND_ARG_INFO(0, servercontrols) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_sort, 0, 0, 3) @@ -3727,6 +4654,16 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_rename, 0, 0, 5) ZEND_ARG_INFO(0, newrdn) ZEND_ARG_INFO(0, newparent) ZEND_ARG_INFO(0, deleteoldrdn) + ZEND_ARG_INFO(0, servercontrols) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_rename_ext, 0, 0, 5) + ZEND_ARG_INFO(0, link_identifier) + ZEND_ARG_INFO(0, dn) + ZEND_ARG_INFO(0, newrdn) + ZEND_ARG_INFO(0, newparent) + ZEND_ARG_INFO(0, deleteoldrdn) + ZEND_ARG_INFO(0, servercontrols) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_get_option, 0, 0, 3) @@ -3768,6 +4705,7 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_parse_result, 0, 0, 3) ZEND_ARG_INFO(1, matcheddn) ZEND_ARG_INFO(1, errmsg) ZEND_ARG_INFO(1, referrals) + ZEND_ARG_INFO(1, serverctrls) ZEND_END_ARG_INFO() #endif #endif @@ -3806,12 +4744,13 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_exop, 0, 0, 2) ZEND_END_ARG_INFO() #endif -#ifdef HAVE_LDAP_PASSWD_S -ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_exop_passwd, 0, 0, 4) +#ifdef HAVE_LDAP_PASSWD +ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_exop_passwd, 0, 0, 1) ZEND_ARG_INFO(0, link) ZEND_ARG_INFO(0, user) ZEND_ARG_INFO(0, oldpw) ZEND_ARG_INFO(0, newpw) + ZEND_ARG_INFO(1, serverctrls) ZEND_END_ARG_INFO() #endif @@ -3821,6 +4760,14 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_exop_whoami, 0, 0, 1) ZEND_END_ARG_INFO() #endif +#ifdef HAVE_LDAP_REFRESH_S +ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_exop_refresh, 0, 0, 3) + ZEND_ARG_INFO(0, link) + ZEND_ARG_INFO(0, dn) + ZEND_ARG_INFO(0, ttl) +ZEND_END_ARG_INFO() +#endif + #ifdef HAVE_LDAP_PARSE_EXTENDED_RESULT ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_parse_exop, 0, 0, 4) ZEND_ARG_INFO(0, link) @@ -3841,6 +4788,7 @@ const zend_function_entry ldap_functions[] = { PHP_FE(ldap_connect, arginfo_ldap_connect) PHP_FALIAS(ldap_close, ldap_unbind, arginfo_ldap_resource) PHP_FE(ldap_bind, arginfo_ldap_bind) + PHP_FE(ldap_bind_ext, arginfo_ldap_bind_ext) #ifdef HAVE_LDAP_SASL PHP_FE(ldap_sasl_bind, arginfo_ldap_sasl_bind) #endif @@ -3862,14 +4810,19 @@ const zend_function_entry ldap_functions[] = { PHP_FE(ldap_explode_dn, arginfo_ldap_explode_dn) PHP_FE(ldap_dn2ufn, arginfo_ldap_dn2ufn) PHP_FE(ldap_add, arginfo_ldap_add) + PHP_FE(ldap_add_ext, arginfo_ldap_add_ext) PHP_FE(ldap_delete, arginfo_ldap_delete) + PHP_FE(ldap_delete_ext, arginfo_ldap_delete_ext) PHP_FE(ldap_modify_batch, arginfo_ldap_modify_batch) PHP_FALIAS(ldap_modify, ldap_mod_replace, arginfo_ldap_modify) /* additional functions for attribute based modifications, Gerrit Thomson */ PHP_FE(ldap_mod_add, arginfo_ldap_mod_add) + PHP_FE(ldap_mod_add_ext, arginfo_ldap_mod_add_ext) PHP_FE(ldap_mod_replace, arginfo_ldap_mod_replace) + PHP_FE(ldap_mod_replace_ext, arginfo_ldap_mod_replace_ext) PHP_FE(ldap_mod_del, arginfo_ldap_mod_del) + PHP_FE(ldap_mod_del_ext, arginfo_ldap_mod_del_ext) /* end gjt mod */ PHP_FE(ldap_errno, arginfo_ldap_resource) @@ -3880,6 +4833,7 @@ const zend_function_entry ldap_functions[] = { #if (LDAP_API_VERSION > 2000) || HAVE_NSLDAP || HAVE_ORALDAP PHP_FE(ldap_rename, arginfo_ldap_rename) + PHP_FE(ldap_rename_ext, arginfo_ldap_rename_ext) PHP_FE(ldap_get_option, arginfo_ldap_get_option) PHP_FE(ldap_set_option, arginfo_ldap_set_option) PHP_FE(ldap_first_reference, arginfo_ldap_first_reference) @@ -3896,12 +4850,15 @@ const zend_function_entry ldap_functions[] = { #ifdef HAVE_LDAP_EXTENDED_OPERATION_S PHP_FE(ldap_exop, arginfo_ldap_exop) #endif -#ifdef HAVE_LDAP_PASSWD_S +#ifdef HAVE_LDAP_PASSWD PHP_FE(ldap_exop_passwd, arginfo_ldap_exop_passwd) #endif #ifdef HAVE_LDAP_WHOAMI_S PHP_FE(ldap_exop_whoami, arginfo_ldap_exop_whoami) #endif +#ifdef HAVE_LDAP_REFRESH_S + PHP_FE(ldap_exop_refresh, arginfo_ldap_exop_refresh) +#endif #ifdef HAVE_LDAP_PARSE_EXTENDED_RESULT PHP_FE(ldap_parse_exop, arginfo_ldap_parse_exop) #endif diff --git a/ext/ldap/tests/connect.inc b/ext/ldap/tests/connect.inc index 1c2205056eb38..b6366c02ac788 100644 --- a/ext/ldap/tests/connect.inc +++ b/ext/ldap/tests/connect.inc @@ -69,6 +69,13 @@ function insert_dummy_data($link, $base) { "sn" => "testSN3", "userPassword" => "0r1g1na1 passw0rd", )); + ldap_add($link, "o=test2,$base", array( + "objectClass" => array( + "top", + "organization"), + "o" => "test2", + "l" => array("here", "there", "Antarctica"), + )); } function remove_dummy_data($link, $base) { @@ -76,5 +83,6 @@ function remove_dummy_data($link, $base) { ldap_delete($link, "cn=userA,$base"); ldap_delete($link, "cn=userB,$base"); ldap_delete($link, "o=test,$base"); + ldap_delete($link, "o=test2,$base"); } ?> diff --git a/ext/ldap/tests/ldap_add_error.phpt b/ext/ldap/tests/ldap_add_error.phpt index a53277da80908..533496a4b2d71 100644 --- a/ext/ldap/tests/ldap_add_error.phpt +++ b/ext/ldap/tests/ldap_add_error.phpt @@ -18,7 +18,7 @@ var_dump(ldap_add($link)); var_dump(ldap_add($link, "$base")); // Too many parameters -var_dump(ldap_add($link, "$base", array(), "Additional data")); +var_dump(ldap_add($link, "$base", array(), [], "Additional data")); var_dump(ldap_add($link, "$base", array())); @@ -97,16 +97,16 @@ $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); ldap_delete($link, "dc=my-domain,$base"); ?> --EXPECTF-- -Warning: ldap_add() expects exactly 3 parameters, 0 given in %s on line %d +Warning: ldap_add() expects at least 3 parameters, 0 given in %s on line %d NULL -Warning: ldap_add() expects exactly 3 parameters, 1 given in %s on line %d +Warning: ldap_add() expects at least 3 parameters, 1 given in %s on line %d NULL -Warning: ldap_add() expects exactly 3 parameters, 2 given in %s on line %d +Warning: ldap_add() expects at least 3 parameters, 2 given in %s on line %d NULL -Warning: ldap_add() expects exactly 3 parameters, 4 given in %s on line %d +Warning: ldap_add() expects at most 4 parameters, 5 given in %s on line %d NULL Warning: ldap_add(): Add: Protocol error in %s on line %d diff --git a/ext/ldap/tests/ldap_add_ext.phpt b/ext/ldap/tests/ldap_add_ext.phpt new file mode 100644 index 0000000000000..12916d98c3ca4 --- /dev/null +++ b/ext/ldap/tests/ldap_add_ext.phpt @@ -0,0 +1,94 @@ +--TEST-- +ldap_add_ext() - Add operation with controls +--CREDITS-- +Côme Chilliet +--SKIPIF-- + + + +--FILE-- + array( + "top", + "organization"), + "o" => "test_ldap_add_ext", + ), [['oid' => LDAP_CONTROL_POST_READ, 'iscritical' => TRUE, 'value' => ['attrs' => ['o']]]]), + ldap_parse_result($link, $result, $errcode, $matcheddn, $errmsg, $referrals, $ctrls), + $errcode, + $errmsg, + $ctrls[LDAP_CONTROL_POST_READ], + ldap_get_entries( + $link, + ldap_search($link, "$base", "(o=test_ldap_add_ext)") + ) +); +?> +===DONE=== +--CLEAN-- + +--EXPECTF-- +resource(%d) of type (ldap result) +bool(true) +int(0) +string(0) "" +array(2) { + ["oid"]=> + string(14) "1.3.6.1.1.13.2" + ["value"]=> + array(2) { + ["dn"]=> + string(%d) "o=test_ldap_add_ext,%s" + ["o"]=> + array(1) { + [0]=> + string(17) "test_ldap_add_ext" + } + } +} +array(2) { + ["count"]=> + int(1) + [0]=> + array(6) { + ["objectclass"]=> + array(3) { + ["count"]=> + int(2) + [0]=> + string(3) "top" + [1]=> + string(12) "organization" + } + [0]=> + string(11) "objectclass" + ["o"]=> + array(2) { + ["count"]=> + int(1) + [0]=> + string(17) "test_ldap_add_ext" + } + [1]=> + string(1) "o" + ["count"]=> + int(2) + ["dn"]=> + string(%d) "o=test_ldap_add_ext,%s" + } +} +===DONE=== diff --git a/ext/ldap/tests/ldap_bind_ext.phpt b/ext/ldap/tests/ldap_bind_ext.phpt new file mode 100644 index 0000000000000..3a9ca415bde4b --- /dev/null +++ b/ext/ldap/tests/ldap_bind_ext.phpt @@ -0,0 +1,72 @@ +--TEST-- +ldap_bind_ext() - Basic binding +--CREDITS-- +Côme Chilliet +--SKIPIF-- + + + +--FILE-- + LDAP_CONTROL_PASSWORDPOLICYREQUEST]]), + ldap_parse_result($link, $result, $errcode, $matcheddn, $errmsg, $referrals, $ctrls), + $errcode, + $errmsg, + $ctrls +); + +/* Failures */ +var_dump( + $result = ldap_bind_ext($link, $user, "wrongPassword", [['oid' => LDAP_CONTROL_PASSWORDPOLICYREQUEST]]), + ldap_parse_result($link, $result, $errcode, $matcheddn, $errmsg, $referrals, $ctrls), + $errcode, + $errmsg, + $ctrls, + $result = ldap_bind_ext($link, "unexistingProperty=weirdValue,$user", $passwd, [['oid' => LDAP_CONTROL_PASSWORDPOLICYREQUEST]]), + ldap_parse_result($link, $result, $errcode, $matcheddn, $errmsg, $referrals, $ctrls), + $errcode, + $errmsg, + $ctrls +); +?> +===DONE=== +--EXPECTF-- +resource(%d) of type (ldap result) +bool(true) +int(0) +string(0) "" +array(0) { +} +resource(%d) of type (ldap result) +bool(true) +int(0) +string(0) "" +array(0) { +} +resource(%d) of type (ldap result) +bool(true) +int(49) +string(0) "" +array(0) { +} +resource(%d) of type (ldap result) +bool(true) +int(34) +string(10) "invalid DN" +array(0) { +} +===DONE=== diff --git a/ext/ldap/tests/ldap_compare_error.phpt b/ext/ldap/tests/ldap_compare_error.phpt index 07393f6de657c..120dfab0595f0 100644 --- a/ext/ldap/tests/ldap_compare_error.phpt +++ b/ext/ldap/tests/ldap_compare_error.phpt @@ -19,7 +19,7 @@ var_dump(ldap_compare($link, $link)); var_dump(ldap_compare($link, $link, $link)); // Too many parameters -var_dump(ldap_compare($link, $link, $link, $link, "Additional data")); +var_dump(ldap_compare($link, $link, $link, $link, [], "Additional data")); var_dump( ldap_compare($link, "cn=userNotAvailable,$base", "sn", "testSN1"), @@ -36,16 +36,16 @@ $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); remove_dummy_data($link, $base); ?> --EXPECTF-- -Warning: ldap_compare() expects exactly 4 parameters, 1 given in %s on line %d +Warning: ldap_compare() expects at least 4 parameters, 1 given in %s on line %d NULL -Warning: ldap_compare() expects exactly 4 parameters, 2 given in %s on line %d +Warning: ldap_compare() expects at least 4 parameters, 2 given in %s on line %d NULL -Warning: ldap_compare() expects exactly 4 parameters, 3 given in %s on line %d +Warning: ldap_compare() expects at least 4 parameters, 3 given in %s on line %d NULL -Warning: ldap_compare() expects exactly 4 parameters, 5 given in %s on line %d +Warning: ldap_compare() expects at most 5 parameters, 6 given in %s on line %d NULL Warning: ldap_compare(): Compare: No such object in %s on line %d diff --git a/ext/ldap/tests/ldap_controls.phpt b/ext/ldap/tests/ldap_controls.phpt new file mode 100644 index 0000000000000..8a9c8f9f2227c --- /dev/null +++ b/ext/ldap/tests/ldap_controls.phpt @@ -0,0 +1,162 @@ +--TEST-- +Test the use of controls +--CREDITS-- +Côme Chilliet +--SKIPIF-- + +--FILE-- + LDAP_CONTROL_ASSERT, 'iscritical' => TRUE, 'value' => ['filter' => '(objectClass=organization)']]]), + ldap_get_entries($link, $result), + $result = ldap_search($link, "o=test,$base", "objectClass=*", array('o'), 0, 0, 0, LDAP_DEREF_NEVER, + [['oid' => LDAP_CONTROL_ASSERT, 'iscritical' => TRUE, 'value' => ['filter' => '(objectClass=organizationalUnit)']]]), + ldap_modify($link, "o=test,$base", ['description' => 'desc'], + [['oid' => LDAP_CONTROL_ASSERT, 'iscritical' => TRUE, 'value' => ['filter' => '(!(description=*))']]]), + $result = ldap_read($link, "o=test,$base", "objectClass=*", array('description')), + ldap_get_entries($link, $result), + ldap_modify($link, "o=test,$base", ['description' => 'desc2'], + [['oid' => LDAP_CONTROL_ASSERT, 'iscritical' => TRUE, 'value' => ['filter' => '(!(description=*))']]]), + $result = ldap_read($link, "o=test,$base", "objectClass=*", array('description')), + ldap_get_entries($link, $result), + ldap_delete($link, "o=test,$base", [['oid' => LDAP_CONTROL_ASSERT, 'iscritical' => TRUE, 'value' => ['filter' => '(description=desc2)']]]), + ldap_errno($link), + ldap_error($link), + ldap_rename($link, "o=test,$base", "o=test2", "", TRUE, [['oid' => LDAP_CONTROL_ASSERT, 'iscritical' => TRUE, 'value' => ['filter' => '(description=desc2)']]]), + ldap_compare($link, "o=test,$base", "o", "test"), + ldap_compare($link, "o=test,$base", "o", "test", [['oid' => LDAP_CONTROL_ASSERT, 'iscritical' => TRUE, 'value' => ['filter' => '(description=desc2)']]]), + ldap_compare($link, "o=test,$base", "o", "test", [['oid' => LDAP_CONTROL_ASSERT, 'iscritical' => TRUE, 'value' => ['filter' => '(description=desc)']]]) +); + +/* Test valuesreturnfilter control */ +var_dump( + $result = ldap_read($link, "o=test2,$base", "objectClass=*", ["l"]), + ldap_get_entries($link, $result)[0]['l'], + $result = ldap_read($link, "o=test2,$base", "objectClass=*", ["l"], 0, 0, 0, LDAP_DEREF_NEVER, + [['oid' => LDAP_CONTROL_VALUESRETURNFILTER, 'iscritical' => TRUE, 'value' => ['filter' => '(l=*here)']]]), + ldap_get_entries($link, $result)[0]['l'] +); +?> +===DONE=== +--CLEAN-- + +--EXPECTF-- +Warning: ldap_search(): Search: Assertion Failed in %s on line %d + +Warning: ldap_modify(): Modify: Assertion Failed in %s on line %d + +Warning: ldap_delete(): Delete: Assertion Failed in %s on line %d + +Warning: ldap_compare(): Compare: Assertion Failed in %s on line %d +resource(%d) of type (ldap result) +array(2) { + ["count"]=> + int(1) + [0]=> + array(4) { + ["o"]=> + array(2) { + ["count"]=> + int(1) + [0]=> + string(4) "test" + } + [0]=> + string(1) "o" + ["count"]=> + int(1) + ["dn"]=> + string(%d) "o=test,%s" + } +} +bool(false) +bool(true) +resource(%d) of type (ldap result) +array(2) { + ["count"]=> + int(1) + [0]=> + array(4) { + ["description"]=> + array(2) { + ["count"]=> + int(1) + [0]=> + string(4) "desc" + } + [0]=> + string(11) "description" + ["count"]=> + int(1) + ["dn"]=> + string(%d) "o=test,%s" + } +} +bool(false) +resource(%d) of type (ldap result) +array(2) { + ["count"]=> + int(1) + [0]=> + array(4) { + ["description"]=> + array(2) { + ["count"]=> + int(1) + [0]=> + string(4) "desc" + } + [0]=> + string(11) "description" + ["count"]=> + int(1) + ["dn"]=> + string(%d) "o=test,%s" + } +} +bool(false) +int(122) +string(16) "Assertion Failed" +bool(false) +bool(true) +int(-1) +bool(true) +resource(%d) of type (ldap result) +array(4) { + ["count"]=> + int(3) + [0]=> + string(4) "here" + [1]=> + string(5) "there" + [2]=> + string(10) "Antarctica" +} +resource(%d) of type (ldap result) +array(3) { + ["count"]=> + int(2) + [0]=> + string(4) "here" + [1]=> + string(5) "there" +} +===DONE=== diff --git a/ext/ldap/tests/ldap_delete_error.phpt b/ext/ldap/tests/ldap_delete_error.phpt index 1d160f1074f61..a34d7b39fe5e7 100644 --- a/ext/ldap/tests/ldap_delete_error.phpt +++ b/ext/ldap/tests/ldap_delete_error.phpt @@ -17,7 +17,7 @@ var_dump(ldap_delete()); var_dump(ldap_delete($link)); // Too many parameters -var_dump(ldap_delete($link, "$base", "Additional data")); +var_dump(ldap_delete($link, "$base", [], "Additional data")); // Invalid DN var_dump( @@ -41,13 +41,13 @@ require "connect.inc"; $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); ?> --EXPECTF-- -Warning: ldap_delete() expects exactly 2 parameters, 0 given in %s on line %d +Warning: ldap_delete() expects at least 2 parameters, 0 given in %s on line %d NULL -Warning: ldap_delete() expects exactly 2 parameters, 1 given in %s on line %d +Warning: ldap_delete() expects at least 2 parameters, 1 given in %s on line %d NULL -Warning: ldap_delete() expects exactly 2 parameters, 3 given in %s on line %d +Warning: ldap_delete() expects at most 3 parameters, 4 given in %s on line %d NULL Warning: ldap_delete(): Delete: Invalid DN syntax in %s on line %d diff --git a/ext/ldap/tests/ldap_delete_ext.phpt b/ext/ldap/tests/ldap_delete_ext.phpt new file mode 100644 index 0000000000000..c4d0264088708 --- /dev/null +++ b/ext/ldap/tests/ldap_delete_ext.phpt @@ -0,0 +1,71 @@ +--TEST-- +ldap_delete_ext() - Delete operation with controls +--CREDITS-- +Côme Chilliet +--SKIPIF-- + + + +--FILE-- + array( + "top", + "dcObject", + "organization"), + "dc" => "my-domain", + "o" => "my-domain", +)); + +var_dump( + $result = ldap_delete_ext($link, "dc=my-domain,$base", + [['oid' => LDAP_CONTROL_PRE_READ, 'iscritical' => TRUE, 'value' => ['attrs' => ['dc', 'o']]]] + ), + ldap_parse_result($link, $result, $errcode, $matcheddn, $errmsg, $referrals, $ctrls), + $errcode, + $errmsg, + $ctrls[LDAP_CONTROL_PRE_READ], + @ldap_search($link, "dc=my-domain,$base", "(o=my-domain)") +); +?> +===DONE=== +--CLEAN-- + +--EXPECTF-- +resource(%d) of type (ldap result) +bool(true) +int(0) +string(0) "" +array(2) { + ["oid"]=> + string(14) "1.3.6.1.1.13.1" + ["value"]=> + array(3) { + ["dn"]=> + string(%d) "dc=my-domain,%s" + ["dc"]=> + array(1) { + [0]=> + string(9) "my-domain" + } + ["o"]=> + array(1) { + [0]=> + string(9) "my-domain" + } + } +} +bool(false) +===DONE=== diff --git a/ext/ldap/tests/ldap_exop.phpt b/ext/ldap/tests/ldap_exop.phpt index 48038cf230241..f5543c0e4edb2 100644 --- a/ext/ldap/tests/ldap_exop.phpt +++ b/ext/ldap/tests/ldap_exop.phpt @@ -42,6 +42,8 @@ var_dump( ldap_exop($link, LDAP_EXOP_WHO_AM_I, NULL, NULL, $retdata, $retoid), $retdata, $retoid, + ldap_exop($link, LDAP_EXOP_WHO_AM_I, NULL, [['oid' => LDAP_CONTROL_PROXY_AUTHZ, 'value' => "dn:cn=userA,$base"]], $retdata), + $retdata, $r = ldap_exop($link, LDAP_EXOP_WHO_AM_I), ldap_parse_exop($link, $r, $retdata2), $retdata2, @@ -66,6 +68,8 @@ remove_dummy_data($link, $base); bool(true) string(%d) "dn:%s" string(0) "" +bool(true) +string(%d) "dn:cn=user%s" resource(%d) of type (ldap result) bool(true) string(%d) "dn:%s" diff --git a/ext/ldap/tests/ldap_exop_passwd.phpt b/ext/ldap/tests/ldap_exop_passwd.phpt index 2f0d4cb599723..e50b30760ce5e 100644 --- a/ext/ldap/tests/ldap_exop_passwd.phpt +++ b/ext/ldap/tests/ldap_exop_passwd.phpt @@ -16,7 +16,8 @@ insert_dummy_data($link, $base); // and optionally returns the NEW password if none was passed. // ldap_exop_passwd(resource link [, string user [, string oldpw [, string newpw [, string newpasswd ]]]]) var_dump( - $genpw = ldap_exop_passwd($link, "cn=userA,$base", "oops", ""), + $genpw = ldap_exop_passwd($link, "cn=userA,$base", "oops", "", $ctrls), + $ctrls, $genpw = ldap_exop_passwd($link, "cn=userA,$base"), test_bind($host, $port, "cn=userA,$base", $genpw, $protocol_version), ldap_exop_passwd($link, "cn=userA,$base", $genpw, "newPassword"), @@ -34,6 +35,8 @@ remove_dummy_data($link, $base); ?> --EXPECTF-- string(%d) "%s" +array(0) { +} string(%d) "%s" bool(true) bool(true) diff --git a/ext/ldap/tests/ldap_exop_passwd_error.phpt b/ext/ldap/tests/ldap_exop_passwd_error.phpt index d858bd4bdcdd4..bfb0cbcae23d8 100644 --- a/ext/ldap/tests/ldap_exop_passwd_error.phpt +++ b/ext/ldap/tests/ldap_exop_passwd_error.phpt @@ -12,7 +12,8 @@ require "connect.inc"; $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); insert_dummy_data($link, $base); -var_dump(ldap_exop_passwd($link, "cn=userA,$base", "wrongPassword", "newPassword")); +var_dump(ldap_exop_passwd($link, "cn=userA,$base", "wrongPassword", "newPassword", $ctrls)); +var_dump($ctrls); var_dump(ldap_error($link)); var_dump(ldap_errno($link)); var_dump(test_bind($host, $port, "cn=userA,$base", "newPassword", $protocol_version)); @@ -27,8 +28,10 @@ $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); remove_dummy_data($link, $base); ?> --EXPECTF-- -Warning: ldap_exop_passwd(): Passwd modify extended operation failed: Server is unwilling to perform (53) in %s on line %d +Warning: ldap_exop_passwd(): Passwd modify extended operation failed: %s (53) in %s on line %d bool(false) +array(0) { +} string(30) "Server is unwilling to perform" int(53) diff --git a/ext/ldap/tests/ldap_exop_refresh.phpt b/ext/ldap/tests/ldap_exop_refresh.phpt new file mode 100644 index 0000000000000..170f013943acd --- /dev/null +++ b/ext/ldap/tests/ldap_exop_refresh.phpt @@ -0,0 +1,43 @@ +--TEST-- +ldap_exop_refresh() - Test LDAP refresh extended operation +--CREDITS-- +Emmanuel Dreyfus +--SKIPIF-- + + + +--FILE-- + array("person", "dynamicObject"), + "cn" => "tmp", + "sn" => "tmp" +)); +var_dump( + ldap_exop_refresh($link, "cn=tmp,$base", 1234) +); +?> +===DONE=== +--CLEAN-- + +--EXPECTF-- +int(1234) +===DONE=== diff --git a/ext/ldap/tests/ldap_first_reference_basic.phpt b/ext/ldap/tests/ldap_first_reference_basic.phpt index 37155a796c5a0..9c83c9127d357 100644 --- a/ext/ldap/tests/ldap_first_reference_basic.phpt +++ b/ext/ldap/tests/ldap_first_reference_basic.phpt @@ -30,8 +30,7 @@ include "connect.inc"; $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); // Referral can only be removed with Manage DSA IT Control -ldap_set_option($link, LDAP_OPT_SERVER_CONTROLS, array(array("oid" => "2.16.840.1.113730.3.4.2"))); -ldap_delete($link, "cn=userref,$base"); +ldap_delete($link, "cn=userref,$base", [['oid' => LDAP_CONTROL_MANAGEDSAIT, 'iscritical' => TRUE]]); remove_dummy_data($link, $base); ?> --EXPECTF-- diff --git a/ext/ldap/tests/ldap_get_option_controls.phpt b/ext/ldap/tests/ldap_get_option_controls.phpt index 3b55685d5e8f2..abe35497d6e43 100644 --- a/ext/ldap/tests/ldap_get_option_controls.phpt +++ b/ext/ldap/tests/ldap_get_option_controls.phpt @@ -30,7 +30,17 @@ $controls_set = array( array( 'oid' => LDAP_CONTROL_PAGEDRESULTS, 'iscritical' => TRUE, - 'value' => build_ctrl_paged_value(1, '') + 'value' => build_ctrl_paged_value(1, 'opaque') + ) +); +$controls_set2 = array( + array( + 'oid' => LDAP_CONTROL_PAGEDRESULTS, + 'iscritical' => TRUE, + 'value' => array( + 'size' => 1, + 'cookie' => '', + ) ) ); var_dump( @@ -38,10 +48,10 @@ var_dump( ldap_get_option($link, LDAP_OPT_SERVER_CONTROLS, $controls_get), ldap_set_option($link, LDAP_OPT_SERVER_CONTROLS, $controls_set), ldap_get_option($link, LDAP_OPT_SERVER_CONTROLS, $controls_get), - count($controls_get), - $controls_get[0]['oid'], - $controls_get[0]['iscritical'], - bin2hex($controls_get[0]['value']), + $controls_get, + ldap_set_option($link, LDAP_OPT_SERVER_CONTROLS, $controls_set2), + ldap_get_option($link, LDAP_OPT_SERVER_CONTROLS, $controls_get), + $controls_get, $result = ldap_search($link, $base, "(objectClass=person)", array('cn')), ldap_get_entries($link, $result)['count'], ldap_set_option($link, LDAP_OPT_SERVER_CONTROLS, array()), @@ -57,14 +67,44 @@ $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); remove_dummy_data($link, $base); ?> --EXPECTF-- -string(14) "30050201010400" +string(26) "300b02010104066f7061717565" bool(false) bool(true) bool(true) -int(1) -string(22) "1.2.840.113556.1.4.319" +array(1) { + ["1.2.840.113556.1.4.319"]=> + array(3) { + ["oid"]=> + string(22) "1.2.840.113556.1.4.319" + ["iscritical"]=> + bool(true) + ["value"]=> + array(2) { + ["size"]=> + int(1) + ["cookie"]=> + string(6) "opaque" + } + } +} bool(true) -string(14) "30050201010400" +bool(true) +array(1) { + ["1.2.840.113556.1.4.319"]=> + array(3) { + ["oid"]=> + string(22) "1.2.840.113556.1.4.319" + ["iscritical"]=> + bool(true) + ["value"]=> + array(2) { + ["size"]=> + int(1) + ["cookie"]=> + string(0) "" + } + } +} resource(%d) of type (ldap result) int(1) bool(true) diff --git a/ext/ldap/tests/ldap_get_option_variation.phpt b/ext/ldap/tests/ldap_get_option_variation.phpt index 759936ec629b6..a18318849fc05 100644 --- a/ext/ldap/tests/ldap_get_option_variation.phpt +++ b/ext/ldap/tests/ldap_get_option_variation.phpt @@ -66,14 +66,16 @@ bool(true) int(0) bool(true) array(2) { - [0]=> - array(2) { + ["1.2.752.58.10.1"]=> + array(3) { ["oid"]=> string(15) "1.2.752.58.10.1" ["iscritical"]=> bool(true) + ["value"]=> + NULL } - [1]=> + ["1.2.752.58.1.10"]=> array(3) { ["oid"]=> string(15) "1.2.752.58.1.10" @@ -85,14 +87,16 @@ array(2) { } bool(true) array(2) { - [0]=> - array(2) { + ["1.2.752.58.10.1"]=> + array(3) { ["oid"]=> string(15) "1.2.752.58.10.1" ["iscritical"]=> bool(true) + ["value"]=> + NULL } - [1]=> + ["1.2.752.58.1.10"]=> array(3) { ["oid"]=> string(15) "1.2.752.58.1.10" diff --git a/ext/ldap/tests/ldap_list_basic.phpt b/ext/ldap/tests/ldap_list_basic.phpt index 3f98bc8e2d074..1aadab6a17fcb 100644 --- a/ext/ldap/tests/ldap_list_basic.phpt +++ b/ext/ldap/tests/ldap_list_basic.phpt @@ -67,7 +67,7 @@ array(3) { ["count"]=> int(1) [0]=> - string(4) "oops" + string(%d) "%s" } [3]=> string(12) "userpassword" @@ -128,7 +128,7 @@ array(3) { ["count"]=> int(1) [0]=> - string(15) "oopsIDitItAgain" + string(%d) "%s" } [3]=> string(12) "userpassword" diff --git a/ext/ldap/tests/ldap_list_error.phpt b/ext/ldap/tests/ldap_list_error.phpt index 51bcaa583f195..817622e7252e4 100644 --- a/ext/ldap/tests/ldap_list_error.phpt +++ b/ext/ldap/tests/ldap_list_error.phpt @@ -17,7 +17,7 @@ var_dump(ldap_list($link)); var_dump(ldap_list($link, $link)); // Too many parameters -var_dump(ldap_list($link, "$base", "(objectClass=*)", array(), 0, 0, 0, 0 , "Additional data")); +var_dump(ldap_list($link, "$base", "(objectClass=*)", array(), 0, 0, 0, 0, [], "Additional data")); ?> ===DONE=== --EXPECTF-- @@ -30,6 +30,6 @@ NULL Warning: ldap_list() expects at least 3 parameters, 2 given in %s on line %d NULL -Warning: ldap_list() expects at most 8 parameters, 9 given in %s on line %d +Warning: ldap_list() expects at most 9 parameters, 10 given in %s on line %d NULL ===DONE=== diff --git a/ext/ldap/tests/ldap_mod_add_error.phpt b/ext/ldap/tests/ldap_mod_add_error.phpt index c04e2cbd3d2ce..4bfbaa5551ef7 100644 --- a/ext/ldap/tests/ldap_mod_add_error.phpt +++ b/ext/ldap/tests/ldap_mod_add_error.phpt @@ -18,7 +18,7 @@ var_dump(ldap_mod_add($link)); var_dump(ldap_mod_add($link, "$base")); // Too many parameters -var_dump(ldap_mod_add($link, "$base", array(), "Additional data")); +var_dump(ldap_mod_add($link, "$base", array(), [], "Additional data")); // DN not found var_dump(ldap_mod_add($link, "dc=my-domain,$base", array())); @@ -57,16 +57,16 @@ $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); ldap_delete($link, "dc=my-domain,$base"); ?> --EXPECTF-- -Warning: ldap_mod_add() expects exactly 3 parameters, 0 given in %s on line %d +Warning: ldap_mod_add() expects at least 3 parameters, 0 given in %s on line %d NULL -Warning: ldap_mod_add() expects exactly 3 parameters, 1 given in %s on line %d +Warning: ldap_mod_add() expects at least 3 parameters, 1 given in %s on line %d NULL -Warning: ldap_mod_add() expects exactly 3 parameters, 2 given in %s on line %d +Warning: ldap_mod_add() expects at least 3 parameters, 2 given in %s on line %d NULL -Warning: ldap_mod_add() expects exactly 3 parameters, 4 given in %s on line %d +Warning: ldap_mod_add() expects at most 4 parameters, 5 given in %s on line %d NULL Warning: ldap_mod_add(): Modify: No such object in %s on line %d diff --git a/ext/ldap/tests/ldap_mod_del_error.phpt b/ext/ldap/tests/ldap_mod_del_error.phpt index 679adb6e6e17c..129d6472c12ef 100644 --- a/ext/ldap/tests/ldap_mod_del_error.phpt +++ b/ext/ldap/tests/ldap_mod_del_error.phpt @@ -18,7 +18,7 @@ var_dump(ldap_mod_del($link)); var_dump(ldap_mod_del($link, "$base")); // Too many parameters -var_dump(ldap_mod_del($link, "$base", array(), "Additional data")); +var_dump(ldap_mod_del($link, "$base", array(), [], "Additional data")); // DN not found var_dump(ldap_mod_del($link, "dc=my-domain,$base", array())); @@ -39,16 +39,16 @@ $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); ldap_delete($link, "dc=my-domain,$base"); ?> --EXPECTF-- -Warning: ldap_mod_del() expects exactly 3 parameters, 0 given in %s on line %d +Warning: ldap_mod_del() expects at least 3 parameters, 0 given in %s on line %d NULL -Warning: ldap_mod_del() expects exactly 3 parameters, 1 given in %s on line %d +Warning: ldap_mod_del() expects at least 3 parameters, 1 given in %s on line %d NULL -Warning: ldap_mod_del() expects exactly 3 parameters, 2 given in %s on line %d +Warning: ldap_mod_del() expects at least 3 parameters, 2 given in %s on line %d NULL -Warning: ldap_mod_del() expects exactly 3 parameters, 4 given in %s on line %d +Warning: ldap_mod_del() expects at most 4 parameters, 5 given in %s on line %d NULL Warning: ldap_mod_del(): Modify: No such object in %s on line %d diff --git a/ext/ldap/tests/ldap_mod_ext.phpt b/ext/ldap/tests/ldap_mod_ext.phpt new file mode 100644 index 0000000000000..391ecbf9097e0 --- /dev/null +++ b/ext/ldap/tests/ldap_mod_ext.phpt @@ -0,0 +1,172 @@ +--TEST-- +ldap_mod_ext() - Modify operations with controls +--CREDITS-- +Patrick Allaert +# Belgian PHP Testfest 2009 +--SKIPIF-- + + + +--FILE-- + "Domain description", +); + +var_dump( + $result = ldap_mod_add_ext($link, "o=test,$base", $entry, + [ + ['oid' => LDAP_CONTROL_PRE_READ, 'iscritical' => TRUE, 'value' => ['attrs' => ['description']]], + ['oid' => LDAP_CONTROL_POST_READ, 'iscritical' => TRUE, 'value' => ['attrs' => ['description']]], + ] + ), + ldap_parse_result($link, $result, $errcode, $matcheddn, $errmsg, $referrals, $ctrls), + $errcode, + $errmsg, + $ctrls, + ldap_get_entries( + $link, + ldap_search($link, "o=test,$base", "(Description=Domain description)") + ), + $result = ldap_mod_del_ext($link, "o=test,$base", $entry, + [ + ['oid' => LDAP_CONTROL_PRE_READ, 'iscritical' => TRUE, 'value' => ['attrs' => ['description']]], + ['oid' => LDAP_CONTROL_POST_READ, 'iscritical' => TRUE, 'value' => ['attrs' => ['description']]], + ] + ), + ldap_parse_result($link, $result, $errcode, $matcheddn, $errmsg, $referrals, $ctrls), + $errcode, + $errmsg, + $ctrls, + ldap_get_entries( + $link, + ldap_search($link, "o=test,$base", "(Description=Domain description)") + ) +); +?> +===DONE=== +--CLEAN-- + +--EXPECTF-- +resource(%d) of type (ldap result) +bool(true) +int(0) +string(0) "" +array(2) { + ["1.3.6.1.1.13.1"]=> + array(2) { + ["oid"]=> + string(14) "1.3.6.1.1.13.1" + ["value"]=> + array(1) { + ["dn"]=> + string(%d) "o=test,%s" + } + } + ["1.3.6.1.1.13.2"]=> + array(2) { + ["oid"]=> + string(14) "1.3.6.1.1.13.2" + ["value"]=> + array(2) { + ["dn"]=> + string(%d) "o=test,%s" + ["description"]=> + array(1) { + [0]=> + string(18) "Domain description" + } + } + } +} +array(2) { + ["count"]=> + int(1) + [0]=> + array(8) { + ["objectclass"]=> + array(3) { + ["count"]=> + int(2) + [0]=> + string(3) "top" + [1]=> + string(12) "organization" + } + [0]=> + string(11) "objectclass" + ["o"]=> + array(2) { + ["count"]=> + int(1) + [0]=> + string(4) "test" + } + [1]=> + string(1) "o" + ["description"]=> + array(2) { + ["count"]=> + int(1) + [0]=> + string(18) "Domain description" + } + [2]=> + string(11) "description" + ["count"]=> + int(3) + ["dn"]=> + string(%d) "o=test,%s" + } +} +resource(%d) of type (ldap result) +bool(true) +int(0) +string(0) "" +array(2) { + ["1.3.6.1.1.13.1"]=> + array(2) { + ["oid"]=> + string(14) "1.3.6.1.1.13.1" + ["value"]=> + array(2) { + ["dn"]=> + string(%d) "o=test,%s" + ["description"]=> + array(1) { + [0]=> + string(18) "Domain description" + } + } + } + ["1.3.6.1.1.13.2"]=> + array(2) { + ["oid"]=> + string(14) "1.3.6.1.1.13.2" + ["value"]=> + array(1) { + ["dn"]=> + string(%d) "o=test,%s" + } + } +} +array(1) { + ["count"]=> + int(0) +} +===DONE=== diff --git a/ext/ldap/tests/ldap_mod_replace_error.phpt b/ext/ldap/tests/ldap_mod_replace_error.phpt index f796568d0762d..4f435b13d2add 100644 --- a/ext/ldap/tests/ldap_mod_replace_error.phpt +++ b/ext/ldap/tests/ldap_mod_replace_error.phpt @@ -18,7 +18,7 @@ var_dump(ldap_mod_replace($link)); var_dump(ldap_mod_replace($link, "$base")); // Too many parameters -var_dump(ldap_mod_replace($link, "$base", array(), "Additional data")); +var_dump(ldap_mod_replace($link, "$base", array(), [], "Additional data")); // DN not found var_dump(ldap_mod_replace($link, "dc=my-domain,$base", array())); @@ -37,16 +37,16 @@ require "connect.inc"; $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); ?> --EXPECTF-- -Warning: ldap_mod_replace() expects exactly 3 parameters, 0 given in %s on line %d +Warning: ldap_mod_replace() expects at least 3 parameters, 0 given in %s on line %d NULL -Warning: ldap_mod_replace() expects exactly 3 parameters, 1 given in %s on line %d +Warning: ldap_mod_replace() expects at least 3 parameters, 1 given in %s on line %d NULL -Warning: ldap_mod_replace() expects exactly 3 parameters, 2 given in %s on line %d +Warning: ldap_mod_replace() expects at least 3 parameters, 2 given in %s on line %d NULL -Warning: ldap_mod_replace() expects exactly 3 parameters, 4 given in %s on line %d +Warning: ldap_mod_replace() expects at most 4 parameters, 5 given in %s on line %d NULL Warning: ldap_mod_replace(): Modify: No such object in %s on line %d diff --git a/ext/ldap/tests/ldap_modify_batch_basic.phpt b/ext/ldap/tests/ldap_modify_batch_basic.phpt index 23700b49b20ef..0bec0e03c4eef 100644 --- a/ext/ldap/tests/ldap_modify_batch_basic.phpt +++ b/ext/ldap/tests/ldap_modify_batch_basic.phpt @@ -76,7 +76,7 @@ array(2) { ["count"]=> int(1) [0]=> - string(4) "oops" + string(%d) "%s" } [2]=> string(12) "userpassword" diff --git a/ext/ldap/tests/ldap_modify_batch_error.phpt b/ext/ldap/tests/ldap_modify_batch_error.phpt index 2d72d491f8f31..a2d9ef9debe49 100644 --- a/ext/ldap/tests/ldap_modify_batch_error.phpt +++ b/ext/ldap/tests/ldap_modify_batch_error.phpt @@ -26,7 +26,7 @@ var_dump(ldap_modify_batch($link)); var_dump(ldap_modify_batch($link, "$base")); // Too many parameters -var_dump(ldap_modify_batch($link, "$base", $addGivenName, "Invalid additional parameter")); +var_dump(ldap_modify_batch($link, "$base", $addGivenName, [], "Invalid additional parameter")); // DN not found var_dump(ldap_modify_batch($link, "cn=not-found,$base", $addGivenName)); @@ -78,16 +78,16 @@ $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); ldap_delete($link, "dc=my-domain,$base"); ?> --EXPECTF-- -Warning: ldap_modify_batch() expects exactly 3 parameters, 0 given in %s on line %d +Warning: ldap_modify_batch() expects at least 3 parameters, 0 given in %s on line %d NULL -Warning: ldap_modify_batch() expects exactly 3 parameters, 1 given in %s on line %d +Warning: ldap_modify_batch() expects at least 3 parameters, 1 given in %s on line %d NULL -Warning: ldap_modify_batch() expects exactly 3 parameters, 2 given in %s on line %d +Warning: ldap_modify_batch() expects at least 3 parameters, 2 given in %s on line %d NULL -Warning: ldap_modify_batch() expects exactly 3 parameters, 4 given in %s on line %d +Warning: ldap_modify_batch() expects at most 4 parameters, 5 given in %s on line %d NULL Warning: ldap_modify_batch(): Batch Modify: No such object in %s on line %d diff --git a/ext/ldap/tests/ldap_modify_error.phpt b/ext/ldap/tests/ldap_modify_error.phpt index 0ca2ea49dc04c..31069bb98c962 100644 --- a/ext/ldap/tests/ldap_modify_error.phpt +++ b/ext/ldap/tests/ldap_modify_error.phpt @@ -18,7 +18,7 @@ var_dump(ldap_modify($link)); var_dump(ldap_modify($link, "$base")); // Too many parameters -var_dump(ldap_modify($link, "$base", array(), "Additional data")); +var_dump(ldap_modify($link, "$base", array(), [], "Additional data")); // DN not found var_dump(ldap_modify($link, "cn=not-found,$base", array())); @@ -57,16 +57,16 @@ $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); ldap_delete($link, "dc=my-domain,$base"); ?> --EXPECTF-- -Warning: ldap_modify() expects exactly 3 parameters, 0 given in %s on line %d +Warning: ldap_modify() expects at least 3 parameters, 0 given in %s on line %d NULL -Warning: ldap_modify() expects exactly 3 parameters, 1 given in %s on line %d +Warning: ldap_modify() expects at least 3 parameters, 1 given in %s on line %d NULL -Warning: ldap_modify() expects exactly 3 parameters, 2 given in %s on line %d +Warning: ldap_modify() expects at least 3 parameters, 2 given in %s on line %d NULL -Warning: ldap_modify() expects exactly 3 parameters, 4 given in %s on line %d +Warning: ldap_modify() expects at most 4 parameters, 5 given in %s on line %d NULL Warning: ldap_modify(): Modify: No such object in %s on line %d diff --git a/ext/ldap/tests/ldap_next_reference_basic.phpt b/ext/ldap/tests/ldap_next_reference_basic.phpt index 18b135da01b58..2476e02c5776c 100644 --- a/ext/ldap/tests/ldap_next_reference_basic.phpt +++ b/ext/ldap/tests/ldap_next_reference_basic.phpt @@ -35,9 +35,8 @@ include "connect.inc"; $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); // Referral can only be removed with Manage DSA IT Control -ldap_set_option($link, LDAP_OPT_SERVER_CONTROLS, array(array("oid" => "2.16.840.1.113730.3.4.2"))); -ldap_delete($link, "cn=userref,$base"); -ldap_delete($link, "cn=userref2,$base"); +ldap_delete($link, "cn=userref,$base", [['oid' => LDAP_CONTROL_MANAGEDSAIT, 'iscritical' => TRUE]]); +ldap_delete($link, "cn=userref2,$base", [['oid' => LDAP_CONTROL_MANAGEDSAIT, 'iscritical' => TRUE]]); remove_dummy_data($link, $base); ?> --EXPECTF-- diff --git a/ext/ldap/tests/ldap_parse_result_basic.phpt b/ext/ldap/tests/ldap_parse_result_basic.phpt index ec88dff377776..e2a975d5b198c 100644 --- a/ext/ldap/tests/ldap_parse_result_basic.phpt +++ b/ext/ldap/tests/ldap_parse_result_basic.phpt @@ -31,8 +31,7 @@ include "connect.inc"; $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); // Referral can only be removed with Manage DSA IT Control -ldap_set_option($link, LDAP_OPT_SERVER_CONTROLS, array(array("oid" => "2.16.840.1.113730.3.4.2"))); -ldap_delete($link, "cn=userref,$base"); +ldap_delete($link, "cn=userref,$base", [['oid' => LDAP_CONTROL_MANAGEDSAIT, 'iscritical' => TRUE]]); remove_dummy_data($link, $base); ?> --EXPECTF-- diff --git a/ext/ldap/tests/ldap_parse_result_controls.phpt b/ext/ldap/tests/ldap_parse_result_controls.phpt new file mode 100644 index 0000000000000..711507f6c02fd --- /dev/null +++ b/ext/ldap/tests/ldap_parse_result_controls.phpt @@ -0,0 +1,47 @@ +--TEST-- +ldap_parse_result() - Test the parsing of controls from result object +--CREDITS-- +Côme Chilliet +--SKIPIF-- + + + +--FILE-- + +===DONE=== +--CLEAN-- + +--EXPECTF-- +bool(true) +resource(%d) of type (ldap result) +bool(true) +string(22) "1.2.840.113556.1.4.319" +int(%d) +string(%d) "%s" +int(1) +===DONE=== diff --git a/ext/ldap/tests/ldap_read_error.phpt b/ext/ldap/tests/ldap_read_error.phpt index 7d57172e0d637..08f6280490606 100644 --- a/ext/ldap/tests/ldap_read_error.phpt +++ b/ext/ldap/tests/ldap_read_error.phpt @@ -17,7 +17,7 @@ var_dump(ldap_read($link)); var_dump(ldap_read($link, $link)); // Too many parameters -var_dump(ldap_read($link, "$base", "(objectClass=*)", array(), 0, 0, 0, 0 , "Additional data")); +var_dump(ldap_read($link, "$base", "(objectClass=*)", array(), 0, 0, 0, 0, [], "Additional data")); ?> ===DONE=== --EXPECTF-- @@ -30,6 +30,6 @@ NULL Warning: ldap_read() expects at least 3 parameters, 2 given in %s on line %d NULL -Warning: ldap_read() expects at most 8 parameters, 9 given in %s on line %d +Warning: ldap_read() expects at most 9 parameters, 10 given in %s on line %d NULL ===DONE=== diff --git a/ext/ldap/tests/ldap_rename_error.phpt b/ext/ldap/tests/ldap_rename_error.phpt index 111717f0b013e..8a580e5c3486e 100644 --- a/ext/ldap/tests/ldap_rename_error.phpt +++ b/ext/ldap/tests/ldap_rename_error.phpt @@ -15,7 +15,7 @@ var_dump(ldap_rename($link, "cn=userNotFound,$base", "cn=userZ", "$base", true)) ?> ===DONE=== --EXPECTF-- -Warning: ldap_rename() expects exactly 5 parameters, 1 given in %s on line %d +Warning: ldap_rename() expects at least 5 parameters, 1 given in %s on line %d NULL bool(false) ===DONE=== diff --git a/ext/ldap/tests/ldap_rename_ext.phpt b/ext/ldap/tests/ldap_rename_ext.phpt new file mode 100644 index 0000000000000..bee180b6f7014 --- /dev/null +++ b/ext/ldap/tests/ldap_rename_ext.phpt @@ -0,0 +1,80 @@ +--TEST-- +ldap_rename_ext() - Rename operation with controls +--CREDITS-- +Côme Chilliet +--SKIPIF-- + + + +--FILE-- + LDAP_CONTROL_PRE_READ, 'iscritical' => TRUE, 'value' => ['attrs' => ['cn']]], + ['oid' => LDAP_CONTROL_POST_READ, 'iscritical' => TRUE, 'value' => ['attrs' => ['cn']]] + ] + ), + ldap_parse_result($link, $result, $errcode, $matcheddn, $errmsg, $referrals, $ctrls), + $errcode, + $errmsg, + $ctrls[LDAP_CONTROL_PRE_READ], + $ctrls[LDAP_CONTROL_POST_READ], + ldap_count_entries($link, ldap_search($link, "$base", "(cn=userA)", array("cn"))), + ldap_count_entries($link, ldap_search($link, "$base", "(cn=userZ)", array("cn"))) +); +?> +===DONE=== +--CLEAN-- + +--EXPECTF-- +resource(%d) of type (ldap result) +bool(true) +int(0) +string(0) "" +array(2) { + ["oid"]=> + string(14) "1.3.6.1.1.13.1" + ["value"]=> + array(2) { + ["dn"]=> + string(%d) "cn=userA,%s" + ["cn"]=> + array(1) { + [0]=> + string(5) "userA" + } + } +} +array(2) { + ["oid"]=> + string(14) "1.3.6.1.1.13.2" + ["value"]=> + array(2) { + ["dn"]=> + string(%d) "cn=userZ,%s" + ["cn"]=> + array(1) { + [0]=> + string(5) "userZ" + } + } +} +int(0) +int(1) +===DONE=== diff --git a/ext/ldap/tests/ldap_search_basic.phpt b/ext/ldap/tests/ldap_search_basic.phpt index 54523de38ae1a..618366b1a184f 100644 --- a/ext/ldap/tests/ldap_search_basic.phpt +++ b/ext/ldap/tests/ldap_search_basic.phpt @@ -68,7 +68,7 @@ array(4) { ["count"]=> int(1) [0]=> - string(4) "oops" + string(%d) "%s" } [3]=> string(12) "userpassword" @@ -129,7 +129,7 @@ array(4) { ["count"]=> int(1) [0]=> - string(15) "oopsIDitItAgain" + string(%d) "%s" } [3]=> string(12) "userpassword" @@ -181,7 +181,7 @@ array(4) { ["count"]=> int(1) [0]=> - string(17) "0r1g1na1 passw0rd" + string(%d) "%s" } [3]=> string(12) "userpassword" diff --git a/ext/ldap/tests/ldap_search_overrides.phpt b/ext/ldap/tests/ldap_search_overrides.phpt index 72d8e2498e586..2434fe5db242e 100644 --- a/ext/ldap/tests/ldap_search_overrides.phpt +++ b/ext/ldap/tests/ldap_search_overrides.phpt @@ -81,7 +81,7 @@ array(4) { ["count"]=> int(1) [0]=> - string(4) "oops" + string(%d) "%s" } [3]=> string(12) "userpassword" @@ -142,7 +142,7 @@ array(4) { ["count"]=> int(1) [0]=> - string(15) "oopsIDitItAgain" + string(%d) "%s" } [3]=> string(12) "userpassword" @@ -194,7 +194,7 @@ array(4) { ["count"]=> int(1) [0]=> - string(17) "0r1g1na1 passw0rd" + string(%d) "%s" } [3]=> string(12) "userpassword" diff --git a/ext/ldap/tests/ldap_search_paged_result_controls.phpt b/ext/ldap/tests/ldap_search_paged_result_controls.phpt new file mode 100644 index 0000000000000..2187a54148d28 --- /dev/null +++ b/ext/ldap/tests/ldap_search_paged_result_controls.phpt @@ -0,0 +1,99 @@ +--TEST-- +ldap_search() test with paged result controls +--CREDITS-- +Côme Chilliet +--SKIPIF-- + +--FILE-- + LDAP_CONTROL_PAGEDRESULTS, 'value' => ['size' => 2]]]), + ldap_get_entries($link, $result), + ldap_parse_result($link, $result, $errcode , $matcheddn , $errmsg , $referrals, $controls), + $result = ldap_search($link, $dn, $filter, array('cn'), 0, 0, 0, LDAP_DEREF_NEVER, + [['oid' => LDAP_CONTROL_PAGEDRESULTS, 'value' => ['size' => 20, 'cookie' => $controls[LDAP_CONTROL_PAGEDRESULTS]['value']['cookie']]]]), + ldap_get_entries($link, $result) +); +?> +===DONE=== +--CLEAN-- + +--EXPECTF-- +resource(%d) of type (ldap result) +array(3) { + ["count"]=> + int(2) + [0]=> + array(4) { + ["cn"]=> + array(2) { + ["count"]=> + int(1) + [0]=> + string(5) "userA" + } + [0]=> + string(2) "cn" + ["count"]=> + int(1) + ["dn"]=> + string(%d) "cn=userA,%s" + } + [1]=> + array(4) { + ["cn"]=> + array(2) { + ["count"]=> + int(1) + [0]=> + string(5) "userB" + } + [0]=> + string(2) "cn" + ["count"]=> + int(1) + ["dn"]=> + string(%d) "cn=userB,%s" + } +} +bool(true) +resource(%d) of type (ldap result) +array(2) { + ["count"]=> + int(1) + [0]=> + array(4) { + ["cn"]=> + array(2) { + ["count"]=> + int(1) + [0]=> + string(5) "userC" + } + [0]=> + string(2) "cn" + ["count"]=> + int(1) + ["dn"]=> + string(%d) "cn=userC,cn=userB,%s" + } +} +===DONE=== diff --git a/ext/ldap/tests/ldap_search_sort_controls.phpt b/ext/ldap/tests/ldap_search_sort_controls.phpt new file mode 100644 index 0000000000000..16504a6997507 --- /dev/null +++ b/ext/ldap/tests/ldap_search_sort_controls.phpt @@ -0,0 +1,207 @@ +--TEST-- +ldap_search() test with sort and VLV controls +--CREDITS-- +Côme Chilliet +--SKIPIF-- + +--FILE-- + LDAP_CONTROL_SORTREQUEST, + 'iscritical' => TRUE, + 'value' => [ + ['attr' => 'cn', 'oid' => '2.5.13.3' /* caseIgnoreOrderingMatch */, 'reverse' => TRUE] + ] + ] + ] + ), + ldap_get_entries($link, $result), + ldap_parse_result($link, $result, $errcode , $matcheddn , $errmsg , $referrals, $controls), + $errcode, + $errmsg, + $controls +); + +/* Then with VLV control */ +var_dump( + $result = ldap_search($link, $base, '(cn=*)', array('cn'), 0, 0, 0, LDAP_DEREF_NEVER, + [ + [ + 'oid' => LDAP_CONTROL_SORTREQUEST, + 'iscritical' => TRUE, + 'value' => [ + ['attr' => 'cn', 'oid' => '2.5.13.3' /* caseIgnoreOrderingMatch */, 'reverse' => TRUE] + ] + ], + [ + 'oid' => LDAP_CONTROL_VLVREQUEST, + 'iscritical' => TRUE, + 'value' => [ + 'before' => 0, // Return 0 entry before target + 'after' => 1, // Return 1 entry after target + 'offset' => 2, // Target entry is the second one + 'count' => 0, // We have no idea how many entries there are + ] + ] + ] + ), + ldap_get_entries($link, $result), + ldap_parse_result($link, $result, $errcode , $matcheddn , $errmsg , $referrals, $controls), + array_keys($controls), + $controls[LDAP_CONTROL_SORTRESPONSE], + $controls[LDAP_CONTROL_VLVRESPONSE]['value']['target'], + $controls[LDAP_CONTROL_VLVRESPONSE]['value']['count'], + $controls[LDAP_CONTROL_VLVRESPONSE]['value']['errcode'], + bin2hex($controls[LDAP_CONTROL_VLVRESPONSE]['value']['context']) +); +?> +===DONE=== +--CLEAN-- + +--EXPECTF-- +resource(%d) of type (ldap result) +array(4) { + ["count"]=> + int(3) + [0]=> + array(4) { + ["cn"]=> + array(2) { + ["count"]=> + int(1) + [0]=> + string(5) "userC" + } + [0]=> + string(2) "cn" + ["count"]=> + int(1) + ["dn"]=> + string(%d) "cn=userC,cn=userB,%s" + } + [1]=> + array(4) { + ["cn"]=> + array(2) { + ["count"]=> + int(1) + [0]=> + string(5) "userB" + } + [0]=> + string(2) "cn" + ["count"]=> + int(1) + ["dn"]=> + string(%d) "cn=userB,%s" + } + [2]=> + array(4) { + ["cn"]=> + array(2) { + ["count"]=> + int(1) + [0]=> + string(5) "userA" + } + [0]=> + string(2) "cn" + ["count"]=> + int(1) + ["dn"]=> + string(%d) "cn=userA,%s" + } +} +bool(true) +int(0) +string(0) "" +array(1) { + ["1.2.840.113556.1.4.474"]=> + array(2) { + ["oid"]=> + string(22) "1.2.840.113556.1.4.474" + ["value"]=> + array(1) { + ["errcode"]=> + int(0) + } + } +} +resource(%d) of type (ldap result) +array(3) { + ["count"]=> + int(2) + [0]=> + array(4) { + ["cn"]=> + array(2) { + ["count"]=> + int(1) + [0]=> + string(5) "userB" + } + [0]=> + string(2) "cn" + ["count"]=> + int(1) + ["dn"]=> + string(%d) "cn=userB,%s" + } + [1]=> + array(4) { + ["cn"]=> + array(2) { + ["count"]=> + int(1) + [0]=> + string(5) "userA" + } + [0]=> + string(2) "cn" + ["count"]=> + int(1) + ["dn"]=> + string(%d) "cn=userA,%s" + } +} +bool(true) +array(2) { + [0]=> + string(22) "1.2.840.113556.1.4.474" + [1]=> + string(24) "2.16.840.1.113730.3.4.10" +} +array(2) { + ["oid"]=> + string(22) "1.2.840.113556.1.4.474" + ["value"]=> + array(1) { + ["errcode"]=> + int(0) + } +} +int(2) +int(3) +int(0) +string(%d) "%s" +===DONE=== diff --git a/ext/ldap/tests/ldap_search_variation6.phpt b/ext/ldap/tests/ldap_search_variation6.phpt index f4f98db873d61..a9202967b47b6 100644 --- a/ext/ldap/tests/ldap_search_variation6.phpt +++ b/ext/ldap/tests/ldap_search_variation6.phpt @@ -25,12 +25,12 @@ var_dump( ldap_get_entries($link, $result[1]) === $result0 ); var_dump( - $result = ldap_search(array($link, $link), null, $filter), + $result = ldap_search(array($link, $link), "", $filter), ldap_get_entries($link, $result[0]), ldap_get_entries($link, $result[1]) ); var_dump( - $result = ldap_search(array($link, $link), null, array($filter, $filter)), + $result = ldap_search(array($link, $link), "", array($filter, $filter)), ldap_get_entries($link, $result[0]), ldap_get_entries($link, $result[1]) ); @@ -87,7 +87,7 @@ array(4) { ["count"]=> int(1) [0]=> - string(4) "oops" + string(%d) "%s" } [3]=> string(12) "userpassword" @@ -148,7 +148,7 @@ array(4) { ["count"]=> int(1) [0]=> - string(15) "oopsIDitItAgain" + string(%d) "%s" } [3]=> string(12) "userpassword" @@ -200,7 +200,7 @@ array(4) { ["count"]=> int(1) [0]=> - string(17) "0r1g1na1 passw0rd" + string(%d) "%s" } [3]=> string(12) "userpassword" diff --git a/ext/ldap/tests/ldap_set_option_error.phpt b/ext/ldap/tests/ldap_set_option_error.phpt index f319c7e6df6ec..3ea49cbc7e2f3 100644 --- a/ext/ldap/tests/ldap_set_option_error.phpt +++ b/ext/ldap/tests/ldap_set_option_error.phpt @@ -20,8 +20,7 @@ $controls = array( array("oid" => "1.2.752.58.1.10", "value" => "magic"), "weird" ), - array( - ), + "notanarray" ); // Too few parameters @@ -60,7 +59,7 @@ bool(false) Warning: ldap_set_option(): The array value must contain only arrays, where each array is a control in %s on line %d bool(false) -Warning: ldap_set_option(): Expected non-empty array value for this option in %s on line %d +Warning: ldap_set_option(): Expected array value for this option in %s on line %d bool(false) bool(false) ===DONE=== diff --git a/ext/ldap/tests/ldap_set_option_variation.phpt b/ext/ldap/tests/ldap_set_option_variation.phpt index bb8a3f1051899..4c0a138552526 100644 --- a/ext/ldap/tests/ldap_set_option_variation.phpt +++ b/ext/ldap/tests/ldap_set_option_variation.phpt @@ -77,14 +77,16 @@ bool(true) bool(false) bool(true) array(2) { - [0]=> - array(2) { + ["1.2.752.58.10.1"]=> + array(3) { ["oid"]=> string(15) "1.2.752.58.10.1" ["iscritical"]=> bool(true) + ["value"]=> + NULL } - [1]=> + ["1.2.752.58.1.10"]=> array(3) { ["oid"]=> string(15) "1.2.752.58.1.10" @@ -96,14 +98,16 @@ array(2) { } bool(true) array(2) { - [0]=> - array(2) { + ["1.2.752.58.10.1"]=> + array(3) { ["oid"]=> string(15) "1.2.752.58.10.1" ["iscritical"]=> bool(true) + ["value"]=> + NULL } - [1]=> + ["1.2.752.58.1.10"]=> array(3) { ["oid"]=> string(15) "1.2.752.58.1.10" diff --git a/ext/ldap/tests/skipifcontrol.inc b/ext/ldap/tests/skipifcontrol.inc new file mode 100644 index 0000000000000..ae551d6add86f --- /dev/null +++ b/ext/ldap/tests/skipifcontrol.inc @@ -0,0 +1,13 @@ + diff --git a/ext/libxml/libxml.c b/ext/libxml/libxml.c index d88860c4f3283..c355ae2ba41e6 100644 --- a/ext/libxml/libxml.c +++ b/ext/libxml/libxml.c @@ -1042,9 +1042,7 @@ static PHP_FUNCTION(libxml_get_errors) xmlErrorPtr error; - if (array_init(return_value) == FAILURE) { - RETURN_FALSE; - } + array_init(return_value); if (LIBXML(error_list)) { diff --git a/ext/mbstring/libmbfl/filters/mbfilter_7bit.c b/ext/mbstring/libmbfl/filters/mbfilter_7bit.c index ab1727146a893..382c87437cb5a 100644 --- a/ext/mbstring/libmbfl/filters/mbfilter_7bit.c +++ b/ext/mbstring/libmbfl/filters/mbfilter_7bit.c @@ -41,7 +41,9 @@ const mbfl_encoding mbfl_encoding_7bit = { "7bit", NULL, NULL, - MBFL_ENCTYPE_SBCS + MBFL_ENCTYPE_SBCS, + NULL, + NULL }; const struct mbfl_convert_vtbl vtbl_8bit_7bit = { diff --git a/ext/mbstring/libmbfl/filters/mbfilter_armscii8.c b/ext/mbstring/libmbfl/filters/mbfilter_armscii8.c index ad2cf0c7f0bb2..bfe3763f18042 100644 --- a/ext/mbstring/libmbfl/filters/mbfilter_armscii8.c +++ b/ext/mbstring/libmbfl/filters/mbfilter_armscii8.c @@ -44,7 +44,9 @@ const mbfl_encoding mbfl_encoding_armscii8 = { "ArmSCII-8", (const char *(*)[])&mbfl_encoding_armscii8_aliases, NULL, - MBFL_ENCTYPE_SBCS + MBFL_ENCTYPE_SBCS, + &vtbl_armscii8_wchar, + &vtbl_wchar_armscii8 }; const struct mbfl_identify_vtbl vtbl_identify_armscii8 = { diff --git a/ext/mbstring/libmbfl/filters/mbfilter_ascii.c b/ext/mbstring/libmbfl/filters/mbfilter_ascii.c index e9eb496771510..b3c1161d32c11 100644 --- a/ext/mbstring/libmbfl/filters/mbfilter_ascii.c +++ b/ext/mbstring/libmbfl/filters/mbfilter_ascii.c @@ -45,7 +45,9 @@ const mbfl_encoding mbfl_encoding_ascii = { "US-ASCII", /* preferred MIME name */ (const char *(*)[])&mbfl_encoding_ascii_aliases, NULL, - MBFL_ENCTYPE_SBCS + MBFL_ENCTYPE_SBCS, + &vtbl_ascii_wchar, + &vtbl_wchar_ascii }; const struct mbfl_identify_vtbl vtbl_identify_ascii = { diff --git a/ext/mbstring/libmbfl/filters/mbfilter_base64.c b/ext/mbstring/libmbfl/filters/mbfilter_base64.c index adecdee888c28..661e1a4a5bccc 100644 --- a/ext/mbstring/libmbfl/filters/mbfilter_base64.c +++ b/ext/mbstring/libmbfl/filters/mbfilter_base64.c @@ -41,7 +41,9 @@ const mbfl_encoding mbfl_encoding_base64 = { "BASE64", NULL, NULL, - MBFL_ENCTYPE_ENC_STRM | MBFL_ENCTYPE_GL_UNSAFE + MBFL_ENCTYPE_ENC_STRM | MBFL_ENCTYPE_GL_UNSAFE, + NULL, + NULL }; const struct mbfl_convert_vtbl vtbl_8bit_b64 = { diff --git a/ext/mbstring/libmbfl/filters/mbfilter_big5.c b/ext/mbstring/libmbfl/filters/mbfilter_big5.c index 122ff4c7780ef..21aac8ea7bc0b 100644 --- a/ext/mbstring/libmbfl/filters/mbfilter_big5.c +++ b/ext/mbstring/libmbfl/filters/mbfilter_big5.c @@ -65,7 +65,9 @@ const mbfl_encoding mbfl_encoding_big5 = { "BIG5", (const char *(*)[])&mbfl_encoding_big5_aliases, mblen_table_big5, - MBFL_ENCTYPE_MBCS | MBFL_ENCTYPE_GL_UNSAFE + MBFL_ENCTYPE_MBCS | MBFL_ENCTYPE_GL_UNSAFE, + &vtbl_big5_wchar, + &vtbl_wchar_big5 }; const mbfl_encoding mbfl_encoding_cp950 = { @@ -74,7 +76,9 @@ const mbfl_encoding mbfl_encoding_cp950 = { "BIG5", NULL, mblen_table_big5, - MBFL_ENCTYPE_MBCS | MBFL_ENCTYPE_GL_UNSAFE + MBFL_ENCTYPE_MBCS | MBFL_ENCTYPE_GL_UNSAFE, + &vtbl_cp950_wchar, + &vtbl_wchar_cp950 }; const struct mbfl_identify_vtbl vtbl_identify_big5 = { diff --git a/ext/mbstring/libmbfl/filters/mbfilter_byte2.c b/ext/mbstring/libmbfl/filters/mbfilter_byte2.c index 7452c127fca18..9be0fb9ae86d0 100644 --- a/ext/mbstring/libmbfl/filters/mbfilter_byte2.c +++ b/ext/mbstring/libmbfl/filters/mbfilter_byte2.c @@ -41,7 +41,9 @@ const mbfl_encoding mbfl_encoding_byte2be = { NULL, NULL, NULL, - MBFL_ENCTYPE_SBCS + MBFL_ENCTYPE_SBCS, + &vtbl_byte2be_wchar, + &vtbl_wchar_byte2be }; const mbfl_encoding mbfl_encoding_byte2le = { @@ -50,7 +52,9 @@ const mbfl_encoding mbfl_encoding_byte2le = { NULL, NULL, NULL, - MBFL_ENCTYPE_SBCS + MBFL_ENCTYPE_SBCS, + &vtbl_byte2le_wchar, + &vtbl_wchar_byte2le }; const struct mbfl_convert_vtbl vtbl_byte2be_wchar = { diff --git a/ext/mbstring/libmbfl/filters/mbfilter_byte4.c b/ext/mbstring/libmbfl/filters/mbfilter_byte4.c index 7475e5424c8c2..46ca04bb71dd8 100644 --- a/ext/mbstring/libmbfl/filters/mbfilter_byte4.c +++ b/ext/mbstring/libmbfl/filters/mbfilter_byte4.c @@ -41,7 +41,9 @@ const mbfl_encoding mbfl_encoding_byte4be = { NULL, NULL, NULL, - MBFL_ENCTYPE_SBCS + MBFL_ENCTYPE_SBCS, + &vtbl_byte4be_wchar, + &vtbl_wchar_byte4be }; const mbfl_encoding mbfl_encoding_byte4le = { @@ -50,7 +52,9 @@ const mbfl_encoding mbfl_encoding_byte4le = { NULL, NULL, NULL, - MBFL_ENCTYPE_SBCS + MBFL_ENCTYPE_SBCS, + &vtbl_byte4le_wchar, + &vtbl_wchar_byte4le }; const struct mbfl_convert_vtbl vtbl_byte4be_wchar = { diff --git a/ext/mbstring/libmbfl/filters/mbfilter_cp1251.c b/ext/mbstring/libmbfl/filters/mbfilter_cp1251.c index a26ce19492d52..532806fafca62 100644 --- a/ext/mbstring/libmbfl/filters/mbfilter_cp1251.c +++ b/ext/mbstring/libmbfl/filters/mbfilter_cp1251.c @@ -45,7 +45,9 @@ const mbfl_encoding mbfl_encoding_cp1251 = { "Windows-1251", (const char *(*)[])&mbfl_encoding_cp1251_aliases, NULL, - MBFL_ENCTYPE_SBCS + MBFL_ENCTYPE_SBCS, + &vtbl_cp1251_wchar, + &vtbl_wchar_cp1251 }; const struct mbfl_identify_vtbl vtbl_identify_cp1251 = { diff --git a/ext/mbstring/libmbfl/filters/mbfilter_cp1252.c b/ext/mbstring/libmbfl/filters/mbfilter_cp1252.c index 0c5eba3dd5173..6479023428ff8 100644 --- a/ext/mbstring/libmbfl/filters/mbfilter_cp1252.c +++ b/ext/mbstring/libmbfl/filters/mbfilter_cp1252.c @@ -45,7 +45,9 @@ const mbfl_encoding mbfl_encoding_cp1252 = { "Windows-1252", (const char *(*)[])&mbfl_encoding_cp1252_aliases, NULL, - MBFL_ENCTYPE_SBCS + MBFL_ENCTYPE_SBCS, + &vtbl_cp1252_wchar, + &vtbl_wchar_cp1252 }; const struct mbfl_identify_vtbl vtbl_identify_cp1252 = { diff --git a/ext/mbstring/libmbfl/filters/mbfilter_cp1254.c b/ext/mbstring/libmbfl/filters/mbfilter_cp1254.c index 78e79335e4456..b01b19fb061ff 100644 --- a/ext/mbstring/libmbfl/filters/mbfilter_cp1254.c +++ b/ext/mbstring/libmbfl/filters/mbfilter_cp1254.c @@ -45,7 +45,9 @@ const mbfl_encoding mbfl_encoding_cp1254 = { "Windows-1254", (const char *(*)[])&mbfl_encoding_cp1254_aliases, NULL, - MBFL_ENCTYPE_SBCS + MBFL_ENCTYPE_SBCS, + &vtbl_cp1254_wchar, + &vtbl_wchar_cp1254 }; const struct mbfl_identify_vtbl vtbl_identify_cp1254 = { diff --git a/ext/mbstring/libmbfl/filters/mbfilter_cp5022x.c b/ext/mbstring/libmbfl/filters/mbfilter_cp5022x.c index 75d249fbe8bac..81b655d55f856 100644 --- a/ext/mbstring/libmbfl/filters/mbfilter_cp5022x.c +++ b/ext/mbstring/libmbfl/filters/mbfilter_cp5022x.c @@ -54,7 +54,9 @@ const mbfl_encoding mbfl_encoding_jis_ms = { "ISO-2022-JP", NULL, NULL, - MBFL_ENCTYPE_MBCS | MBFL_ENCTYPE_SHFTCODE | MBFL_ENCTYPE_GL_UNSAFE + MBFL_ENCTYPE_MBCS | MBFL_ENCTYPE_SHFTCODE | MBFL_ENCTYPE_GL_UNSAFE, + &vtbl_jis_ms_wchar, + &vtbl_wchar_jis_ms }; const mbfl_encoding mbfl_encoding_cp50220 = { @@ -63,7 +65,9 @@ const mbfl_encoding mbfl_encoding_cp50220 = { "ISO-2022-JP", (const char *(*)[])NULL, NULL, - MBFL_ENCTYPE_MBCS | MBFL_ENCTYPE_SHFTCODE | MBFL_ENCTYPE_GL_UNSAFE + MBFL_ENCTYPE_MBCS | MBFL_ENCTYPE_SHFTCODE | MBFL_ENCTYPE_GL_UNSAFE, + &vtbl_cp50220_wchar, + &vtbl_wchar_cp50220 }; const mbfl_encoding mbfl_encoding_cp50220raw = { @@ -72,7 +76,9 @@ const mbfl_encoding mbfl_encoding_cp50220raw = { "ISO-2022-JP", (const char *(*)[])NULL, NULL, - MBFL_ENCTYPE_MBCS | MBFL_ENCTYPE_SHFTCODE | MBFL_ENCTYPE_GL_UNSAFE + MBFL_ENCTYPE_MBCS | MBFL_ENCTYPE_SHFTCODE | MBFL_ENCTYPE_GL_UNSAFE, + &vtbl_cp50220raw_wchar, + &vtbl_wchar_cp50220raw }; const mbfl_encoding mbfl_encoding_cp50221 = { @@ -81,7 +87,9 @@ const mbfl_encoding mbfl_encoding_cp50221 = { "ISO-2022-JP", NULL, NULL, - MBFL_ENCTYPE_MBCS | MBFL_ENCTYPE_SHFTCODE | MBFL_ENCTYPE_GL_UNSAFE + MBFL_ENCTYPE_MBCS | MBFL_ENCTYPE_SHFTCODE | MBFL_ENCTYPE_GL_UNSAFE, + &vtbl_cp50221_wchar, + &vtbl_wchar_cp50221 }; const mbfl_encoding mbfl_encoding_cp50222 = { @@ -90,7 +98,9 @@ const mbfl_encoding mbfl_encoding_cp50222 = { "ISO-2022-JP", NULL, NULL, - MBFL_ENCTYPE_MBCS | MBFL_ENCTYPE_SHFTCODE | MBFL_ENCTYPE_GL_UNSAFE + MBFL_ENCTYPE_MBCS | MBFL_ENCTYPE_SHFTCODE | MBFL_ENCTYPE_GL_UNSAFE, + &vtbl_cp50222_wchar, + &vtbl_wchar_cp50222 }; const struct mbfl_identify_vtbl vtbl_identify_jis_ms = { diff --git a/ext/mbstring/libmbfl/filters/mbfilter_cp51932.c b/ext/mbstring/libmbfl/filters/mbfilter_cp51932.c index aae45380c84d3..057d6c6f917ae 100644 --- a/ext/mbstring/libmbfl/filters/mbfilter_cp51932.c +++ b/ext/mbstring/libmbfl/filters/mbfilter_cp51932.c @@ -75,7 +75,9 @@ const mbfl_encoding mbfl_encoding_cp51932 = { "CP51932", (const char *(*)[])&mbfl_encoding_cp51932_aliases, mblen_table_eucjp, - MBFL_ENCTYPE_MBCS + MBFL_ENCTYPE_MBCS, + &vtbl_cp51932_wchar, + &vtbl_wchar_cp51932 }; const struct mbfl_convert_vtbl vtbl_cp51932_wchar = { diff --git a/ext/mbstring/libmbfl/filters/mbfilter_cp850.c b/ext/mbstring/libmbfl/filters/mbfilter_cp850.c index 179873eb3a0ac..25ec247c78049 100644 --- a/ext/mbstring/libmbfl/filters/mbfilter_cp850.c +++ b/ext/mbstring/libmbfl/filters/mbfilter_cp850.c @@ -41,7 +41,9 @@ const mbfl_encoding mbfl_encoding_cp850 = { "CP850", (const char *(*)[])&mbfl_encoding_cp850_aliases, NULL, - MBFL_ENCTYPE_SBCS + MBFL_ENCTYPE_SBCS, + &vtbl_cp850_wchar, + &vtbl_wchar_cp850 }; const struct mbfl_identify_vtbl vtbl_identify_cp850 = { diff --git a/ext/mbstring/libmbfl/filters/mbfilter_cp866.c b/ext/mbstring/libmbfl/filters/mbfilter_cp866.c index 307f370d03c26..95b681243b5c1 100644 --- a/ext/mbstring/libmbfl/filters/mbfilter_cp866.c +++ b/ext/mbstring/libmbfl/filters/mbfilter_cp866.c @@ -45,7 +45,9 @@ const mbfl_encoding mbfl_encoding_cp866 = { "CP866", (const char *(*)[])&mbfl_encoding_cp866_aliases, NULL, - MBFL_ENCTYPE_SBCS + MBFL_ENCTYPE_SBCS, + &vtbl_cp866_wchar, + &vtbl_wchar_cp866 }; const struct mbfl_identify_vtbl vtbl_identify_cp866 = { diff --git a/ext/mbstring/libmbfl/filters/mbfilter_cp932.c b/ext/mbstring/libmbfl/filters/mbfilter_cp932.c index 4063a68208aed..e6cbd5fc43bba 100644 --- a/ext/mbstring/libmbfl/filters/mbfilter_cp932.c +++ b/ext/mbstring/libmbfl/filters/mbfilter_cp932.c @@ -66,7 +66,9 @@ const mbfl_encoding mbfl_encoding_cp932 = { "Shift_JIS", (const char *(*)[])&mbfl_encoding_cp932_aliases, mblen_table_sjis, - MBFL_ENCTYPE_MBCS | MBFL_ENCTYPE_GL_UNSAFE + MBFL_ENCTYPE_MBCS | MBFL_ENCTYPE_GL_UNSAFE, + &vtbl_cp932_wchar, + &vtbl_wchar_cp932 }; const struct mbfl_identify_vtbl vtbl_identify_cp932 = { diff --git a/ext/mbstring/libmbfl/filters/mbfilter_cp936.c b/ext/mbstring/libmbfl/filters/mbfilter_cp936.c index 23e3a1d847226..047eb62a14023 100644 --- a/ext/mbstring/libmbfl/filters/mbfilter_cp936.c +++ b/ext/mbstring/libmbfl/filters/mbfilter_cp936.c @@ -65,7 +65,9 @@ const mbfl_encoding mbfl_encoding_cp936 = { "CP936", (const char *(*)[])&mbfl_encoding_cp936_aliases, mblen_table_cp936, - MBFL_ENCTYPE_MBCS | MBFL_ENCTYPE_GL_UNSAFE + MBFL_ENCTYPE_MBCS | MBFL_ENCTYPE_GL_UNSAFE, + &vtbl_cp936_wchar, + &vtbl_wchar_cp936 }; const struct mbfl_identify_vtbl vtbl_identify_cp936 = { diff --git a/ext/mbstring/libmbfl/filters/mbfilter_euc_cn.c b/ext/mbstring/libmbfl/filters/mbfilter_euc_cn.c index bf3ec25ee7aad..7fd3d7c315eb8 100644 --- a/ext/mbstring/libmbfl/filters/mbfilter_euc_cn.c +++ b/ext/mbstring/libmbfl/filters/mbfilter_euc_cn.c @@ -65,7 +65,9 @@ const mbfl_encoding mbfl_encoding_euc_cn = { "CN-GB", (const char *(*)[])&mbfl_encoding_euc_cn_aliases, mblen_table_euccn, - MBFL_ENCTYPE_MBCS + MBFL_ENCTYPE_MBCS, + &vtbl_euccn_wchar, + &vtbl_wchar_euccn }; const struct mbfl_identify_vtbl vtbl_identify_euccn = { diff --git a/ext/mbstring/libmbfl/filters/mbfilter_euc_jp.c b/ext/mbstring/libmbfl/filters/mbfilter_euc_jp.c index 3b13850882d34..ba794934b0a0d 100644 --- a/ext/mbstring/libmbfl/filters/mbfilter_euc_jp.c +++ b/ext/mbstring/libmbfl/filters/mbfilter_euc_jp.c @@ -66,7 +66,9 @@ const mbfl_encoding mbfl_encoding_euc_jp = { "EUC-JP", (const char *(*)[])&mbfl_encoding_euc_jp_aliases, mblen_table_eucjp, - MBFL_ENCTYPE_MBCS + MBFL_ENCTYPE_MBCS, + &vtbl_eucjp_wchar, + &vtbl_wchar_eucjp }; const struct mbfl_identify_vtbl vtbl_identify_eucjp = { diff --git a/ext/mbstring/libmbfl/filters/mbfilter_euc_jp_2004.c b/ext/mbstring/libmbfl/filters/mbfilter_euc_jp_2004.c index aeb94c388d785..2fe24e0f57c17 100644 --- a/ext/mbstring/libmbfl/filters/mbfilter_euc_jp_2004.c +++ b/ext/mbstring/libmbfl/filters/mbfilter_euc_jp_2004.c @@ -48,7 +48,9 @@ const mbfl_encoding mbfl_encoding_eucjp2004 = { "EUC-JP", (const char *(*)[])&mbfl_encoding_eucjp2004_aliases, mblen_table_eucjp, - MBFL_ENCTYPE_MBCS + MBFL_ENCTYPE_MBCS, + &vtbl_eucjp2004_wchar, + &vtbl_wchar_eucjp2004 }; const struct mbfl_identify_vtbl vtbl_identify_eucjp2004 = { diff --git a/ext/mbstring/libmbfl/filters/mbfilter_euc_jp_win.c b/ext/mbstring/libmbfl/filters/mbfilter_euc_jp_win.c index 95aec45f4dd97..912ae7350434c 100644 --- a/ext/mbstring/libmbfl/filters/mbfilter_euc_jp_win.c +++ b/ext/mbstring/libmbfl/filters/mbfilter_euc_jp_win.c @@ -76,7 +76,9 @@ const mbfl_encoding mbfl_encoding_eucjp_win = { "EUC-JP", (const char *(*)[])&mbfl_encoding_eucjp_win_aliases, mblen_table_eucjp, - MBFL_ENCTYPE_MBCS + MBFL_ENCTYPE_MBCS, + &vtbl_eucjpwin_wchar, + &vtbl_wchar_eucjpwin }; const struct mbfl_convert_vtbl vtbl_eucjpwin_wchar = { diff --git a/ext/mbstring/libmbfl/filters/mbfilter_euc_kr.c b/ext/mbstring/libmbfl/filters/mbfilter_euc_kr.c index 2a537ade6e8ba..ee8dc926f0865 100644 --- a/ext/mbstring/libmbfl/filters/mbfilter_euc_kr.c +++ b/ext/mbstring/libmbfl/filters/mbfilter_euc_kr.c @@ -64,7 +64,9 @@ const mbfl_encoding mbfl_encoding_euc_kr = { "EUC-KR", (const char *(*)[])&mbfl_encoding_euc_kr_aliases, mblen_table_euckr, - MBFL_ENCTYPE_MBCS + MBFL_ENCTYPE_MBCS, + &vtbl_euckr_wchar, + &vtbl_wchar_euckr }; const struct mbfl_identify_vtbl vtbl_identify_euckr = { diff --git a/ext/mbstring/libmbfl/filters/mbfilter_gb18030.c b/ext/mbstring/libmbfl/filters/mbfilter_gb18030.c index 721c16292b067..b7687b6c31ab5 100644 --- a/ext/mbstring/libmbfl/filters/mbfilter_gb18030.c +++ b/ext/mbstring/libmbfl/filters/mbfilter_gb18030.c @@ -47,7 +47,9 @@ const mbfl_encoding mbfl_encoding_gb18030 = { "GB18030", (const char *(*)[])&mbfl_encoding_gb18030_aliases, NULL, - MBFL_ENCTYPE_MBCS | MBFL_ENCTYPE_GL_UNSAFE + MBFL_ENCTYPE_MBCS | MBFL_ENCTYPE_GL_UNSAFE, + &vtbl_gb18030_wchar, + &vtbl_wchar_gb18030 }; const struct mbfl_identify_vtbl vtbl_identify_gb18030 = { diff --git a/ext/mbstring/libmbfl/filters/mbfilter_htmlent.c b/ext/mbstring/libmbfl/filters/mbfilter_htmlent.c index 03b26cc0b7396..12ff178b61211 100644 --- a/ext/mbstring/libmbfl/filters/mbfilter_htmlent.c +++ b/ext/mbstring/libmbfl/filters/mbfilter_htmlent.c @@ -70,7 +70,9 @@ const mbfl_encoding mbfl_encoding_html_ent = { "HTML-ENTITIES", (const char *(*)[])&mbfl_encoding_html_ent_aliases, NULL, - MBFL_ENCTYPE_ENC_STRM | MBFL_ENCTYPE_GL_UNSAFE + MBFL_ENCTYPE_ENC_STRM | MBFL_ENCTYPE_GL_UNSAFE, + &vtbl_html_wchar, + &vtbl_wchar_html }; const struct mbfl_convert_vtbl vtbl_wchar_html = { diff --git a/ext/mbstring/libmbfl/filters/mbfilter_hz.c b/ext/mbstring/libmbfl/filters/mbfilter_hz.c index a3422cd8e5e76..8a39b75e170f8 100644 --- a/ext/mbstring/libmbfl/filters/mbfilter_hz.c +++ b/ext/mbstring/libmbfl/filters/mbfilter_hz.c @@ -44,7 +44,9 @@ const mbfl_encoding mbfl_encoding_hz = { "HZ-GB-2312", NULL, NULL, - MBFL_ENCTYPE_MBCS | MBFL_ENCTYPE_SHFTCODE | MBFL_ENCTYPE_GL_UNSAFE + MBFL_ENCTYPE_MBCS | MBFL_ENCTYPE_SHFTCODE | MBFL_ENCTYPE_GL_UNSAFE, + &vtbl_hz_wchar, + &vtbl_wchar_hz }; const struct mbfl_identify_vtbl vtbl_identify_hz = { diff --git a/ext/mbstring/libmbfl/filters/mbfilter_iso2022_jp_ms.c b/ext/mbstring/libmbfl/filters/mbfilter_iso2022_jp_ms.c index 1f26d1771b232..4e8b974923ded 100644 --- a/ext/mbstring/libmbfl/filters/mbfilter_iso2022_jp_ms.c +++ b/ext/mbstring/libmbfl/filters/mbfilter_iso2022_jp_ms.c @@ -48,7 +48,9 @@ const mbfl_encoding mbfl_encoding_2022jpms = { "ISO-2022-JP", (const char *(*)[])&mbfl_encoding_2022jpms_aliases, NULL, - MBFL_ENCTYPE_MBCS | MBFL_ENCTYPE_SHFTCODE | MBFL_ENCTYPE_GL_UNSAFE + MBFL_ENCTYPE_MBCS | MBFL_ENCTYPE_SHFTCODE | MBFL_ENCTYPE_GL_UNSAFE, + &vtbl_2022jpms_wchar, + &vtbl_wchar_2022jpms }; const struct mbfl_identify_vtbl vtbl_identify_2022jpms = { diff --git a/ext/mbstring/libmbfl/filters/mbfilter_iso2022_kr.c b/ext/mbstring/libmbfl/filters/mbfilter_iso2022_kr.c index 501bcb8d19759..c1fe9f1222426 100644 --- a/ext/mbstring/libmbfl/filters/mbfilter_iso2022_kr.c +++ b/ext/mbstring/libmbfl/filters/mbfilter_iso2022_kr.c @@ -43,7 +43,9 @@ const mbfl_encoding mbfl_encoding_2022kr = { "ISO-2022-KR", NULL, NULL, - MBFL_ENCTYPE_MBCS | MBFL_ENCTYPE_SHFTCODE | MBFL_ENCTYPE_GL_UNSAFE + MBFL_ENCTYPE_MBCS | MBFL_ENCTYPE_SHFTCODE | MBFL_ENCTYPE_GL_UNSAFE, + &vtbl_2022kr_wchar, + &vtbl_wchar_2022kr }; const struct mbfl_identify_vtbl vtbl_identify_2022kr = { diff --git a/ext/mbstring/libmbfl/filters/mbfilter_iso2022jp_2004.c b/ext/mbstring/libmbfl/filters/mbfilter_iso2022jp_2004.c index fc6678ecb6936..17355bf87bc48 100644 --- a/ext/mbstring/libmbfl/filters/mbfilter_iso2022jp_2004.c +++ b/ext/mbstring/libmbfl/filters/mbfilter_iso2022jp_2004.c @@ -47,7 +47,9 @@ const mbfl_encoding mbfl_encoding_2022jp_2004 = { "ISO-2022-JP-2004", NULL, NULL, - MBFL_ENCTYPE_MBCS | MBFL_ENCTYPE_SHFTCODE | MBFL_ENCTYPE_GL_UNSAFE + MBFL_ENCTYPE_MBCS | MBFL_ENCTYPE_SHFTCODE | MBFL_ENCTYPE_GL_UNSAFE, + &vtbl_2022jp_2004_wchar, + &vtbl_wchar_2022jp_2004 }; const struct mbfl_identify_vtbl vtbl_identify_2022jp_2004 = { diff --git a/ext/mbstring/libmbfl/filters/mbfilter_iso2022jp_mobile.c b/ext/mbstring/libmbfl/filters/mbfilter_iso2022jp_mobile.c index e0d5543882c03..3847f78aa16c9 100644 --- a/ext/mbstring/libmbfl/filters/mbfilter_iso2022jp_mobile.c +++ b/ext/mbstring/libmbfl/filters/mbfilter_iso2022jp_mobile.c @@ -50,7 +50,9 @@ const mbfl_encoding mbfl_encoding_2022jp_kddi = { "ISO-2022-JP", &mbfl_encoding_2022jp_kddi_aliases, NULL, - MBFL_ENCTYPE_MBCS | MBFL_ENCTYPE_SHFTCODE | MBFL_ENCTYPE_GL_UNSAFE + MBFL_ENCTYPE_MBCS | MBFL_ENCTYPE_SHFTCODE | MBFL_ENCTYPE_GL_UNSAFE, + &vtbl_2022jp_kddi_wchar, + &vtbl_wchar_2022jp_kddi }; const struct mbfl_identify_vtbl vtbl_identify_2022jp_kddi = { diff --git a/ext/mbstring/libmbfl/filters/mbfilter_iso8859_1.c b/ext/mbstring/libmbfl/filters/mbfilter_iso8859_1.c index 382d0c2294ece..239d74e381b8d 100644 --- a/ext/mbstring/libmbfl/filters/mbfilter_iso8859_1.c +++ b/ext/mbstring/libmbfl/filters/mbfilter_iso8859_1.c @@ -42,7 +42,9 @@ const mbfl_encoding mbfl_encoding_8859_1 = { "ISO-8859-1", (const char *(*)[])&mbfl_encoding_8859_1_aliases, NULL, - MBFL_ENCTYPE_SBCS + MBFL_ENCTYPE_SBCS, + &vtbl_8859_1_wchar, + &vtbl_wchar_8859_1 }; const struct mbfl_identify_vtbl vtbl_identify_8859_1 = { diff --git a/ext/mbstring/libmbfl/filters/mbfilter_iso8859_10.c b/ext/mbstring/libmbfl/filters/mbfilter_iso8859_10.c index f6d1b21b5543c..0fb6bc88cb78e 100644 --- a/ext/mbstring/libmbfl/filters/mbfilter_iso8859_10.c +++ b/ext/mbstring/libmbfl/filters/mbfilter_iso8859_10.c @@ -43,7 +43,9 @@ const mbfl_encoding mbfl_encoding_8859_10 = { "ISO-8859-10", (const char *(*)[])&mbfl_encoding_8859_10_aliases, NULL, - MBFL_ENCTYPE_SBCS + MBFL_ENCTYPE_SBCS, + &vtbl_8859_10_wchar, + &vtbl_wchar_8859_10 }; const struct mbfl_identify_vtbl vtbl_identify_8859_10 = { diff --git a/ext/mbstring/libmbfl/filters/mbfilter_iso8859_13.c b/ext/mbstring/libmbfl/filters/mbfilter_iso8859_13.c index cbc8f77d87938..2b2494baa5069 100644 --- a/ext/mbstring/libmbfl/filters/mbfilter_iso8859_13.c +++ b/ext/mbstring/libmbfl/filters/mbfilter_iso8859_13.c @@ -43,7 +43,9 @@ const mbfl_encoding mbfl_encoding_8859_13 = { "ISO-8859-13", (const char *(*)[])&mbfl_encoding_8859_13_aliases, NULL, - MBFL_ENCTYPE_SBCS + MBFL_ENCTYPE_SBCS, + &vtbl_8859_13_wchar, + &vtbl_wchar_8859_13 }; const struct mbfl_identify_vtbl vtbl_identify_8859_13 = { diff --git a/ext/mbstring/libmbfl/filters/mbfilter_iso8859_14.c b/ext/mbstring/libmbfl/filters/mbfilter_iso8859_14.c index 03581ccf45c97..eb008b8f04238 100644 --- a/ext/mbstring/libmbfl/filters/mbfilter_iso8859_14.c +++ b/ext/mbstring/libmbfl/filters/mbfilter_iso8859_14.c @@ -43,7 +43,9 @@ const mbfl_encoding mbfl_encoding_8859_14 = { "ISO-8859-14", (const char *(*)[])&mbfl_encoding_8859_14_aliases, NULL, - MBFL_ENCTYPE_SBCS + MBFL_ENCTYPE_SBCS, + &vtbl_8859_14_wchar, + &vtbl_wchar_8859_14 }; const struct mbfl_identify_vtbl vtbl_identify_8859_14 = { diff --git a/ext/mbstring/libmbfl/filters/mbfilter_iso8859_15.c b/ext/mbstring/libmbfl/filters/mbfilter_iso8859_15.c index 25323bd7f0890..74e5a2dde7375 100644 --- a/ext/mbstring/libmbfl/filters/mbfilter_iso8859_15.c +++ b/ext/mbstring/libmbfl/filters/mbfilter_iso8859_15.c @@ -43,7 +43,9 @@ const mbfl_encoding mbfl_encoding_8859_15 = { "ISO-8859-15", (const char *(*)[])&mbfl_encoding_8859_15_aliases, NULL, - MBFL_ENCTYPE_SBCS + MBFL_ENCTYPE_SBCS, + &vtbl_8859_15_wchar, + &vtbl_wchar_8859_15 }; const struct mbfl_identify_vtbl vtbl_identify_8859_15 = { diff --git a/ext/mbstring/libmbfl/filters/mbfilter_iso8859_16.c b/ext/mbstring/libmbfl/filters/mbfilter_iso8859_16.c index 1bd5f8a25d9c1..68da24f5339f2 100644 --- a/ext/mbstring/libmbfl/filters/mbfilter_iso8859_16.c +++ b/ext/mbstring/libmbfl/filters/mbfilter_iso8859_16.c @@ -43,7 +43,9 @@ const mbfl_encoding mbfl_encoding_8859_16 = { "ISO-8859-16", (const char *(*)[])&mbfl_encoding_8859_16_aliases, NULL, - MBFL_ENCTYPE_SBCS + MBFL_ENCTYPE_SBCS, + &vtbl_8859_16_wchar, + &vtbl_wchar_8859_16 }; const struct mbfl_identify_vtbl vtbl_identify_8859_16 = { diff --git a/ext/mbstring/libmbfl/filters/mbfilter_iso8859_2.c b/ext/mbstring/libmbfl/filters/mbfilter_iso8859_2.c index 50649ddeb6d86..ec1b2bc172029 100644 --- a/ext/mbstring/libmbfl/filters/mbfilter_iso8859_2.c +++ b/ext/mbstring/libmbfl/filters/mbfilter_iso8859_2.c @@ -43,7 +43,9 @@ const mbfl_encoding mbfl_encoding_8859_2 = { "ISO-8859-2", (const char *(*)[])&mbfl_encoding_8859_2_aliases, NULL, - MBFL_ENCTYPE_SBCS + MBFL_ENCTYPE_SBCS, + &vtbl_8859_2_wchar, + &vtbl_wchar_8859_2 }; const struct mbfl_identify_vtbl vtbl_identify_8859_2 = { diff --git a/ext/mbstring/libmbfl/filters/mbfilter_iso8859_3.c b/ext/mbstring/libmbfl/filters/mbfilter_iso8859_3.c index e1897069eb6ef..f3905ac46ed7b 100644 --- a/ext/mbstring/libmbfl/filters/mbfilter_iso8859_3.c +++ b/ext/mbstring/libmbfl/filters/mbfilter_iso8859_3.c @@ -43,7 +43,9 @@ const mbfl_encoding mbfl_encoding_8859_3 = { "ISO-8859-3", (const char *(*)[])&mbfl_encoding_8859_3_aliases, NULL, - MBFL_ENCTYPE_SBCS + MBFL_ENCTYPE_SBCS, + &vtbl_8859_3_wchar, + &vtbl_wchar_8859_3 }; const struct mbfl_identify_vtbl vtbl_identify_8859_3 = { diff --git a/ext/mbstring/libmbfl/filters/mbfilter_iso8859_4.c b/ext/mbstring/libmbfl/filters/mbfilter_iso8859_4.c index a04910eb78e60..19e105a6b8c6e 100644 --- a/ext/mbstring/libmbfl/filters/mbfilter_iso8859_4.c +++ b/ext/mbstring/libmbfl/filters/mbfilter_iso8859_4.c @@ -43,7 +43,9 @@ const mbfl_encoding mbfl_encoding_8859_4 = { "ISO-8859-4", (const char *(*)[])&mbfl_encoding_8859_4_aliases, NULL, - MBFL_ENCTYPE_SBCS + MBFL_ENCTYPE_SBCS, + &vtbl_8859_4_wchar, + &vtbl_wchar_8859_4 }; const struct mbfl_identify_vtbl vtbl_identify_8859_4 = { diff --git a/ext/mbstring/libmbfl/filters/mbfilter_iso8859_5.c b/ext/mbstring/libmbfl/filters/mbfilter_iso8859_5.c index 0bd4d5e1555fd..ac3b2d20892f4 100644 --- a/ext/mbstring/libmbfl/filters/mbfilter_iso8859_5.c +++ b/ext/mbstring/libmbfl/filters/mbfilter_iso8859_5.c @@ -43,7 +43,9 @@ const mbfl_encoding mbfl_encoding_8859_5 = { "ISO-8859-5", (const char *(*)[])&mbfl_encoding_8859_5_aliases, NULL, - MBFL_ENCTYPE_SBCS + MBFL_ENCTYPE_SBCS, + &vtbl_8859_5_wchar, + &vtbl_wchar_8859_5 }; const struct mbfl_identify_vtbl vtbl_identify_8859_5 = { diff --git a/ext/mbstring/libmbfl/filters/mbfilter_iso8859_6.c b/ext/mbstring/libmbfl/filters/mbfilter_iso8859_6.c index df89eb75babe9..c5bbdd7eec8df 100644 --- a/ext/mbstring/libmbfl/filters/mbfilter_iso8859_6.c +++ b/ext/mbstring/libmbfl/filters/mbfilter_iso8859_6.c @@ -43,7 +43,9 @@ const mbfl_encoding mbfl_encoding_8859_6 = { "ISO-8859-6", (const char *(*)[])&mbfl_encoding_8859_6_aliases, NULL, - MBFL_ENCTYPE_SBCS + MBFL_ENCTYPE_SBCS, + &vtbl_8859_6_wchar, + &vtbl_wchar_8859_6 }; const struct mbfl_identify_vtbl vtbl_identify_8859_6 = { diff --git a/ext/mbstring/libmbfl/filters/mbfilter_iso8859_7.c b/ext/mbstring/libmbfl/filters/mbfilter_iso8859_7.c index d8d4494a2255b..98ffade2e7514 100644 --- a/ext/mbstring/libmbfl/filters/mbfilter_iso8859_7.c +++ b/ext/mbstring/libmbfl/filters/mbfilter_iso8859_7.c @@ -43,7 +43,9 @@ const mbfl_encoding mbfl_encoding_8859_7 = { "ISO-8859-7", (const char *(*)[])&mbfl_encoding_8859_7_aliases, NULL, - MBFL_ENCTYPE_SBCS + MBFL_ENCTYPE_SBCS, + &vtbl_8859_7_wchar, + &vtbl_wchar_8859_7 }; const struct mbfl_identify_vtbl vtbl_identify_8859_7 = { diff --git a/ext/mbstring/libmbfl/filters/mbfilter_iso8859_8.c b/ext/mbstring/libmbfl/filters/mbfilter_iso8859_8.c index fad0f5c51e13d..3d65ce630a305 100644 --- a/ext/mbstring/libmbfl/filters/mbfilter_iso8859_8.c +++ b/ext/mbstring/libmbfl/filters/mbfilter_iso8859_8.c @@ -43,7 +43,9 @@ const mbfl_encoding mbfl_encoding_8859_8 = { "ISO-8859-8", (const char *(*)[])&mbfl_encoding_8859_8_aliases, NULL, - MBFL_ENCTYPE_SBCS + MBFL_ENCTYPE_SBCS, + &vtbl_8859_8_wchar, + &vtbl_wchar_8859_8 }; const struct mbfl_identify_vtbl vtbl_identify_8859_8 = { diff --git a/ext/mbstring/libmbfl/filters/mbfilter_iso8859_9.c b/ext/mbstring/libmbfl/filters/mbfilter_iso8859_9.c index 97948d0ff6140..8a730ae43e404 100644 --- a/ext/mbstring/libmbfl/filters/mbfilter_iso8859_9.c +++ b/ext/mbstring/libmbfl/filters/mbfilter_iso8859_9.c @@ -43,7 +43,9 @@ const mbfl_encoding mbfl_encoding_8859_9 = { "ISO-8859-9", (const char *(*)[])&mbfl_encoding_8859_9_aliases, NULL, - MBFL_ENCTYPE_SBCS + MBFL_ENCTYPE_SBCS, + &vtbl_8859_9_wchar, + &vtbl_wchar_8859_9 }; const struct mbfl_identify_vtbl vtbl_identify_8859_9 = { diff --git a/ext/mbstring/libmbfl/filters/mbfilter_jis.c b/ext/mbstring/libmbfl/filters/mbfilter_jis.c index b3fbb4f94bfe8..88395cb09ef4f 100644 --- a/ext/mbstring/libmbfl/filters/mbfilter_jis.c +++ b/ext/mbstring/libmbfl/filters/mbfilter_jis.c @@ -46,7 +46,9 @@ const mbfl_encoding mbfl_encoding_jis = { "ISO-2022-JP", NULL, NULL, - MBFL_ENCTYPE_MBCS | MBFL_ENCTYPE_SHFTCODE | MBFL_ENCTYPE_GL_UNSAFE + MBFL_ENCTYPE_MBCS | MBFL_ENCTYPE_SHFTCODE | MBFL_ENCTYPE_GL_UNSAFE, + &vtbl_jis_wchar, + &vtbl_wchar_jis }; const mbfl_encoding mbfl_encoding_2022jp = { @@ -55,7 +57,9 @@ const mbfl_encoding mbfl_encoding_2022jp = { "ISO-2022-JP", NULL, NULL, - MBFL_ENCTYPE_MBCS | MBFL_ENCTYPE_SHFTCODE | MBFL_ENCTYPE_GL_UNSAFE + MBFL_ENCTYPE_MBCS | MBFL_ENCTYPE_SHFTCODE | MBFL_ENCTYPE_GL_UNSAFE, + &vtbl_2022jp_wchar, + &vtbl_wchar_2022jp }; const struct mbfl_identify_vtbl vtbl_identify_jis = { diff --git a/ext/mbstring/libmbfl/filters/mbfilter_koi8r.c b/ext/mbstring/libmbfl/filters/mbfilter_koi8r.c index e35a0258ac6af..101b3f1c85bf2 100644 --- a/ext/mbstring/libmbfl/filters/mbfilter_koi8r.c +++ b/ext/mbstring/libmbfl/filters/mbfilter_koi8r.c @@ -45,7 +45,9 @@ const mbfl_encoding mbfl_encoding_koi8r = { "KOI8-R", (const char *(*)[])&mbfl_encoding_koi8r_aliases, NULL, - MBFL_ENCTYPE_SBCS + MBFL_ENCTYPE_SBCS, + &vtbl_koi8r_wchar, + &vtbl_wchar_koi8r }; const struct mbfl_identify_vtbl vtbl_identify_koi8r = { diff --git a/ext/mbstring/libmbfl/filters/mbfilter_koi8u.c b/ext/mbstring/libmbfl/filters/mbfilter_koi8u.c index 4dfc68654acb5..25174326f703f 100644 --- a/ext/mbstring/libmbfl/filters/mbfilter_koi8u.c +++ b/ext/mbstring/libmbfl/filters/mbfilter_koi8u.c @@ -42,7 +42,9 @@ const mbfl_encoding mbfl_encoding_koi8u = { "KOI8-U", (const char *(*)[])&mbfl_encoding_koi8u_aliases, NULL, - MBFL_ENCTYPE_SBCS + MBFL_ENCTYPE_SBCS, + &vtbl_koi8u_wchar, + &vtbl_wchar_koi8u }; const struct mbfl_identify_vtbl vtbl_identify_koi8u = { diff --git a/ext/mbstring/libmbfl/filters/mbfilter_qprint.c b/ext/mbstring/libmbfl/filters/mbfilter_qprint.c index c141dc41024b5..b72724f4f18cc 100644 --- a/ext/mbstring/libmbfl/filters/mbfilter_qprint.c +++ b/ext/mbstring/libmbfl/filters/mbfilter_qprint.c @@ -43,7 +43,9 @@ const mbfl_encoding mbfl_encoding_qprint = { "Quoted-Printable", (const char *(*)[])&mbfl_encoding_qprint_aliases, NULL, - MBFL_ENCTYPE_ENC_STRM | MBFL_ENCTYPE_GL_UNSAFE + MBFL_ENCTYPE_ENC_STRM | MBFL_ENCTYPE_GL_UNSAFE, + NULL, + NULL }; const struct mbfl_convert_vtbl vtbl_8bit_qprint = { diff --git a/ext/mbstring/libmbfl/filters/mbfilter_sjis.c b/ext/mbstring/libmbfl/filters/mbfilter_sjis.c index 782e0dfaf93f9..33b1e1f6fe536 100644 --- a/ext/mbstring/libmbfl/filters/mbfilter_sjis.c +++ b/ext/mbstring/libmbfl/filters/mbfilter_sjis.c @@ -69,7 +69,9 @@ const mbfl_encoding mbfl_encoding_sjis = { "Shift_JIS", (const char *(*)[])&mbfl_encoding_sjis_aliases, mblen_table_sjis, - MBFL_ENCTYPE_MBCS | MBFL_ENCTYPE_GL_UNSAFE + MBFL_ENCTYPE_MBCS | MBFL_ENCTYPE_GL_UNSAFE, + &vtbl_sjis_wchar, + &vtbl_wchar_sjis }; const struct mbfl_identify_vtbl vtbl_identify_sjis = { diff --git a/ext/mbstring/libmbfl/filters/mbfilter_sjis_2004.c b/ext/mbstring/libmbfl/filters/mbfilter_sjis_2004.c index 4f146cebea809..dd37bbabba610 100644 --- a/ext/mbstring/libmbfl/filters/mbfilter_sjis_2004.c +++ b/ext/mbstring/libmbfl/filters/mbfilter_sjis_2004.c @@ -53,7 +53,9 @@ const mbfl_encoding mbfl_encoding_sjis2004 = { "Shift_JIS", (const char *(*)[])&mbfl_encoding_sjis2004_aliases, mblen_table_sjis, - MBFL_ENCTYPE_MBCS | MBFL_ENCTYPE_GL_UNSAFE + MBFL_ENCTYPE_MBCS | MBFL_ENCTYPE_GL_UNSAFE, + &vtbl_sjis2004_wchar, + &vtbl_wchar_sjis2004 }; const struct mbfl_identify_vtbl vtbl_identify_sjis2004 = { diff --git a/ext/mbstring/libmbfl/filters/mbfilter_sjis_mac.c b/ext/mbstring/libmbfl/filters/mbfilter_sjis_mac.c index 2087786c0665f..ff08cf3daef6a 100644 --- a/ext/mbstring/libmbfl/filters/mbfilter_sjis_mac.c +++ b/ext/mbstring/libmbfl/filters/mbfilter_sjis_mac.c @@ -52,7 +52,9 @@ const mbfl_encoding mbfl_encoding_sjis_mac = { "Shift_JIS", (const char *(*)[])&mbfl_encoding_sjis_mac_aliases, mblen_table_sjis, - MBFL_ENCTYPE_MBCS | MBFL_ENCTYPE_GL_UNSAFE + MBFL_ENCTYPE_MBCS | MBFL_ENCTYPE_GL_UNSAFE, + &vtbl_sjis_mac_wchar, + &vtbl_wchar_sjis_mac }; const struct mbfl_identify_vtbl vtbl_identify_sjis_mac = { diff --git a/ext/mbstring/libmbfl/filters/mbfilter_sjis_mobile.c b/ext/mbstring/libmbfl/filters/mbfilter_sjis_mobile.c index a856aa3d469e7..ca3d437dfa46f 100644 --- a/ext/mbstring/libmbfl/filters/mbfilter_sjis_mobile.c +++ b/ext/mbstring/libmbfl/filters/mbfilter_sjis_mobile.c @@ -54,7 +54,9 @@ const mbfl_encoding mbfl_encoding_sjis_docomo = { "Shift_JIS", (const char *(*)[])&mbfl_encoding_sjis_docomo_aliases, mblen_table_sjis, - MBFL_ENCTYPE_MBCS | MBFL_ENCTYPE_GL_UNSAFE + MBFL_ENCTYPE_MBCS | MBFL_ENCTYPE_GL_UNSAFE, + &vtbl_sjis_docomo_wchar, + &vtbl_wchar_sjis_docomo }; const mbfl_encoding mbfl_encoding_sjis_kddi = { @@ -63,7 +65,9 @@ const mbfl_encoding mbfl_encoding_sjis_kddi = { "Shift_JIS", (const char *(*)[])&mbfl_encoding_sjis_kddi_aliases, mblen_table_sjis, - MBFL_ENCTYPE_MBCS | MBFL_ENCTYPE_GL_UNSAFE + MBFL_ENCTYPE_MBCS | MBFL_ENCTYPE_GL_UNSAFE, + &vtbl_sjis_kddi_wchar, + &vtbl_wchar_sjis_kddi }; const mbfl_encoding mbfl_encoding_sjis_sb = { @@ -72,7 +76,9 @@ const mbfl_encoding mbfl_encoding_sjis_sb = { "Shift_JIS", (const char *(*)[])&mbfl_encoding_sjis_sb_aliases, mblen_table_sjis, - MBFL_ENCTYPE_MBCS | MBFL_ENCTYPE_GL_UNSAFE + MBFL_ENCTYPE_MBCS | MBFL_ENCTYPE_GL_UNSAFE, + &vtbl_sjis_sb_wchar, + &vtbl_wchar_sjis_sb }; const struct mbfl_identify_vtbl vtbl_identify_sjis_docomo = { diff --git a/ext/mbstring/libmbfl/filters/mbfilter_sjis_open.c b/ext/mbstring/libmbfl/filters/mbfilter_sjis_open.c index 265c577e5fd5e..17e78793d8147 100644 --- a/ext/mbstring/libmbfl/filters/mbfilter_sjis_open.c +++ b/ext/mbstring/libmbfl/filters/mbfilter_sjis_open.c @@ -66,7 +66,9 @@ const mbfl_encoding mbfl_encoding_sjis_open = { "Shift_JIS", (const char *(*)[])&mbfl_encoding_sjis_open_aliases, mblen_table_sjis, - MBFL_ENCTYPE_MBCS | MBFL_ENCTYPE_GL_UNSAFE + MBFL_ENCTYPE_MBCS | MBFL_ENCTYPE_GL_UNSAFE, + &vtbl_sjis_open_wchar, + &vtbl_wchar_sjis_open }; const struct mbfl_identify_vtbl vtbl_identify_sjis_open = { diff --git a/ext/mbstring/libmbfl/filters/mbfilter_ucs2.c b/ext/mbstring/libmbfl/filters/mbfilter_ucs2.c index 32f174f60281e..08cbf6ddb1db5 100644 --- a/ext/mbstring/libmbfl/filters/mbfilter_ucs2.c +++ b/ext/mbstring/libmbfl/filters/mbfilter_ucs2.c @@ -42,7 +42,9 @@ const mbfl_encoding mbfl_encoding_ucs2 = { "UCS-2", (const char *(*)[])&mbfl_encoding_ucs2_aliases, NULL, - MBFL_ENCTYPE_WCS2BE + MBFL_ENCTYPE_WCS2BE, + &vtbl_ucs2_wchar, + &vtbl_wchar_ucs2 }; const mbfl_encoding mbfl_encoding_ucs2be = { @@ -51,7 +53,9 @@ const mbfl_encoding mbfl_encoding_ucs2be = { "UCS-2BE", NULL, NULL, - MBFL_ENCTYPE_WCS2BE + MBFL_ENCTYPE_WCS2BE, + &vtbl_ucs2be_wchar, + &vtbl_wchar_ucs2be }; const mbfl_encoding mbfl_encoding_ucs2le = { @@ -60,7 +64,9 @@ const mbfl_encoding mbfl_encoding_ucs2le = { "UCS-2LE", NULL, NULL, - MBFL_ENCTYPE_WCS2LE + MBFL_ENCTYPE_WCS2LE, + &vtbl_ucs2le_wchar, + &vtbl_wchar_ucs2le }; const struct mbfl_convert_vtbl vtbl_ucs2_wchar = { diff --git a/ext/mbstring/libmbfl/filters/mbfilter_ucs4.c b/ext/mbstring/libmbfl/filters/mbfilter_ucs4.c index 8906b8ff097f7..011c93fcdac7e 100644 --- a/ext/mbstring/libmbfl/filters/mbfilter_ucs4.c +++ b/ext/mbstring/libmbfl/filters/mbfilter_ucs4.c @@ -42,7 +42,9 @@ const mbfl_encoding mbfl_encoding_ucs4 = { "UCS-4", (const char *(*)[])&mbfl_encoding_ucs4_aliases, NULL, - MBFL_ENCTYPE_WCS4BE + MBFL_ENCTYPE_WCS4BE, + &vtbl_ucs4_wchar, + &vtbl_wchar_ucs4 }; const mbfl_encoding mbfl_encoding_ucs4be = { @@ -51,7 +53,9 @@ const mbfl_encoding mbfl_encoding_ucs4be = { "UCS-4BE", NULL, NULL, - MBFL_ENCTYPE_WCS4BE + MBFL_ENCTYPE_WCS4BE, + &vtbl_ucs4be_wchar, + &vtbl_wchar_ucs4be }; const mbfl_encoding mbfl_encoding_ucs4le = { @@ -60,7 +64,9 @@ const mbfl_encoding mbfl_encoding_ucs4le = { "UCS-4LE", NULL, NULL, - MBFL_ENCTYPE_WCS4LE + MBFL_ENCTYPE_WCS4LE, + &vtbl_ucs4le_wchar, + &vtbl_wchar_ucs4le }; const struct mbfl_convert_vtbl vtbl_ucs4_wchar = { diff --git a/ext/mbstring/libmbfl/filters/mbfilter_uhc.c b/ext/mbstring/libmbfl/filters/mbfilter_uhc.c index 2e1c696f8ad7f..1603793e6a0d5 100644 --- a/ext/mbstring/libmbfl/filters/mbfilter_uhc.c +++ b/ext/mbstring/libmbfl/filters/mbfilter_uhc.c @@ -65,7 +65,9 @@ const mbfl_encoding mbfl_encoding_uhc = { "UHC", (const char *(*)[])&mbfl_encoding_uhc_aliases, mblen_table_uhc, - MBFL_ENCTYPE_MBCS + MBFL_ENCTYPE_MBCS, + &vtbl_uhc_wchar, + &vtbl_wchar_uhc }; const struct mbfl_identify_vtbl vtbl_identify_uhc = { diff --git a/ext/mbstring/libmbfl/filters/mbfilter_utf16.c b/ext/mbstring/libmbfl/filters/mbfilter_utf16.c index 3e008e803573a..a4864cd3aca79 100644 --- a/ext/mbstring/libmbfl/filters/mbfilter_utf16.c +++ b/ext/mbstring/libmbfl/filters/mbfilter_utf16.c @@ -42,7 +42,9 @@ const mbfl_encoding mbfl_encoding_utf16 = { "UTF-16", (const char *(*)[])&mbfl_encoding_utf16_aliases, NULL, - MBFL_ENCTYPE_MWC2BE + MBFL_ENCTYPE_MWC2BE, + &vtbl_utf16_wchar, + &vtbl_wchar_utf16 }; const mbfl_encoding mbfl_encoding_utf16be = { @@ -51,7 +53,9 @@ const mbfl_encoding mbfl_encoding_utf16be = { "UTF-16BE", NULL, NULL, - MBFL_ENCTYPE_MWC2BE + MBFL_ENCTYPE_MWC2BE, + &vtbl_utf16be_wchar, + &vtbl_wchar_utf16be }; const mbfl_encoding mbfl_encoding_utf16le = { @@ -60,7 +64,9 @@ const mbfl_encoding mbfl_encoding_utf16le = { "UTF-16LE", NULL, NULL, - MBFL_ENCTYPE_MWC2LE + MBFL_ENCTYPE_MWC2LE, + &vtbl_utf16le_wchar, + &vtbl_wchar_utf16le }; const struct mbfl_convert_vtbl vtbl_utf16_wchar = { diff --git a/ext/mbstring/libmbfl/filters/mbfilter_utf32.c b/ext/mbstring/libmbfl/filters/mbfilter_utf32.c index 852bca200298b..5b02362b5d11f 100644 --- a/ext/mbstring/libmbfl/filters/mbfilter_utf32.c +++ b/ext/mbstring/libmbfl/filters/mbfilter_utf32.c @@ -42,7 +42,9 @@ const mbfl_encoding mbfl_encoding_utf32 = { "UTF-32", (const char *(*)[])&mbfl_encoding_utf32_aliases, NULL, - MBFL_ENCTYPE_WCS4BE + MBFL_ENCTYPE_WCS4BE, + &vtbl_utf32_wchar, + &vtbl_wchar_utf32 }; const mbfl_encoding mbfl_encoding_utf32be = { @@ -51,7 +53,9 @@ const mbfl_encoding mbfl_encoding_utf32be = { "UTF-32BE", NULL, NULL, - MBFL_ENCTYPE_WCS4BE + MBFL_ENCTYPE_WCS4BE, + &vtbl_utf32be_wchar, + &vtbl_wchar_utf32be }; const mbfl_encoding mbfl_encoding_utf32le = { @@ -60,7 +64,9 @@ const mbfl_encoding mbfl_encoding_utf32le = { "UTF-32LE", NULL, NULL, - MBFL_ENCTYPE_WCS4LE + MBFL_ENCTYPE_WCS4LE, + &vtbl_utf32le_wchar, + &vtbl_wchar_utf32le }; const struct mbfl_convert_vtbl vtbl_utf32_wchar = { diff --git a/ext/mbstring/libmbfl/filters/mbfilter_utf7.c b/ext/mbstring/libmbfl/filters/mbfilter_utf7.c index db0979c25de43..f31da86b6c012 100644 --- a/ext/mbstring/libmbfl/filters/mbfilter_utf7.c +++ b/ext/mbstring/libmbfl/filters/mbfilter_utf7.c @@ -57,7 +57,9 @@ const mbfl_encoding mbfl_encoding_utf7 = { "UTF-7", (const char *(*)[])&mbfl_encoding_utf7_aliases, NULL, - MBFL_ENCTYPE_MBCS | MBFL_ENCTYPE_SHFTCODE | MBFL_ENCTYPE_GL_UNSAFE + MBFL_ENCTYPE_MBCS | MBFL_ENCTYPE_SHFTCODE | MBFL_ENCTYPE_GL_UNSAFE, + &vtbl_utf7_wchar, + &vtbl_wchar_utf7 }; const struct mbfl_identify_vtbl vtbl_identify_utf7 = { diff --git a/ext/mbstring/libmbfl/filters/mbfilter_utf8.c b/ext/mbstring/libmbfl/filters/mbfilter_utf8.c index e81e0860d22bc..1e2ad5b9599a7 100644 --- a/ext/mbstring/libmbfl/filters/mbfilter_utf8.c +++ b/ext/mbstring/libmbfl/filters/mbfilter_utf8.c @@ -63,7 +63,9 @@ const mbfl_encoding mbfl_encoding_utf8 = { "UTF-8", (const char *(*)[])&mbfl_encoding_utf8_aliases, mblen_table_utf8, - MBFL_ENCTYPE_MBCS + MBFL_ENCTYPE_MBCS, + &vtbl_utf8_wchar, + &vtbl_wchar_utf8 }; const struct mbfl_identify_vtbl vtbl_identify_utf8 = { diff --git a/ext/mbstring/libmbfl/filters/mbfilter_utf8_mobile.c b/ext/mbstring/libmbfl/filters/mbfilter_utf8_mobile.c index 41e02bf3149dc..7132d9ccd6589 100644 --- a/ext/mbstring/libmbfl/filters/mbfilter_utf8_mobile.c +++ b/ext/mbstring/libmbfl/filters/mbfilter_utf8_mobile.c @@ -52,7 +52,9 @@ const mbfl_encoding mbfl_encoding_utf8_docomo = { "UTF-8", (const char *(*)[])&mbfl_encoding_utf8_docomo_aliases, mblen_table_utf8, - MBFL_ENCTYPE_MBCS + MBFL_ENCTYPE_MBCS, + &vtbl_utf8_docomo_wchar, + &vtbl_wchar_utf8_docomo }; const mbfl_encoding mbfl_encoding_utf8_kddi_a = { @@ -61,7 +63,9 @@ const mbfl_encoding mbfl_encoding_utf8_kddi_a = { "UTF-8", (const char *(*)[])&mbfl_encoding_utf8_kddi_a_aliases, mblen_table_utf8, - MBFL_ENCTYPE_MBCS + MBFL_ENCTYPE_MBCS, + &vtbl_utf8_kddi_a_wchar, + &vtbl_wchar_utf8_kddi_a }; const mbfl_encoding mbfl_encoding_utf8_kddi_b = { @@ -70,7 +74,9 @@ const mbfl_encoding mbfl_encoding_utf8_kddi_b = { "UTF-8", (const char *(*)[])&mbfl_encoding_utf8_kddi_b_aliases, mblen_table_utf8, - MBFL_ENCTYPE_MBCS + MBFL_ENCTYPE_MBCS, + &vtbl_utf8_kddi_b_wchar, + &vtbl_wchar_utf8_kddi_b }; const mbfl_encoding mbfl_encoding_utf8_sb = { @@ -79,7 +85,9 @@ const mbfl_encoding mbfl_encoding_utf8_sb = { "UTF-8", (const char *(*)[])&mbfl_encoding_utf8_sb_aliases, mblen_table_utf8, - MBFL_ENCTYPE_MBCS + MBFL_ENCTYPE_MBCS, + &vtbl_utf8_sb_wchar, + &vtbl_wchar_utf8_sb }; const struct mbfl_identify_vtbl vtbl_identify_utf8_docomo = { diff --git a/ext/mbstring/libmbfl/filters/mbfilter_uuencode.c b/ext/mbstring/libmbfl/filters/mbfilter_uuencode.c index b8cdfcaf792a8..5464fac4339e8 100644 --- a/ext/mbstring/libmbfl/filters/mbfilter_uuencode.c +++ b/ext/mbstring/libmbfl/filters/mbfilter_uuencode.c @@ -40,7 +40,9 @@ const mbfl_encoding mbfl_encoding_uuencode = { "x-uuencode", NULL, NULL, - MBFL_ENCTYPE_SBCS + MBFL_ENCTYPE_SBCS, + NULL, + NULL }; const struct mbfl_convert_vtbl vtbl_uuencode_8bit = { diff --git a/ext/mbstring/libmbfl/mbfl/mbfilter.c b/ext/mbstring/libmbfl/mbfl/mbfilter.c index 4986472b9b26a..94ecc574911ae 100644 --- a/ext/mbstring/libmbfl/mbfl/mbfilter.c +++ b/ext/mbstring/libmbfl/mbfl/mbfilter.c @@ -1,6 +1,5 @@ /* * charset=UTF-8 - * vim600: encoding=utf-8 */ /* @@ -101,8 +100,14 @@ #include "mbfilter.h" #include "mbfl_filter_output.h" +#include "mbfilter_8bit.h" #include "mbfilter_pass.h" +#include "mbfilter_wchar.h" +#include "filters/mbfilter_ascii.h" +#include "filters/mbfilter_base64.h" +#include "filters/mbfilter_qprint.h" #include "filters/mbfilter_tl_jisx0201_jisx0208.h" +#include "filters/mbfilter_utf8.h" #include "eaw_table.h" @@ -124,26 +129,14 @@ static char mbfl_hexchar_table[] = { */ mbfl_buffer_converter * mbfl_buffer_converter_new( - enum mbfl_no_encoding from, - enum mbfl_no_encoding to, - int buf_initsz) -{ - const mbfl_encoding *_from = mbfl_no2encoding(from); - const mbfl_encoding *_to = mbfl_no2encoding(to); - - return mbfl_buffer_converter_new2(_from ? _from: &mbfl_encoding_pass, _to ? _to: &mbfl_encoding_pass, buf_initsz); -} - -mbfl_buffer_converter * -mbfl_buffer_converter_new2( const mbfl_encoding *from, const mbfl_encoding *to, - int buf_initsz) + size_t buf_initsz) { mbfl_buffer_converter *convd; /* allocate */ - convd = (mbfl_buffer_converter*)mbfl_malloc(sizeof (mbfl_buffer_converter)); + convd = (mbfl_buffer_converter*)mbfl_malloc(sizeof(mbfl_buffer_converter)); if (convd == NULL) { return NULL; } @@ -154,14 +147,14 @@ mbfl_buffer_converter_new2( /* create convert filter */ convd->filter1 = NULL; - convd->filter2 = NULL; - if (mbfl_convert_filter_get_vtbl(convd->from->no_encoding, convd->to->no_encoding) != NULL) { - convd->filter1 = mbfl_convert_filter_new(convd->from->no_encoding, convd->to->no_encoding, mbfl_memory_device_output, NULL, &convd->device); +convd->filter2 = NULL; + if (mbfl_convert_filter_get_vtbl(convd->from, convd->to) != NULL) { + convd->filter1 = mbfl_convert_filter_new(convd->from, convd->to, mbfl_memory_device_output, NULL, &convd->device); } else { - convd->filter2 = mbfl_convert_filter_new(mbfl_no_encoding_wchar, convd->to->no_encoding, mbfl_memory_device_output, NULL, &convd->device); + convd->filter2 = mbfl_convert_filter_new(&mbfl_encoding_wchar, convd->to, mbfl_memory_device_output, NULL, &convd->device); if (convd->filter2 != NULL) { - convd->filter1 = mbfl_convert_filter_new(convd->from->no_encoding, - mbfl_no_encoding_wchar, + convd->filter1 = mbfl_convert_filter_new(convd->from, + &mbfl_encoding_wchar, (int (*)(int, void*))convd->filter2->filter_function, (int (*)(void*))convd->filter2->filter_flush, convd->filter2); @@ -234,7 +227,7 @@ mbfl_buffer_converter_illegal_substchar(mbfl_buffer_converter *convd, int substc } int -mbfl_buffer_converter_strncat(mbfl_buffer_converter *convd, const unsigned char *p, int n) +mbfl_buffer_converter_strncat(mbfl_buffer_converter *convd, const unsigned char *p, size_t n) { mbfl_convert_filter *filter; int (*filter_function)(int c, mbfl_convert_filter *filter); @@ -262,9 +255,9 @@ mbfl_buffer_converter_feed(mbfl_buffer_converter *convd, mbfl_string *string) } int -mbfl_buffer_converter_feed2(mbfl_buffer_converter *convd, mbfl_string *string, int *loc) +mbfl_buffer_converter_feed2(mbfl_buffer_converter *convd, mbfl_string *string, size_t *loc) { - int n; + size_t n; unsigned char *p; mbfl_convert_filter *filter; int (*filter_function)(int c, mbfl_convert_filter *filter); @@ -318,7 +311,7 @@ mbfl_string * mbfl_buffer_converter_getbuffer(mbfl_buffer_converter *convd, mbfl_string *result) { if (convd != NULL && result != NULL && convd->device.buffer != NULL) { - result->no_encoding = convd->to->no_encoding; + result->encoding = convd->to; result->val = convd->device.buffer; result->len = convd->device.pos; } else { @@ -334,7 +327,7 @@ mbfl_buffer_converter_result(mbfl_buffer_converter *convd, mbfl_string *result) if (convd == NULL || result == NULL) { return NULL; } - result->no_encoding = convd->to->no_encoding; + result->encoding = convd->to; return mbfl_memory_device_result(&convd->device, result); } @@ -352,13 +345,13 @@ mbfl_buffer_converter_feed_result(mbfl_buffer_converter *convd, mbfl_string *str if (convd->filter2 != NULL) { mbfl_convert_filter_flush(convd->filter2); } - result->no_encoding = convd->to->no_encoding; + result->encoding = convd->to; return mbfl_memory_device_result(&convd->device, result); } -int mbfl_buffer_illegalchars(mbfl_buffer_converter *convd) +size_t mbfl_buffer_illegalchars(mbfl_buffer_converter *convd) { - int num_illegalchars = 0; + size_t num_illegalchars = 0; if (convd == NULL) { return 0; @@ -372,56 +365,14 @@ int mbfl_buffer_illegalchars(mbfl_buffer_converter *convd) num_illegalchars += convd->filter2->num_illegalchar; } - return (num_illegalchars); + return num_illegalchars; } /* * encoding detector */ mbfl_encoding_detector * -mbfl_encoding_detector_new(enum mbfl_no_encoding *elist, int elistsz, int strict) -{ - mbfl_encoding_detector *identd; - - int i, num; - mbfl_identify_filter *filter; - - if (elist == NULL || elistsz <= 0) { - return NULL; - } - - /* allocate */ - identd = (mbfl_encoding_detector*)mbfl_malloc(sizeof(mbfl_encoding_detector)); - if (identd == NULL) { - return NULL; - } - identd->filter_list = (mbfl_identify_filter **)mbfl_calloc(elistsz, sizeof(mbfl_identify_filter *)); - if (identd->filter_list == NULL) { - mbfl_free(identd); - return NULL; - } - - /* create filters */ - i = 0; - num = 0; - while (i < elistsz) { - filter = mbfl_identify_filter_new(elist[i]); - if (filter != NULL) { - identd->filter_list[num] = filter; - num++; - } - i++; - } - identd->filter_list_size = num; - - /* set strict flag */ - identd->strict = strict; - - return identd; -} - -mbfl_encoding_detector * -mbfl_encoding_detector_new2(const mbfl_encoding **elist, int elistsz, int strict) +mbfl_encoding_detector_new(const mbfl_encoding **elist, int elistsz, int strict) { mbfl_encoding_detector *identd; @@ -484,20 +435,17 @@ mbfl_encoding_detector_delete(mbfl_encoding_detector *identd) int mbfl_encoding_detector_feed(mbfl_encoding_detector *identd, mbfl_string *string) { - int i, n, num, bad, res; - unsigned char *p; - mbfl_identify_filter *filter; - - res = 0; + int res = 0; /* feed data */ if (identd != NULL && string != NULL && string->val != NULL) { - num = identd->filter_list_size; - n = string->len; - p = string->val; - bad = 0; + int num = identd->filter_list_size; + size_t n = string->len; + unsigned char *p = string->val; + int bad = 0; while (n > 0) { + int i; for (i = 0; i < num; i++) { - filter = identd->filter_list[i]; + mbfl_identify_filter *filter = identd->filter_list[i]; if (!filter->flag) { (*filter->filter_function)(*p, filter); if (filter->flag) { @@ -517,7 +465,7 @@ mbfl_encoding_detector_feed(mbfl_encoding_detector *identd, mbfl_string *string) return res; } -const mbfl_encoding *mbfl_encoding_detector_judge2(mbfl_encoding_detector *identd) +const mbfl_encoding *mbfl_encoding_detector_judge(mbfl_encoding_detector *identd) { mbfl_identify_filter *filter; const mbfl_encoding *encoding = NULL; @@ -552,13 +500,6 @@ const mbfl_encoding *mbfl_encoding_detector_judge2(mbfl_encoding_detector *ident return encoding; } -enum mbfl_no_encoding mbfl_encoding_detector_judge(mbfl_encoding_detector *identd) -{ - const mbfl_encoding *encoding = mbfl_encoding_detector_judge2(identd); - return !encoding ? mbfl_no_encoding_invalid: encoding->no_encoding; -} - - /* * encoding converter */ @@ -566,29 +507,27 @@ mbfl_string * mbfl_convert_encoding( mbfl_string *string, mbfl_string *result, - enum mbfl_no_encoding toenc) + const mbfl_encoding *toenc) { - int n; + size_t n; unsigned char *p; - const mbfl_encoding *encoding; mbfl_memory_device device; mbfl_convert_filter *filter1; mbfl_convert_filter *filter2; /* initialize */ - encoding = mbfl_no2encoding(toenc); - if (encoding == NULL || string == NULL || result == NULL) { + if (toenc == NULL || string == NULL || result == NULL) { return NULL; } filter1 = NULL; filter2 = NULL; - if (mbfl_convert_filter_get_vtbl(string->no_encoding, toenc) != NULL) { - filter1 = mbfl_convert_filter_new(string->no_encoding, toenc, mbfl_memory_device_output, 0, &device); + if (mbfl_convert_filter_get_vtbl(string->encoding, toenc) != NULL) { + filter1 = mbfl_convert_filter_new(string->encoding, toenc, mbfl_memory_device_output, 0, &device); } else { - filter2 = mbfl_convert_filter_new(mbfl_no_encoding_wchar, toenc, mbfl_memory_device_output, 0, &device); + filter2 = mbfl_convert_filter_new(&mbfl_encoding_wchar, toenc, mbfl_memory_device_output, 0, &device); if (filter2 != NULL) { - filter1 = mbfl_convert_filter_new(string->no_encoding, mbfl_no_encoding_wchar, (int (*)(int, void*))filter2->filter_function, NULL, filter2); + filter1 = mbfl_convert_filter_new(string->encoding, &mbfl_encoding_wchar, (int (*)(int, void*))filter2->filter_function, NULL, filter2); if (filter1 == NULL) { mbfl_convert_filter_delete(filter2); } @@ -632,92 +571,10 @@ mbfl_convert_encoding( * identify encoding */ const mbfl_encoding * -mbfl_identify_encoding(mbfl_string *string, enum mbfl_no_encoding *elist, int elistsz, int strict) +mbfl_identify_encoding(mbfl_string *string, const mbfl_encoding **elist, int elistsz, int strict) { - int i, n, num, bad; - unsigned char *p; - mbfl_identify_filter *flist, *filter; - const mbfl_encoding *encoding; - - /* flist is an array of mbfl_identify_filter instances */ - flist = (mbfl_identify_filter *)mbfl_calloc(elistsz, sizeof(mbfl_identify_filter)); - if (flist == NULL) { - return NULL; - } - - num = 0; - if (elist != NULL) { - for (i = 0; i < elistsz; i++) { - if (!mbfl_identify_filter_init(&flist[num], elist[i])) { - num++; - } - } - } - - /* feed data */ - n = string->len; - p = string->val; - - if (p != NULL) { - bad = 0; - while (n > 0) { - for (i = 0; i < num; i++) { - filter = &flist[i]; - if (!filter->flag) { - (*filter->filter_function)(*p, filter); - if (filter->flag) { - bad++; - } - } - } - if ((num - 1) <= bad && !strict) { - break; - } - p++; - n--; - } - } - - /* judge */ - encoding = NULL; - - for (i = 0; i < num; i++) { - filter = &flist[i]; - if (!filter->flag) { - if (strict && filter->status) { - continue; - } - encoding = filter->encoding; - break; - } - } - - /* fall-back judge */ - if (!encoding) { - for (i = 0; i < num; i++) { - filter = &flist[i]; - if (!filter->flag && (!strict || !filter->status)) { - encoding = filter->encoding; - break; - } - } - } - - /* cleanup */ - /* dtors should be called in reverse order */ - i = num; while (--i >= 0) { - mbfl_identify_filter_cleanup(&flist[i]); - } - - mbfl_free((void *)flist); - - return encoding; -} - -const mbfl_encoding * -mbfl_identify_encoding2(mbfl_string *string, const mbfl_encoding **elist, int elistsz, int strict) -{ - int i, n, num, bad; + int i, num, bad; + size_t n; unsigned char *p; mbfl_identify_filter *flist, *filter; const mbfl_encoding *encoding; @@ -788,7 +645,8 @@ mbfl_identify_encoding2(mbfl_string *string, const mbfl_encoding **elist, int el /* cleanup */ /* dtors should be called in reverse order */ - i = num; while (--i >= 0) { + i = num; + while (--i >= 0) { mbfl_identify_filter_cleanup(&flist[i]); } @@ -803,22 +661,16 @@ mbfl_identify_encoding2(mbfl_string *string, const mbfl_encoding **elist, int el static int filter_count_output(int c, void *data) { - (*(int *)data)++; + (*(size_t *)data)++; return c; } -int +size_t mbfl_strlen(mbfl_string *string) { - int len, n, m, k; + size_t len, n, k; unsigned char *p; - const unsigned char *mbtab; - const mbfl_encoding *encoding; - - encoding = mbfl_no2encoding(string->no_encoding); - if (encoding == NULL || string == NULL) { - return -1; - } + const mbfl_encoding *encoding = string->encoding; len = 0; if (encoding->flag & MBFL_ENCTYPE_SBCS) { @@ -828,27 +680,27 @@ mbfl_strlen(mbfl_string *string) } else if (encoding->flag & (MBFL_ENCTYPE_WCS4BE | MBFL_ENCTYPE_WCS4LE)) { len = string->len/4; } else if (encoding->mblen_table != NULL) { - mbtab = encoding->mblen_table; + const unsigned char *mbtab = encoding->mblen_table; n = 0; p = string->val; k = string->len; /* count */ if (p != NULL) { while (n < k) { - m = mbtab[*p]; + unsigned m = mbtab[*p]; n += m; p += m; len++; - }; + } } } else { /* wchar filter */ mbfl_convert_filter *filter = mbfl_convert_filter_new( - string->no_encoding, - mbfl_no_encoding_wchar, + string->encoding, + &mbfl_encoding_wchar, filter_count_output, 0, &len); if (filter == NULL) { - return -1; + return (size_t) -1; } /* count */ n = string->len; @@ -872,18 +724,19 @@ mbfl_strlen(mbfl_string *string) struct collector_strpos_data { mbfl_convert_filter *next_filter; mbfl_wchar_device needle; - int needle_len; - int start; - int output; - int found_pos; - int needle_pos; - int matched_pos; + size_t needle_len; + size_t start; + size_t output; + size_t found_pos; + size_t needle_pos; + size_t matched_pos; }; static int collector_strpos(int c, void* data) { - int *p, *h, *m, n; + int *p, *h, *m; + ssize_t n; struct collector_strpos_data *pc = (struct collector_strpos_data*)data; if (pc->output >= pc->start) { @@ -931,22 +784,12 @@ collector_strpos(int c, void* data) /* * oddlen */ -int +size_t mbfl_oddlen(mbfl_string *string) { - int len, n, m, k; + size_t len, n, k; unsigned char *p; - const unsigned char *mbtab; - const mbfl_encoding *encoding; - - - if (string == NULL) { - return -1; - } - encoding = mbfl_no2encoding(string->no_encoding); - if (encoding == NULL) { - return -1; - } + const mbfl_encoding *encoding = string->encoding; len = 0; if (encoding->flag & MBFL_ENCTYPE_SBCS) { @@ -956,14 +799,14 @@ mbfl_oddlen(mbfl_string *string) } else if (encoding->flag & (MBFL_ENCTYPE_WCS4BE | MBFL_ENCTYPE_WCS4LE)) { return len % 4; } else if (encoding->mblen_table != NULL) { - mbtab = encoding->mblen_table; + const unsigned char *mbtab = encoding->mblen_table; n = 0; p = string->val; k = string->len; /* count */ if (p != NULL) { while (n < k) { - m = mbtab[*p]; + unsigned m = mbtab[*p]; n += m; p += m; }; @@ -976,47 +819,46 @@ mbfl_oddlen(mbfl_string *string) /* NOT REACHED */ } -int +size_t mbfl_strpos( mbfl_string *haystack, mbfl_string *needle, - int offset, + ssize_t offset, int reverse) { - int result; + size_t result; mbfl_string _haystack_u8, _needle_u8; const mbfl_string *haystack_u8, *needle_u8 = NULL; const unsigned char *u8_tbl; if (haystack == NULL || haystack->val == NULL || needle == NULL || needle->val == NULL) { - return -8; + return (size_t) -8; } { - const mbfl_encoding *u8_enc; - u8_enc = mbfl_no2encoding(mbfl_no_encoding_utf8); - if (u8_enc == NULL || u8_enc->mblen_table == NULL) { - return -8; + const mbfl_encoding *u8_enc = &mbfl_encoding_utf8; + if (u8_enc->mblen_table == NULL) { + return (size_t) -8; } u8_tbl = u8_enc->mblen_table; } - if (haystack->no_encoding != mbfl_no_encoding_utf8) { + if (haystack->encoding->no_encoding != mbfl_no_encoding_utf8) { mbfl_string_init(&_haystack_u8); - haystack_u8 = mbfl_convert_encoding(haystack, &_haystack_u8, mbfl_no_encoding_utf8); + haystack_u8 = mbfl_convert_encoding(haystack, &_haystack_u8, &mbfl_encoding_utf8); if (haystack_u8 == NULL) { - result = -4; + result = (size_t) -4; goto out; } } else { haystack_u8 = haystack; } - if (needle->no_encoding != mbfl_no_encoding_utf8) { + if (needle->encoding->no_encoding != mbfl_no_encoding_utf8) { mbfl_string_init(&_needle_u8); - needle_u8 = mbfl_convert_encoding(needle, &_needle_u8, mbfl_no_encoding_utf8); + needle_u8 = mbfl_convert_encoding(needle, &_needle_u8, &mbfl_encoding_utf8); if (needle_u8 == NULL) { - result = -4; + result = (size_t) -4; goto out; } } else { @@ -1024,19 +866,19 @@ mbfl_strpos( } if (needle_u8->len < 1) { - result = -8; + result = (size_t) -8; goto out; } - result = -1; + result = (size_t) -1; if (haystack_u8->len < needle_u8->len) { goto out; } if (!reverse) { - unsigned int jtbl[1 << (sizeof(unsigned char) * 8)]; - unsigned int needle_u8_len = needle_u8->len; - unsigned int i; + size_t jtbl[1 << (sizeof(unsigned char) * 8)]; + size_t needle_u8_len = needle_u8->len; + size_t i; const unsigned char *p, *q, *e; const unsigned char *haystack_u8_val = haystack_u8->val, *needle_u8_val = needle_u8->val; @@ -1048,9 +890,9 @@ mbfl_strpos( } e = haystack_u8_val + haystack_u8->len; p = haystack_u8_val; - while (--offset >= 0) { + while (offset-- > 0) { if (p >= e) { - result = -16; + result = (size_t) -16; goto out; } p += u8_tbl[*p]; @@ -1085,9 +927,9 @@ mbfl_strpos( } } } else { - unsigned int jtbl[1 << (sizeof(unsigned char) * 8)]; - unsigned int needle_u8_len = needle_u8->len, needle_len = 0; - unsigned int i; + size_t jtbl[1 << (sizeof(unsigned char) * 8)]; + size_t needle_u8_len = needle_u8->len, needle_len = 0; + size_t i; const unsigned char *p, *e, *q, *qe; const unsigned char *haystack_u8_val = haystack_u8->val, *needle_u8_val = needle_u8->val; @@ -1120,7 +962,7 @@ mbfl_strpos( while (offset < 0) { unsigned char c; if (p <= e) { - result = -16; + result = (size_t) -16; goto out; } c = *(--p); @@ -1133,9 +975,9 @@ mbfl_strpos( } } else { const unsigned char *ee = haystack_u8_val + haystack_u8->len; - while (--offset >= 0) { + while (offset-- > 0) { if (e >= ee) { - result = -16; + result = (size_t) -16; goto out; } e += u8_tbl[*e]; @@ -1187,63 +1029,54 @@ mbfl_strpos( * substr_count */ -int +size_t mbfl_substr_count( mbfl_string *haystack, mbfl_string *needle ) { - int n, result = 0; + size_t n, result = 0; unsigned char *p; mbfl_convert_filter *filter; struct collector_strpos_data pc; if (haystack == NULL || needle == NULL) { - return -8; + return (size_t) -8; } /* needle is converted into wchar */ mbfl_wchar_device_init(&pc.needle); filter = mbfl_convert_filter_new( - needle->no_encoding, - mbfl_no_encoding_wchar, + needle->encoding, + &mbfl_encoding_wchar, mbfl_wchar_device_output, 0, &pc.needle); if (filter == NULL) { - return -4; - } - p = needle->val; - n = needle->len; - if (p != NULL) { - while (n > 0) { - if ((*filter->filter_function)(*p++, filter) < 0) { - break; - } - n--; - } + return (size_t) -4; } + mbfl_convert_filter_feed_string(filter, needle->val, needle->len); mbfl_convert_filter_flush(filter); mbfl_convert_filter_delete(filter); pc.needle_len = pc.needle.pos; if (pc.needle.buffer == NULL) { - return -4; + return (size_t) -4; } if (pc.needle_len <= 0) { mbfl_wchar_device_clear(&pc.needle); - return -2; + return (size_t) -2; } /* initialize filter and collector data */ filter = mbfl_convert_filter_new( - haystack->no_encoding, - mbfl_no_encoding_wchar, + haystack->encoding, + &mbfl_encoding_wchar, collector_strpos, 0, &pc); if (filter == NULL) { mbfl_wchar_device_clear(&pc.needle); - return -4; + return (size_t) -4; } pc.start = 0; pc.output = 0; pc.needle_pos = 0; pc.found_pos = 0; - pc.matched_pos = -1; + pc.matched_pos = (size_t) -1; /* feed data */ p = haystack->val; @@ -1251,12 +1084,12 @@ mbfl_substr_count( if (p != NULL) { while (n > 0) { if ((*filter->filter_function)(*p++, filter) < 0) { - pc.matched_pos = -4; + pc.matched_pos = (size_t) -4; break; } - if (pc.matched_pos >= 0) { + if (pc.matched_pos != (size_t) -1) { ++result; - pc.matched_pos = -1; + pc.matched_pos = (size_t) -1; pc.needle_pos = 0; } n--; @@ -1274,9 +1107,9 @@ mbfl_substr_count( */ struct collector_substr_data { mbfl_convert_filter *next_filter; - int start; - int stop; - int output; + size_t start; + size_t stop; + size_t output; }; static int @@ -1301,80 +1134,79 @@ mbfl_string * mbfl_substr( mbfl_string *string, mbfl_string *result, - int from, - int length) + size_t from, + size_t length) { - const mbfl_encoding *encoding; - int n, m, k, len, start, end; + const mbfl_encoding *encoding = string->encoding; + size_t n, k, len, start, end; + unsigned m; unsigned char *p, *w; - const unsigned char *mbtab; - encoding = mbfl_no2encoding(string->no_encoding); - if (encoding == NULL || string == NULL || result == NULL) { - return NULL; - } mbfl_string_init(result); result->no_language = string->no_language; - result->no_encoding = string->no_encoding; + result->encoding = string->encoding; if ((encoding->flag & (MBFL_ENCTYPE_SBCS | MBFL_ENCTYPE_WCS2BE | MBFL_ENCTYPE_WCS2LE | MBFL_ENCTYPE_WCS4BE | MBFL_ENCTYPE_WCS4LE)) || encoding->mblen_table != NULL) { len = string->len; - start = from; - end = from + length; - if (encoding->flag & (MBFL_ENCTYPE_WCS2BE | MBFL_ENCTYPE_WCS2LE)) { - start *= 2; - end = start + length*2; + if (encoding->flag & MBFL_ENCTYPE_SBCS) { + start = from; + } else if (encoding->flag & (MBFL_ENCTYPE_WCS2BE | MBFL_ENCTYPE_WCS2LE)) { + start = from*2; } else if (encoding->flag & (MBFL_ENCTYPE_WCS4BE | MBFL_ENCTYPE_WCS4LE)) { - start *= 4; - end = start + length*4; - } else if (encoding->mblen_table != NULL) { - mbtab = encoding->mblen_table; + start = from*4; + } else { + const unsigned char *mbtab = encoding->mblen_table; start = 0; - end = 0; n = 0; k = 0; p = string->val; - if (p != NULL) { - /* search start position */ - while (k <= from) { - start = n; - if (n >= len) { - break; - } - m = mbtab[*p]; - n += m; - p += m; - k++; + /* search start position */ + while (k <= from) { + start = n; + if (n >= len) { + break; } - /* detect end position */ - k = 0; - end = start; - while (k < length) { - end = n; - if (n >= len) { - break; - } - m = mbtab[*p]; - n += m; - p += m; - k++; + m = mbtab[*p]; + n += m; + p += m; + k++; + } + } + + if (length == MBFL_SUBSTR_UNTIL_END) { + end = len; + } else if (encoding->flag & MBFL_ENCTYPE_SBCS) { + end = start + length; + } else if (encoding->flag & (MBFL_ENCTYPE_WCS2BE | MBFL_ENCTYPE_WCS2LE)) { + end = start + length*2; + } else if (encoding->flag & (MBFL_ENCTYPE_WCS4BE | MBFL_ENCTYPE_WCS4LE)) { + end = start + length*4; + } else { + const unsigned char *mbtab = encoding->mblen_table; + end = start; + n = start; + k = 0; + p = string->val + start; + /* detect end position */ + while (k <= length) { + end = n; + if (n >= len) { + break; } + m = mbtab[*p]; + n += m; + p += m; + k++; } } if (start > len) { start = len; } - if (start < 0) { - start = 0; - } if (end > len) { end = len; } - if (end < 0) { - end = 0; - } if (start > end) { start = end; } @@ -1382,21 +1214,11 @@ mbfl_substr( /* allocate memory and copy */ n = end - start; result->len = 0; - result->val = w = (unsigned char*)mbfl_malloc((n + 8)*sizeof(unsigned char)); + result->val = w = (unsigned char*)mbfl_malloc(n + 1); if (w != NULL) { - p = string->val; - if (p != NULL) { - p += start; - result->len = n; - while (n > 0) { - *w++ = *p++; - n--; - } - } - *w++ = '\0'; - *w++ = '\0'; - *w++ = '\0'; - *w = '\0'; + result->len = n; + memcpy(w, string->val + start, n); + w[n] = '\0'; } else { result = NULL; } @@ -1406,19 +1228,23 @@ mbfl_substr( mbfl_convert_filter *decoder; mbfl_convert_filter *encoder; + if (length == MBFL_SUBSTR_UNTIL_END) { + length = mbfl_strlen(string) - from; + } + mbfl_memory_device_init(&device, length + 1, 0); mbfl_string_init(result); result->no_language = string->no_language; - result->no_encoding = string->no_encoding; + result->encoding = string->encoding; /* output code filter */ decoder = mbfl_convert_filter_new( - mbfl_no_encoding_wchar, - string->no_encoding, + &mbfl_encoding_wchar, + string->encoding, mbfl_memory_device_output, 0, &device); /* wchar filter */ encoder = mbfl_convert_filter_new( - string->no_encoding, - mbfl_no_encoding_wchar, + string->encoding, + &mbfl_encoding_wchar, collector_substr, 0, &pc); if (decoder == NULL || encoder == NULL) { mbfl_convert_filter_delete(encoder); @@ -1459,33 +1285,19 @@ mbfl_string * mbfl_strcut( mbfl_string *string, mbfl_string *result, - int from, - int length) + size_t from, + size_t length) { - const mbfl_encoding *encoding; + const mbfl_encoding *encoding = string->encoding; mbfl_memory_device device; - /* validate the parameters */ - if (string == NULL || string->val == NULL || result == NULL) { - return NULL; - } - - if (from < 0 || length < 0) { - return NULL; - } - if (from >= string->len) { from = string->len; } - encoding = mbfl_no2encoding(string->no_encoding); - if (encoding == NULL) { - return NULL; - } - mbfl_string_init(result); result->no_language = string->no_language; - result->no_encoding = string->no_encoding; + result->encoding = string->encoding; if ((encoding->flag & (MBFL_ENCTYPE_SBCS | MBFL_ENCTYPE_WCS2BE @@ -1496,7 +1308,7 @@ mbfl_strcut( const unsigned char *start = NULL; const unsigned char *end = NULL; unsigned char *w; - unsigned int sz; + size_t sz; if (encoding->flag & (MBFL_ENCTYPE_WCS2BE | MBFL_ENCTYPE_WCS2LE)) { from &= -2; @@ -1539,7 +1351,7 @@ mbfl_strcut( start = p; /* search end position */ - if (length >= (int)string->len - (start - string->val)) { + if (length >= string->len - (start - string->val)) { end = string->val + string->len; } else { for (q = p + length; p < q; p += (m = mbtab[*p])); @@ -1577,21 +1389,21 @@ mbfl_strcut( mbfl_convert_filter encoder; mbfl_convert_filter decoder; const unsigned char *p; - int pos; + size_t pos; } bk, _bk; /* output code filter */ if (!(decoder = mbfl_convert_filter_new( - mbfl_no_encoding_wchar, - string->no_encoding, + &mbfl_encoding_wchar, + string->encoding, mbfl_memory_device_output, 0, &device))) { return NULL; } /* wchar filter */ if (!(encoder = mbfl_convert_filter_new( - string->no_encoding, - mbfl_no_encoding_wchar, + string->encoding, + &mbfl_encoding_wchar, mbfl_filter_output_null, NULL, NULL))) { mbfl_convert_filter_delete(decoder); @@ -1750,7 +1562,7 @@ mbfl_strcut( /* * strwidth */ -static int is_fullwidth(int c) +static size_t is_fullwidth(int c) { int i; @@ -1770,14 +1582,14 @@ static int is_fullwidth(int c) static int filter_count_width(int c, void* data) { - (*(int *)data) += (is_fullwidth(c) ? 2: 1); + (*(size_t *)data) += (is_fullwidth(c) ? 2: 1); return c; } -int +size_t mbfl_strwidth(mbfl_string *string) { - int len, n; + size_t len, n; unsigned char *p; mbfl_convert_filter *filter; @@ -1785,8 +1597,8 @@ mbfl_strwidth(mbfl_string *string) if (string->len > 0 && string->val != NULL) { /* wchar filter */ filter = mbfl_convert_filter_new( - string->no_encoding, - mbfl_no_encoding_wchar, + string->encoding, + &mbfl_encoding_wchar, filter_count_width, 0, &len); if (filter == NULL) { mbfl_convert_filter_delete(filter); @@ -1816,12 +1628,12 @@ struct collector_strimwidth_data { mbfl_convert_filter *decoder; mbfl_convert_filter *decoder_backup; mbfl_memory_device device; - int from; - int width; - int outwidth; - int outchar; + size_t from; + size_t width; + size_t outwidth; + size_t outchar; + size_t endpos; int status; - int endpos; }; static int @@ -1861,12 +1673,12 @@ mbfl_strimwidth( mbfl_string *string, mbfl_string *marker, mbfl_string *result, - int from, - int width) + size_t from, + size_t width) { struct collector_strimwidth_data pc; mbfl_convert_filter *encoder; - int n, mkwidth; + size_t n, mkwidth; unsigned char *p; if (string == NULL || result == NULL) { @@ -1874,22 +1686,22 @@ mbfl_strimwidth( } mbfl_string_init(result); result->no_language = string->no_language; - result->no_encoding = string->no_encoding; + result->encoding = string->encoding; mbfl_memory_device_init(&pc.device, width, 0); /* output code filter */ pc.decoder = mbfl_convert_filter_new( - mbfl_no_encoding_wchar, - string->no_encoding, + &mbfl_encoding_wchar, + string->encoding, mbfl_memory_device_output, 0, &pc.device); pc.decoder_backup = mbfl_convert_filter_new( - mbfl_no_encoding_wchar, - string->no_encoding, + &mbfl_encoding_wchar, + string->encoding, mbfl_memory_device_output, 0, &pc.device); /* wchar filter */ encoder = mbfl_convert_filter_new( - string->no_encoding, - mbfl_no_encoding_wchar, + string->encoding, + &mbfl_encoding_wchar, collector_strimwidth, 0, &pc); if (pc.decoder == NULL || pc.decoder_backup == NULL || encoder == NULL) { mbfl_convert_filter_delete(encoder); @@ -1932,7 +1744,7 @@ mbfl_strimwidth( pc.status = 10; pc.device.pos = pc.endpos; mbfl_convert_filter_copy(pc.decoder_backup, pc.decoder); - mbfl_convert_filter_reset(encoder, marker->no_encoding, mbfl_no_encoding_wchar); + mbfl_convert_filter_reset(encoder, marker->encoding, &mbfl_encoding_wchar); p = marker->val; n = marker->len; while (n > 0) { @@ -1963,9 +1775,8 @@ mbfl_ja_jp_hantozen( mbfl_string *result, int mode) { - int n; + size_t n; unsigned char *p; - const mbfl_encoding *encoding; mbfl_memory_device device; mbfl_convert_filter *decoder = NULL; mbfl_convert_filter *encoder = NULL; @@ -1973,25 +1784,15 @@ mbfl_ja_jp_hantozen( mbfl_convert_filter *next_filter = NULL; mbfl_filt_tl_jisx0201_jisx0208_param *param = NULL; - /* validate parameters */ - if (string == NULL || result == NULL) { - return NULL; - } - - encoding = mbfl_no2encoding(string->no_encoding); - if (encoding == NULL) { - return NULL; - } - mbfl_memory_device_init(&device, string->len, 0); mbfl_string_init(result); result->no_language = string->no_language; - result->no_encoding = string->no_encoding; + result->encoding = string->encoding; decoder = mbfl_convert_filter_new( - mbfl_no_encoding_wchar, - string->no_encoding, + &mbfl_encoding_wchar, + string->encoding, mbfl_memory_device_output, 0, &device); if (decoder == NULL) { goto out; @@ -2020,8 +1821,8 @@ mbfl_ja_jp_hantozen( next_filter = tl_filter; encoder = mbfl_convert_filter_new( - string->no_encoding, - mbfl_no_encoding_wchar, + string->encoding, + &mbfl_encoding_wchar, (int(*)(int, void*))next_filter->filter_function, (int(*)(void*))next_filter->filter_flush, next_filter); @@ -2077,9 +1878,9 @@ struct mime_header_encoder_data { mbfl_memory_device tmpdev; int status1; int status2; - int prevpos; - int linehead; - int firstindent; + size_t prevpos; + size_t linehead; + size_t firstindent; int encnamelen; int lwsplen; char encname[128]; @@ -2089,7 +1890,7 @@ struct mime_header_encoder_data { static int mime_header_encoder_block_collector(int c, void *data) { - int n; + size_t n; struct mime_header_encoder_data *pe = (struct mime_header_encoder_data *)data; switch (pe->status2) { @@ -2150,7 +1951,7 @@ mime_header_encoder_collector(int c, void *data) 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 /* 0xF0 */ }; - int n; + size_t n; struct mime_header_encoder_data *pe = (struct mime_header_encoder_data *)data; switch (pe->status1) { @@ -2226,18 +2027,16 @@ mime_header_encoder_result(struct mime_header_encoder_data *pe, mbfl_string *res struct mime_header_encoder_data* mime_header_encoder_new( - enum mbfl_no_encoding incode, - enum mbfl_no_encoding outcode, - enum mbfl_no_encoding transenc) + const mbfl_encoding *incode, + const mbfl_encoding *outcode, + const mbfl_encoding *transenc) { - int n; + size_t n; const char *s; - const mbfl_encoding *outencoding; struct mime_header_encoder_data *pe; /* get output encoding and check MIME charset name */ - outencoding = mbfl_no2encoding(outcode); - if (outencoding == NULL || outencoding->mime_name == NULL || outencoding->mime_name[0] == '\0') { + if (outcode->mime_name == NULL || outcode->mime_name[0] == '\0') { return NULL; } @@ -2258,16 +2057,16 @@ mime_header_encoder_new( n = 0; pe->encname[n++] = 0x3d; pe->encname[n++] = 0x3f; - s = outencoding->mime_name; + s = outcode->mime_name; while (*s) { pe->encname[n++] = *s++; } pe->encname[n++] = 0x3f; - if (transenc == mbfl_no_encoding_qprint) { + if (transenc->no_encoding == mbfl_no_encoding_qprint) { pe->encname[n++] = 0x51; } else { pe->encname[n++] = 0x42; - transenc = mbfl_no_encoding_base64; + transenc = &mbfl_encoding_base64; } pe->encname[n++] = 0x3f; pe->encname[n] = '\0'; @@ -2285,14 +2084,14 @@ mime_header_encoder_new( pe->encod_filter_backup = mbfl_convert_filter_new(outcode, transenc, mbfl_memory_device_output, 0, &(pe->outdev)); /* Output code filter */ - pe->conv2_filter = mbfl_convert_filter_new(mbfl_no_encoding_wchar, outcode, mbfl_filter_output_pipe, 0, pe->encod_filter); - pe->conv2_filter_backup = mbfl_convert_filter_new(mbfl_no_encoding_wchar, outcode, mbfl_filter_output_pipe, 0, pe->encod_filter); + pe->conv2_filter = mbfl_convert_filter_new(&mbfl_encoding_wchar, outcode, mbfl_filter_output_pipe, 0, pe->encod_filter); + pe->conv2_filter_backup = mbfl_convert_filter_new(&mbfl_encoding_wchar, outcode, mbfl_filter_output_pipe, 0, pe->encod_filter); /* encoded block filter */ - pe->block_filter = mbfl_convert_filter_new(mbfl_no_encoding_wchar, mbfl_no_encoding_wchar, mime_header_encoder_block_collector, 0, pe); + pe->block_filter = mbfl_convert_filter_new(&mbfl_encoding_wchar, &mbfl_encoding_wchar, mime_header_encoder_block_collector, 0, pe); /* Input code filter */ - pe->conv1_filter = mbfl_convert_filter_new(incode, mbfl_no_encoding_wchar, mime_header_encoder_collector, 0, pe); + pe->conv1_filter = mbfl_convert_filter_new(incode, &mbfl_encoding_wchar, mime_header_encoder_collector, 0, pe); if (pe->encod_filter == NULL || pe->encod_filter_backup == NULL || @@ -2303,7 +2102,7 @@ mime_header_encoder_new( return NULL; } - if (transenc == mbfl_no_encoding_qprint) { + if (transenc->no_encoding == mbfl_no_encoding_qprint) { pe->encod_filter->status |= MBFL_QPRINT_STS_MIME_HEADER; pe->encod_filter_backup->status |= MBFL_QPRINT_STS_MIME_HEADER; } else { @@ -2340,20 +2139,20 @@ mbfl_string * mbfl_mime_header_encode( mbfl_string *string, mbfl_string *result, - enum mbfl_no_encoding outcode, - enum mbfl_no_encoding encoding, + const mbfl_encoding *outcode, + const mbfl_encoding *encoding, const char *linefeed, int indent) { - int n; + size_t n; unsigned char *p; struct mime_header_encoder_data *pe; mbfl_string_init(result); result->no_language = string->no_language; - result->no_encoding = mbfl_no_encoding_ascii; + result->encoding = &mbfl_encoding_ascii; - pe = mime_header_encoder_new(string->no_encoding, outcode, encoding); + pe = mime_header_encoder_new(string->encoding, outcode, encoding); if (pe == NULL) { return NULL; } @@ -2394,11 +2193,11 @@ struct mime_header_decoder_data { mbfl_convert_filter *conv2_filter; mbfl_memory_device outdev; mbfl_memory_device tmpdev; - int cspos; + size_t cspos; int status; - enum mbfl_no_encoding encoding; - enum mbfl_no_encoding incode; - enum mbfl_no_encoding outcode; + const mbfl_encoding *encoding; + const mbfl_encoding *incode; + const mbfl_encoding *outcode; }; static int @@ -2432,7 +2231,7 @@ mime_header_decoder_collector(int c, void* data) mbfl_memory_device_output('\0', &pd->tmpdev); encoding = mbfl_name2encoding((const char *)&pd->tmpdev.buffer[pd->cspos]); if (encoding != NULL) { - pd->incode = encoding->no_encoding; + pd->incode = encoding; pd->status = 3; } mbfl_memory_device_unput(&pd->tmpdev); @@ -2454,10 +2253,10 @@ mime_header_decoder_collector(int c, void* data) case 3: /* identify encoding */ mbfl_memory_device_output(c, &pd->tmpdev); if (c == 0x42 || c == 0x62) { /* 'B' or 'b' */ - pd->encoding = mbfl_no_encoding_base64; + pd->encoding = &mbfl_encoding_base64; pd->status = 4; } else if (c == 0x51 || c == 0x71) { /* 'Q' or 'q' */ - pd->encoding = mbfl_no_encoding_qprint; + pd->encoding = &mbfl_encoding_qprint; pd->status = 4; } else { if (c == 0x0d || c == 0x0a) { /* CR or LF */ @@ -2474,9 +2273,9 @@ mime_header_decoder_collector(int c, void* data) mbfl_memory_device_output(c, &pd->tmpdev); if (c == 0x3f) { /* ? */ /* charset convert filter */ - mbfl_convert_filter_reset(pd->conv1_filter, pd->incode, mbfl_no_encoding_wchar); + mbfl_convert_filter_reset(pd->conv1_filter, pd->incode, &mbfl_encoding_wchar); /* decode filter */ - mbfl_convert_filter_reset(pd->deco_filter, pd->encoding, mbfl_no_encoding_8bit); + mbfl_convert_filter_reset(pd->deco_filter, pd->encoding, &mbfl_encoding_8bit); pd->status = 5; } else { if (c == 0x0d || c == 0x0a) { /* CR or LF */ @@ -2501,7 +2300,7 @@ mime_header_decoder_collector(int c, void* data) /* flush and reset filter */ (*pd->deco_filter->filter_flush)(pd->deco_filter); (*pd->conv1_filter->filter_flush)(pd->conv1_filter); - mbfl_convert_filter_reset(pd->conv1_filter, mbfl_no_encoding_ascii, mbfl_no_encoding_wchar); + mbfl_convert_filter_reset(pd->conv1_filter, &mbfl_encoding_ascii, &mbfl_encoding_wchar); pd->status = 7; } else { (*pd->deco_filter->filter_function)(0x3f, pd->deco_filter); @@ -2587,7 +2386,7 @@ mime_header_decoder_result(struct mime_header_decoder_data *pd, mbfl_string *res } struct mime_header_decoder_data* -mime_header_decoder_new(enum mbfl_no_encoding outcode) +mime_header_decoder_new(const mbfl_encoding *outcode) { struct mime_header_decoder_data *pd; @@ -2600,14 +2399,14 @@ mime_header_decoder_new(enum mbfl_no_encoding outcode) mbfl_memory_device_init(&pd->tmpdev, 0, 0); pd->cspos = 0; pd->status = 0; - pd->encoding = mbfl_no_encoding_pass; - pd->incode = mbfl_no_encoding_ascii; + pd->encoding = &mbfl_encoding_pass; + pd->incode = &mbfl_encoding_ascii; pd->outcode = outcode; /* charset convert filter */ - pd->conv2_filter = mbfl_convert_filter_new(mbfl_no_encoding_wchar, pd->outcode, mbfl_memory_device_output, 0, &pd->outdev); - pd->conv1_filter = mbfl_convert_filter_new(pd->incode, mbfl_no_encoding_wchar, mbfl_filter_output_pipe, 0, pd->conv2_filter); + pd->conv2_filter = mbfl_convert_filter_new(&mbfl_encoding_wchar, pd->outcode, mbfl_memory_device_output, 0, &pd->outdev); + pd->conv1_filter = mbfl_convert_filter_new(pd->incode, &mbfl_encoding_wchar, mbfl_filter_output_pipe, 0, pd->conv2_filter); /* decode filter */ - pd->deco_filter = mbfl_convert_filter_new(pd->encoding, mbfl_no_encoding_8bit, mbfl_filter_output_pipe, 0, pd->conv1_filter); + pd->deco_filter = mbfl_convert_filter_new(pd->encoding, &mbfl_encoding_8bit, mbfl_filter_output_pipe, 0, pd->conv1_filter); if (pd->conv1_filter == NULL || pd->conv2_filter == NULL || pd->deco_filter == NULL) { mime_header_decoder_delete(pd); @@ -2640,15 +2439,15 @@ mbfl_string * mbfl_mime_header_decode( mbfl_string *string, mbfl_string *result, - enum mbfl_no_encoding outcode) + const mbfl_encoding *outcode) { - int n; + size_t n; unsigned char *p; struct mime_header_decoder_data *pd; mbfl_string_init(result); result->no_language = string->no_language; - result->no_encoding = outcode; + result->encoding = outcode; pd = mime_header_decoder_new(outcode); if (pd == NULL) { @@ -3039,7 +2838,7 @@ mbfl_html_numeric_entity( struct collector_htmlnumericentity_data pc; mbfl_memory_device device; mbfl_convert_filter *encoder; - int n; + size_t n; unsigned char *p; if (string == NULL || result == NULL) { @@ -3047,29 +2846,29 @@ mbfl_html_numeric_entity( } mbfl_string_init(result); result->no_language = string->no_language; - result->no_encoding = string->no_encoding; + result->encoding = string->encoding; mbfl_memory_device_init(&device, string->len, 0); /* output code filter */ pc.decoder = mbfl_convert_filter_new( - mbfl_no_encoding_wchar, - string->no_encoding, + &mbfl_encoding_wchar, + string->encoding, mbfl_memory_device_output, 0, &device); /* wchar filter */ if (type == 0) { /* decimal output */ encoder = mbfl_convert_filter_new( - string->no_encoding, - mbfl_no_encoding_wchar, + string->encoding, + &mbfl_encoding_wchar, collector_encode_htmlnumericentity, 0, &pc); } else if (type == 2) { /* hex output */ encoder = mbfl_convert_filter_new( - string->no_encoding, - mbfl_no_encoding_wchar, + string->encoding, + &mbfl_encoding_wchar, collector_encode_hex_htmlnumericentity, 0, &pc); } else { /* type == 1: decimal/hex input */ encoder = mbfl_convert_filter_new( - string->no_encoding, - mbfl_no_encoding_wchar, + string->encoding, + &mbfl_encoding_wchar, collector_decode_htmlnumericentity, (int (*)(void*))mbfl_filt_decode_htmlnumericentity_flush, &pc); } diff --git a/ext/mbstring/libmbfl/mbfl/mbfilter.h b/ext/mbstring/libmbfl/mbfl/mbfilter.h index 565ed3252d2ba..bbf1b70e9d16e 100644 --- a/ext/mbstring/libmbfl/mbfl/mbfilter.h +++ b/ext/mbstring/libmbfl/mbfl/mbfilter.h @@ -98,6 +98,17 @@ #include "mbfl_convert.h" #include "mbfl_ident.h" +/* Prefer local fix, otherwise need to include too much. */ +#ifndef ssize_t +#if defined(_WIN64) +#define ssize_t __int64 +#elif defined(_WIN32) +#define ssize_t __int32 +#elif defined(__GNUC__) && __GNUC__ >= 4 +#define ssize_t long +#endif +#endif + /* * version information */ @@ -126,20 +137,19 @@ struct _mbfl_buffer_converter { const mbfl_encoding *to; }; -MBFLAPI extern mbfl_buffer_converter * mbfl_buffer_converter_new(enum mbfl_no_encoding from, enum mbfl_no_encoding to, int buf_initsz); -MBFLAPI extern mbfl_buffer_converter * mbfl_buffer_converter_new2(const mbfl_encoding *from, const mbfl_encoding *to, int buf_initsz); +MBFLAPI extern mbfl_buffer_converter * mbfl_buffer_converter_new(const mbfl_encoding *from, const mbfl_encoding *to, size_t buf_initsz); MBFLAPI extern void mbfl_buffer_converter_delete(mbfl_buffer_converter *convd); MBFLAPI extern void mbfl_buffer_converter_reset(mbfl_buffer_converter *convd); MBFLAPI extern int mbfl_buffer_converter_illegal_mode(mbfl_buffer_converter *convd, int mode); MBFLAPI extern int mbfl_buffer_converter_illegal_substchar(mbfl_buffer_converter *convd, int substchar); -MBFLAPI extern int mbfl_buffer_converter_strncat(mbfl_buffer_converter *convd, const unsigned char *p, int n); +MBFLAPI extern int mbfl_buffer_converter_strncat(mbfl_buffer_converter *convd, const unsigned char *p, size_t n); MBFLAPI extern int mbfl_buffer_converter_feed(mbfl_buffer_converter *convd, mbfl_string *string); -MBFLAPI extern int mbfl_buffer_converter_feed2(mbfl_buffer_converter *convd, mbfl_string *string, int *loc); +MBFLAPI extern int mbfl_buffer_converter_feed2(mbfl_buffer_converter *convd, mbfl_string *string, size_t *loc); MBFLAPI extern int mbfl_buffer_converter_flush(mbfl_buffer_converter *convd); MBFLAPI extern mbfl_string * mbfl_buffer_converter_getbuffer(mbfl_buffer_converter *convd, mbfl_string *result); MBFLAPI extern mbfl_string * mbfl_buffer_converter_result(mbfl_buffer_converter *convd, mbfl_string *result); MBFLAPI extern mbfl_string * mbfl_buffer_converter_feed_result(mbfl_buffer_converter *convd, mbfl_string *string, mbfl_string *result); -MBFLAPI extern int mbfl_buffer_illegalchars(mbfl_buffer_converter *convd); +MBFLAPI extern size_t mbfl_buffer_illegalchars(mbfl_buffer_converter *convd); /* * encoding detector @@ -152,77 +162,82 @@ struct _mbfl_encoding_detector { int strict; }; -MBFLAPI extern mbfl_encoding_detector * mbfl_encoding_detector_new(enum mbfl_no_encoding *elist, int elistsz, int strict); -MBFLAPI extern mbfl_encoding_detector * mbfl_encoding_detector_new2(const mbfl_encoding **elist, int elistsz, int strict); +MBFLAPI extern mbfl_encoding_detector * mbfl_encoding_detector_new(const mbfl_encoding **elist, int elistsz, int strict); MBFLAPI extern void mbfl_encoding_detector_delete(mbfl_encoding_detector *identd); MBFLAPI extern int mbfl_encoding_detector_feed(mbfl_encoding_detector *identd, mbfl_string *string); -MBFLAPI extern enum mbfl_no_encoding mbfl_encoding_detector_judge(mbfl_encoding_detector *identd); -MBFLAPI extern const mbfl_encoding *mbfl_encoding_detector_judge2(mbfl_encoding_detector *identd); +MBFLAPI extern const mbfl_encoding *mbfl_encoding_detector_judge(mbfl_encoding_detector *identd); /* * encoding converter */ MBFLAPI extern mbfl_string * -mbfl_convert_encoding(mbfl_string *string, mbfl_string *result, enum mbfl_no_encoding toenc); +mbfl_convert_encoding(mbfl_string *string, mbfl_string *result, const mbfl_encoding *toenc); /* * identify encoding */ MBFLAPI extern const mbfl_encoding * -mbfl_identify_encoding(mbfl_string *string, enum mbfl_no_encoding *elist, int elistsz, int strict); +mbfl_identify_encoding(mbfl_string *string, const mbfl_encoding **elist, int elistsz, int strict); + +/* Lengths -1 through -16 are reserved for error return values */ +static inline int mbfl_is_error(size_t len) { + return len >= (size_t) -16; +} -MBFLAPI extern const mbfl_encoding * -mbfl_identify_encoding2(mbfl_string *string, const mbfl_encoding **elist, int elistsz, int strict); /* * strlen */ -MBFLAPI extern int +MBFLAPI extern size_t mbfl_strlen(mbfl_string *string); /* * oddlen */ -MBFLAPI extern int +MBFLAPI extern size_t mbfl_oddlen(mbfl_string *string); /* * strpos */ -MBFLAPI extern int -mbfl_strpos(mbfl_string *haystack, mbfl_string *needle, int offset, int reverse); - +MBFLAPI extern size_t +mbfl_strpos(mbfl_string *haystack, mbfl_string *needle, ssize_t offset, int reverse); /* * substr_count */ -MBFLAPI extern int +MBFLAPI extern size_t mbfl_substr_count(mbfl_string *haystack, mbfl_string *needle); +/* + * If specified as length, the substr until the end of the string is taken. + */ +#define MBFL_SUBSTR_UNTIL_END ((size_t) -1) + /* * substr */ MBFLAPI extern mbfl_string * -mbfl_substr(mbfl_string *string, mbfl_string *result, int from, int length); +mbfl_substr(mbfl_string *string, mbfl_string *result, size_t from, size_t length); /* * strcut */ MBFLAPI extern mbfl_string * -mbfl_strcut(mbfl_string *string, mbfl_string *result, int from, int length); +mbfl_strcut(mbfl_string *string, mbfl_string *result, size_t from, size_t length); /* * strwidth */ -MBFLAPI extern int +MBFLAPI extern size_t mbfl_strwidth(mbfl_string *string); /* * strimwidth */ MBFLAPI extern mbfl_string * -mbfl_strimwidth(mbfl_string *string, mbfl_string *marker, mbfl_string *result, int from, int width); +mbfl_strimwidth(mbfl_string *string, mbfl_string *marker, mbfl_string *result, size_t from, size_t width); /* * MIME header encode @@ -231,9 +246,9 @@ struct mime_header_encoder_data; /* forward declaration */ MBFLAPI extern struct mime_header_encoder_data * mime_header_encoder_new( - enum mbfl_no_encoding incode, - enum mbfl_no_encoding outcode, - enum mbfl_no_encoding encoding); + const mbfl_encoding *incode, + const mbfl_encoding *outcode, + const mbfl_encoding *encoding); MBFLAPI extern void mime_header_encoder_delete(struct mime_header_encoder_data *pe); @@ -247,8 +262,8 @@ mime_header_encoder_result(struct mime_header_encoder_data *pe, mbfl_string *res MBFLAPI extern mbfl_string * mbfl_mime_header_encode( mbfl_string *string, mbfl_string *result, - enum mbfl_no_encoding outcode, - enum mbfl_no_encoding encoding, + const mbfl_encoding *outcode, + const mbfl_encoding *encoding, const char *linefeed, int indent); @@ -258,7 +273,7 @@ mbfl_mime_header_encode( struct mime_header_decoder_data; /* forward declaration */ MBFLAPI extern struct mime_header_decoder_data * -mime_header_decoder_new(enum mbfl_no_encoding outcode); +mime_header_decoder_new(const mbfl_encoding *outcode); MBFLAPI extern void mime_header_decoder_delete(struct mime_header_decoder_data *pd); @@ -273,7 +288,7 @@ MBFLAPI extern mbfl_string * mbfl_mime_header_decode( mbfl_string *string, mbfl_string *result, - enum mbfl_no_encoding outcode); + const mbfl_encoding *outcode); /* * convert HTML numeric entity diff --git a/ext/mbstring/libmbfl/mbfl/mbfilter_8bit.c b/ext/mbstring/libmbfl/mbfl/mbfilter_8bit.c index ed79746f6af55..4faa9b8b1bb06 100644 --- a/ext/mbstring/libmbfl/mbfl/mbfilter_8bit.c +++ b/ext/mbstring/libmbfl/mbfl/mbfilter_8bit.c @@ -46,5 +46,7 @@ const mbfl_encoding mbfl_encoding_8bit = { "8bit", (const char *(*)[])&mbfl_encoding_8bit_aliases, NULL, - MBFL_ENCTYPE_SBCS + MBFL_ENCTYPE_SBCS, + NULL, + NULL }; diff --git a/ext/mbstring/libmbfl/mbfl/mbfilter_pass.c b/ext/mbstring/libmbfl/mbfl/mbfilter_pass.c index b19432f76a4a5..a9c6fd4204817 100644 --- a/ext/mbstring/libmbfl/mbfl/mbfilter_pass.c +++ b/ext/mbstring/libmbfl/mbfl/mbfilter_pass.c @@ -46,7 +46,9 @@ const mbfl_encoding mbfl_encoding_pass = { NULL, (const char *(*)[])&mbfl_encoding_pass_aliases, NULL, - 0 + 0, + NULL, + NULL }; const struct mbfl_convert_vtbl vtbl_pass = { diff --git a/ext/mbstring/libmbfl/mbfl/mbfilter_wchar.c b/ext/mbstring/libmbfl/mbfl/mbfilter_wchar.c index ace81b4c7263a..97142a16cb04e 100644 --- a/ext/mbstring/libmbfl/mbfl/mbfilter_wchar.c +++ b/ext/mbstring/libmbfl/mbfl/mbfilter_wchar.c @@ -44,5 +44,7 @@ const mbfl_encoding mbfl_encoding_wchar = { NULL, NULL, NULL, - MBFL_ENCTYPE_WCS4BE + MBFL_ENCTYPE_WCS4BE, + NULL, + NULL }; diff --git a/ext/mbstring/libmbfl/mbfl/mbfl_allocators.c b/ext/mbstring/libmbfl/mbfl/mbfl_allocators.c index f52c94cf37483..aa468da2528ac 100644 --- a/ext/mbstring/libmbfl/mbfl/mbfl_allocators.c +++ b/ext/mbstring/libmbfl/mbfl/mbfl_allocators.c @@ -54,9 +54,9 @@ #include "mbfl_allocators.h" -static void *__mbfl__malloc(unsigned int); -static void *__mbfl__realloc(void *, unsigned int); -static void *__mbfl__calloc(unsigned int, unsigned int); +static void *__mbfl__malloc(size_t); +static void *__mbfl__realloc(void *, size_t); +static void *__mbfl__calloc(size_t, size_t); static void __mbfl__free(void *); static mbfl_allocators default_allocators = { @@ -71,17 +71,17 @@ static mbfl_allocators default_allocators = { mbfl_allocators *__mbfl_allocators = &default_allocators; -static void *__mbfl__malloc(unsigned int sz) +static void *__mbfl__malloc(size_t sz) { return malloc(sz); } -static void *__mbfl__realloc(void *ptr, unsigned int sz) +static void *__mbfl__realloc(void *ptr, size_t sz) { return realloc(ptr, sz); } -static void *__mbfl__calloc(unsigned int nelems, unsigned int szelem) +static void *__mbfl__calloc(size_t nelems, size_t szelem) { return calloc(nelems, szelem); } diff --git a/ext/mbstring/libmbfl/mbfl/mbfl_allocators.h b/ext/mbstring/libmbfl/mbfl/mbfl_allocators.h index b2981c6f1f779..08fc275d04c1e 100644 --- a/ext/mbstring/libmbfl/mbfl/mbfl_allocators.h +++ b/ext/mbstring/libmbfl/mbfl/mbfl_allocators.h @@ -31,15 +31,16 @@ #ifndef MBFL_ALLOCATORS_H #define MBFL_ALLOCATORS_H +#include #include "mbfl_defs.h" typedef struct _mbfl_allocators { - void *(*malloc)(unsigned int); - void *(*realloc)(void *, unsigned int); - void *(*calloc)(unsigned int, unsigned int); + void *(*malloc)(size_t); + void *(*realloc)(void *, size_t); + void *(*calloc)(size_t, size_t); void (*free)(void *); - void *(*pmalloc)(unsigned int); - void *(*prealloc)(void *, unsigned int); + void *(*pmalloc)(size_t); + void *(*prealloc)(void *, size_t); void (*pfree)(void *); } mbfl_allocators; diff --git a/ext/mbstring/libmbfl/mbfl/mbfl_convert.c b/ext/mbstring/libmbfl/mbfl/mbfl_convert.c index a73a0c80e502a..7a0fb60264c21 100644 --- a/ext/mbstring/libmbfl/mbfl/mbfl_convert.c +++ b/ext/mbstring/libmbfl/mbfl/mbfl_convert.c @@ -110,170 +110,14 @@ static char mbfl_hexchar_table[] = { 0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x41,0x42,0x43,0x44,0x45,0x46 }; -const struct mbfl_convert_vtbl *mbfl_convert_filter_list[] = { - &vtbl_utf8_wchar, - &vtbl_wchar_utf8, - &vtbl_eucjp_wchar, - &vtbl_wchar_eucjp, - &vtbl_sjis_wchar, - &vtbl_wchar_sjis, - &vtbl_sjis_open_wchar, - &vtbl_wchar_sjis_open, - &vtbl_sjis2004_wchar, - &vtbl_wchar_sjis2004, - &vtbl_cp51932_wchar, - &vtbl_wchar_cp51932, - &vtbl_jis_wchar, - &vtbl_wchar_jis, - &vtbl_jis_ms_wchar, - &vtbl_wchar_jis_ms, - &vtbl_2022jp_wchar, - &vtbl_wchar_2022jp, - &vtbl_2022jpms_wchar, - &vtbl_wchar_2022jpms, - &vtbl_2022jp_2004_wchar, - &vtbl_wchar_2022jp_2004, - &vtbl_2022jp_kddi_wchar, - &vtbl_wchar_2022jp_kddi, - &vtbl_eucjpwin_wchar, - &vtbl_wchar_eucjpwin, - &vtbl_eucjp2004_wchar, - &vtbl_wchar_eucjp2004, - &vtbl_cp932_wchar, - &vtbl_wchar_cp932, - &vtbl_sjis_docomo_wchar, - &vtbl_wchar_sjis_docomo, - &vtbl_sjis_kddi_wchar, - &vtbl_wchar_sjis_kddi, - &vtbl_sjis_sb_wchar, - &vtbl_wchar_sjis_sb, - &vtbl_sjis_mac_wchar, - &vtbl_wchar_sjis_mac, - &vtbl_utf8_docomo_wchar, - &vtbl_wchar_utf8_docomo, - &vtbl_utf8_kddi_a_wchar, - &vtbl_wchar_utf8_kddi_a, - &vtbl_utf8_kddi_b_wchar, - &vtbl_wchar_utf8_kddi_b, - &vtbl_utf8_sb_wchar, - &vtbl_wchar_utf8_sb, - &vtbl_euccn_wchar, - &vtbl_wchar_euccn, - &vtbl_cp936_wchar, - &vtbl_wchar_cp936, - &vtbl_gb18030_wchar, - &vtbl_wchar_gb18030, - &vtbl_hz_wchar, - &vtbl_wchar_hz, - &vtbl_euctw_wchar, - &vtbl_wchar_euctw, - &vtbl_big5_wchar, - &vtbl_wchar_big5, - &vtbl_cp950_wchar, - &vtbl_wchar_cp950, - &vtbl_euckr_wchar, - &vtbl_wchar_euckr, - &vtbl_uhc_wchar, - &vtbl_wchar_uhc, - &vtbl_2022kr_wchar, - &vtbl_wchar_2022kr, - &vtbl_cp1251_wchar, - &vtbl_wchar_cp1251, - &vtbl_cp866_wchar, - &vtbl_wchar_cp866, - &vtbl_koi8r_wchar, - &vtbl_wchar_koi8r, - &vtbl_koi8u_wchar, - &vtbl_wchar_koi8u, - &vtbl_cp1252_wchar, - &vtbl_wchar_cp1252, - &vtbl_cp1254_wchar, - &vtbl_wchar_cp1254, - &vtbl_cp50220_wchar, - &vtbl_wchar_cp50220, - &vtbl_cp50220raw_wchar, - &vtbl_wchar_cp50220raw, - &vtbl_cp50221_wchar, - &vtbl_wchar_cp50221, - &vtbl_cp50222_wchar, - &vtbl_wchar_cp50222, - &vtbl_ascii_wchar, - &vtbl_wchar_ascii, - &vtbl_8859_1_wchar, - &vtbl_wchar_8859_1, - &vtbl_8859_2_wchar, - &vtbl_wchar_8859_2, - &vtbl_8859_3_wchar, - &vtbl_wchar_8859_3, - &vtbl_8859_4_wchar, - &vtbl_wchar_8859_4, - &vtbl_8859_5_wchar, - &vtbl_wchar_8859_5, - &vtbl_8859_6_wchar, - &vtbl_wchar_8859_6, - &vtbl_8859_7_wchar, - &vtbl_wchar_8859_7, - &vtbl_8859_8_wchar, - &vtbl_wchar_8859_8, - &vtbl_8859_9_wchar, - &vtbl_wchar_8859_9, - &vtbl_8859_10_wchar, - &vtbl_wchar_8859_10, - &vtbl_8859_13_wchar, - &vtbl_wchar_8859_13, - &vtbl_8859_14_wchar, - &vtbl_wchar_8859_14, - &vtbl_8859_15_wchar, - &vtbl_wchar_8859_15, +static const struct mbfl_convert_vtbl *mbfl_special_filter_list[] = { &vtbl_8bit_b64, &vtbl_b64_8bit, &vtbl_uuencode_8bit, - &vtbl_wchar_html, - &vtbl_html_wchar, &vtbl_8bit_qprint, &vtbl_qprint_8bit, &vtbl_8bit_7bit, &vtbl_7bit_8bit, - &vtbl_utf7_wchar, - &vtbl_wchar_utf7, - &vtbl_utf7imap_wchar, - &vtbl_wchar_utf7imap, - &vtbl_utf16_wchar, - &vtbl_wchar_utf16, - &vtbl_utf16be_wchar, - &vtbl_wchar_utf16be, - &vtbl_utf16le_wchar, - &vtbl_wchar_utf16le, - &vtbl_utf32_wchar, - &vtbl_wchar_utf32, - &vtbl_utf32be_wchar, - &vtbl_wchar_utf32be, - &vtbl_utf32le_wchar, - &vtbl_wchar_utf32le, - &vtbl_ucs4_wchar, - &vtbl_wchar_ucs4, - &vtbl_ucs4be_wchar, - &vtbl_wchar_ucs4be, - &vtbl_ucs4le_wchar, - &vtbl_wchar_ucs4le, - &vtbl_ucs2_wchar, - &vtbl_wchar_ucs2, - &vtbl_ucs2be_wchar, - &vtbl_wchar_ucs2be, - &vtbl_ucs2le_wchar, - &vtbl_wchar_ucs2le, - &vtbl_byte4be_wchar, - &vtbl_wchar_byte4be, - &vtbl_byte4le_wchar, - &vtbl_wchar_byte4le, - &vtbl_byte2be_wchar, - &vtbl_wchar_byte2be, - &vtbl_byte2le_wchar, - &vtbl_wchar_byte2le, - &vtbl_armscii8_wchar, - &vtbl_wchar_armscii8, - &vtbl_cp850_wchar, - &vtbl_wchar_cp850, &vtbl_pass, NULL }; @@ -281,21 +125,16 @@ const struct mbfl_convert_vtbl *mbfl_convert_filter_list[] = { static int mbfl_convert_filter_common_init( mbfl_convert_filter *filter, - enum mbfl_no_encoding from, - enum mbfl_no_encoding to, + const mbfl_encoding *from, + const mbfl_encoding *to, const struct mbfl_convert_vtbl *vtbl, int (*output_function)(int, void* ), int (*flush_function)(void*), void* data) { /* encoding structure */ - if ((filter->from = mbfl_no2encoding(from)) == NULL) { - return 1; - } - - if ((filter->to = mbfl_no2encoding(to)) == NULL) { - return 1; - } + filter->from = from; + filter->to = to; if (output_function != NULL) { filter->output_function = output_function; @@ -322,8 +161,8 @@ mbfl_convert_filter_common_init( mbfl_convert_filter * mbfl_convert_filter_new( - enum mbfl_no_encoding from, - enum mbfl_no_encoding to, + const mbfl_encoding *from, + const mbfl_encoding *to, int (*output_function)(int, void* ), int (*flush_function)(void*), void* data) @@ -360,18 +199,22 @@ mbfl_convert_filter_new2( void* data) { mbfl_convert_filter * filter; + const mbfl_encoding *from_encoding, *to_encoding; if (vtbl == NULL) { vtbl = &vtbl_pass; } + from_encoding = mbfl_no2encoding(vtbl->from); + to_encoding = mbfl_no2encoding(vtbl->to); + /* allocate */ filter = (mbfl_convert_filter *)mbfl_malloc(sizeof(mbfl_convert_filter)); if (filter == NULL) { return NULL; } - if (mbfl_convert_filter_common_init(filter, vtbl->from, vtbl->to, vtbl, + if (mbfl_convert_filter_common_init(filter, from_encoding, to_encoding, vtbl, output_function, flush_function, data)) { mbfl_free(filter); return NULL; @@ -395,6 +238,17 @@ mbfl_convert_filter_feed(int c, mbfl_convert_filter *filter) return (*filter->filter_function)(c, filter); } +int +mbfl_convert_filter_feed_string(mbfl_convert_filter *filter, const unsigned char *p, size_t len) { + while (len > 0) { + if ((*filter->filter_function)(*p++, filter) < 0) { + return -1; + } + len--; + } + return 0; +} + int mbfl_convert_filter_flush(mbfl_convert_filter *filter) { @@ -403,7 +257,7 @@ mbfl_convert_filter_flush(mbfl_convert_filter *filter) } void mbfl_convert_filter_reset(mbfl_convert_filter *filter, - enum mbfl_no_encoding from, enum mbfl_no_encoding to) + const mbfl_encoding *from, const mbfl_encoding *to) { const struct mbfl_convert_vtbl *vtbl; @@ -435,7 +289,7 @@ mbfl_convert_filter_copy( int mbfl_convert_filter_devcat(mbfl_convert_filter *filter, mbfl_memory_device *src) { - int n; + size_t n; unsigned char *p; p = src->buffer; @@ -447,7 +301,7 @@ int mbfl_convert_filter_devcat(mbfl_convert_filter *filter, mbfl_memory_device * n--; } - return n; + return 0; } int mbfl_convert_filter_strcat(mbfl_convert_filter *filter, const unsigned char *p) @@ -587,29 +441,33 @@ mbfl_filt_conv_illegal_output(int c, mbfl_convert_filter *filter) return ret; } -const struct mbfl_convert_vtbl * mbfl_convert_filter_get_vtbl(enum mbfl_no_encoding from, enum mbfl_no_encoding to) +const struct mbfl_convert_vtbl * mbfl_convert_filter_get_vtbl( + const mbfl_encoding *from, const mbfl_encoding *to) { - const struct mbfl_convert_vtbl *vtbl; - int i; - - if (to == mbfl_no_encoding_base64 || - to == mbfl_no_encoding_qprint || - to == mbfl_no_encoding_7bit) { - from = mbfl_no_encoding_8bit; - } else if (from == mbfl_no_encoding_base64 || - from == mbfl_no_encoding_qprint || - from == mbfl_no_encoding_uuencode) { - to = mbfl_no_encoding_8bit; + if (to->no_encoding == mbfl_no_encoding_base64 || + to->no_encoding == mbfl_no_encoding_qprint || + to->no_encoding == mbfl_no_encoding_7bit) { + from = &mbfl_encoding_8bit; + } else if (from->no_encoding == mbfl_no_encoding_base64 || + from->no_encoding == mbfl_no_encoding_qprint || + from->no_encoding == mbfl_no_encoding_uuencode) { + to = &mbfl_encoding_8bit; } - i = 0; - while ((vtbl = mbfl_convert_filter_list[i++]) != NULL){ - if (vtbl->from == from && vtbl->to == to) { - return vtbl; + if (to->no_encoding == mbfl_no_encoding_wchar) { + return from->input_filter; + } else if (from->no_encoding == mbfl_no_encoding_wchar) { + return to->output_filter; + } else { + int i = 0; + const struct mbfl_convert_vtbl *vtbl; + while ((vtbl = mbfl_special_filter_list[i++]) != NULL){ + if (vtbl->from == from->no_encoding && vtbl->to == to->no_encoding) { + return vtbl; + } } + return NULL; } - - return NULL; } /* diff --git a/ext/mbstring/libmbfl/mbfl/mbfl_convert.h b/ext/mbstring/libmbfl/mbfl/mbfl_convert.h index ad0911723aa3d..31e54c61d18bf 100644 --- a/ext/mbstring/libmbfl/mbfl/mbfl_convert.h +++ b/ext/mbstring/libmbfl/mbfl/mbfl_convert.h @@ -52,25 +52,13 @@ struct _mbfl_convert_filter { const mbfl_encoding *to; int illegal_mode; int illegal_substchar; - int num_illegalchar; + size_t num_illegalchar; void *opaque; }; -struct mbfl_convert_vtbl { - enum mbfl_no_encoding from; - enum mbfl_no_encoding to; - void (*filter_ctor)(mbfl_convert_filter *filter); - void (*filter_dtor)(mbfl_convert_filter *filter); - int (*filter_function)(int c, mbfl_convert_filter *filter); - int (*filter_flush)(mbfl_convert_filter *filter); - void (*filter_copy)(mbfl_convert_filter *src, mbfl_convert_filter *dest); -}; - -MBFLAPI extern const struct mbfl_convert_vtbl *mbfl_convert_filter_list[]; - MBFLAPI extern mbfl_convert_filter *mbfl_convert_filter_new( - enum mbfl_no_encoding from, - enum mbfl_no_encoding to, + const mbfl_encoding *from, + const mbfl_encoding *to, int (*output_function)(int, void *), int (*flush_function)(void *), void *data ); @@ -81,11 +69,12 @@ MBFLAPI extern mbfl_convert_filter *mbfl_convert_filter_new2( void *data ); MBFLAPI extern void mbfl_convert_filter_delete(mbfl_convert_filter *filter); MBFLAPI extern int mbfl_convert_filter_feed(int c, mbfl_convert_filter *filter); +MBFLAPI extern int mbfl_convert_filter_feed_string(mbfl_convert_filter *filter, const unsigned char *p, size_t len); MBFLAPI extern int mbfl_convert_filter_flush(mbfl_convert_filter *filter); -MBFLAPI extern void mbfl_convert_filter_reset(mbfl_convert_filter *filter, enum mbfl_no_encoding from, enum mbfl_no_encoding to); +MBFLAPI extern void mbfl_convert_filter_reset(mbfl_convert_filter *filter, const mbfl_encoding *from, const mbfl_encoding *to); MBFLAPI extern void mbfl_convert_filter_copy(mbfl_convert_filter *src, mbfl_convert_filter *dist); MBFLAPI extern int mbfl_filt_conv_illegal_output(int c, mbfl_convert_filter *filter); -MBFLAPI extern const struct mbfl_convert_vtbl * mbfl_convert_filter_get_vtbl(enum mbfl_no_encoding from, enum mbfl_no_encoding to); +MBFLAPI extern const struct mbfl_convert_vtbl * mbfl_convert_filter_get_vtbl(const mbfl_encoding *from, const mbfl_encoding *to); MBFLAPI extern void mbfl_filt_conv_common_ctor(mbfl_convert_filter *filter); MBFLAPI extern int mbfl_filt_conv_common_flush(mbfl_convert_filter *filter); diff --git a/ext/mbstring/libmbfl/mbfl/mbfl_defs.h b/ext/mbstring/libmbfl/mbfl/mbfl_defs.h index 753724d7be01d..8b18e5e0c48b4 100644 --- a/ext/mbstring/libmbfl/mbfl/mbfl_defs.h +++ b/ext/mbstring/libmbfl/mbfl/mbfl_defs.h @@ -39,6 +39,10 @@ #endif #endif +#ifndef SIZE_MAX +#define SIZE_MAX ((size_t)~0) +#endif + #ifdef WIN32 #ifdef MBFL_DLL_EXPORT #define MBFLAPI __declspec(dllexport) diff --git a/ext/mbstring/libmbfl/mbfl/mbfl_encoding.c b/ext/mbstring/libmbfl/mbfl/mbfl_encoding.c index e03c2acaffc54..77c5daeeffbaf 100644 --- a/ext/mbstring/libmbfl/mbfl/mbfl_encoding.c +++ b/ext/mbstring/libmbfl/mbfl/mbfl_encoding.c @@ -127,7 +127,9 @@ static const mbfl_encoding mbfl_encoding_auto = { NULL, (const char *(*)[])&mbfl_encoding_auto_aliases, NULL, - 0 + 0, + NULL, + NULL }; static const mbfl_encoding *mbfl_encoding_ptr_list[] = { diff --git a/ext/mbstring/libmbfl/mbfl/mbfl_encoding.h b/ext/mbstring/libmbfl/mbfl/mbfl_encoding.h index d080f7b6a4b7e..2952977fd88e6 100644 --- a/ext/mbstring/libmbfl/mbfl/mbfl_encoding.h +++ b/ext/mbstring/libmbfl/mbfl/mbfl_encoding.h @@ -128,6 +128,17 @@ enum mbfl_no_encoding { typedef enum mbfl_no_encoding mbfl_encoding_id; +struct _mbfl_convert_filter; +struct mbfl_convert_vtbl { + enum mbfl_no_encoding from; + enum mbfl_no_encoding to; + void (*filter_ctor)(struct _mbfl_convert_filter *filter); + void (*filter_dtor)(struct _mbfl_convert_filter *filter); + int (*filter_function)(int c, struct _mbfl_convert_filter *filter); + int (*filter_flush)(struct _mbfl_convert_filter *filter); + void (*filter_copy)(struct _mbfl_convert_filter *src, struct _mbfl_convert_filter *dest); +}; + /* * encoding */ @@ -138,6 +149,8 @@ typedef struct _mbfl_encoding { const char *(*aliases)[]; const unsigned char *mblen_table; unsigned int flag; + const struct mbfl_convert_vtbl *input_filter; + const struct mbfl_convert_vtbl *output_filter; } mbfl_encoding; MBFLAPI extern const mbfl_encoding * mbfl_name2encoding(const char *name); diff --git a/ext/mbstring/libmbfl/mbfl/mbfl_memory_device.c b/ext/mbstring/libmbfl/mbfl/mbfl_memory_device.c index eae05953b2a59..bfa477fa06b0d 100644 --- a/ext/mbstring/libmbfl/mbfl/mbfl_memory_device.c +++ b/ext/mbstring/libmbfl/mbfl/mbfl_memory_device.c @@ -36,6 +36,7 @@ #include #endif +#include #include "mbfl_allocators.h" #include "mbfl_string.h" #include "mbfl_memory_device.h" @@ -44,18 +45,18 @@ * memory device output functions */ void -mbfl_memory_device_init(mbfl_memory_device *device, int initsz, int allocsz) +mbfl_memory_device_init(mbfl_memory_device *device, size_t initsz, size_t allocsz) { if (device) { device->length = 0; - device->buffer = (unsigned char *)0; + device->buffer = NULL; if (initsz > 0) { - device->buffer = (unsigned char *)mbfl_malloc(initsz*sizeof(unsigned char)); + device->buffer = (unsigned char *)mbfl_malloc(initsz); if (device->buffer != NULL) { device->length = initsz; } } - device->pos= 0; + device->pos = 0; if (allocsz > MBFL_MEMORY_DEVICE_ALLOC_SIZE) { device->allocsz = allocsz; } else { @@ -65,13 +66,13 @@ mbfl_memory_device_init(mbfl_memory_device *device, int initsz, int allocsz) } void -mbfl_memory_device_realloc(mbfl_memory_device *device, int initsz, int allocsz) +mbfl_memory_device_realloc(mbfl_memory_device *device, size_t initsz, size_t allocsz) { unsigned char *tmp; if (device) { if (initsz > device->length) { - tmp = (unsigned char *)mbfl_realloc((void *)device->buffer, initsz*sizeof(unsigned char)); + tmp = (unsigned char *)mbfl_realloc((void *)device->buffer, initsz); if (tmp != NULL) { device->buffer = tmp; device->length = initsz; @@ -92,7 +93,7 @@ mbfl_memory_device_clear(mbfl_memory_device *device) if (device->buffer) { mbfl_free(device->buffer); } - device->buffer = (unsigned char *)0; + device->buffer = NULL; device->length = 0; device->pos = 0; } @@ -119,9 +120,9 @@ mbfl_memory_device_result(mbfl_memory_device *device, mbfl_string *result) { if (device && result) { result->len = device->pos; - mbfl_memory_device_output4('\0', device); + mbfl_memory_device_output('\0', device); result->val = device->buffer; - device->buffer = (unsigned char *)0; + device->buffer = NULL; device->length = 0; device->pos= 0; if (result->val == NULL) { @@ -142,15 +143,16 @@ mbfl_memory_device_output(int c, void *data) if (device->pos >= device->length) { /* reallocate buffer */ - int newlen; + size_t newlen; unsigned char *tmp; - newlen = device->length + device->allocsz; - if (newlen <= 0) { + if (device->length > SIZE_MAX - device->allocsz) { /* overflow */ return -1; } - tmp = (unsigned char *)mbfl_realloc((void *)device->buffer, newlen*sizeof(unsigned char)); + + newlen = device->length + device->allocsz; + tmp = (unsigned char *)mbfl_realloc((void *)device->buffer, newlen); if (tmp == NULL) { return -1; } @@ -167,17 +169,18 @@ mbfl_memory_device_output2(int c, void *data) { mbfl_memory_device *device = (mbfl_memory_device *)data; - if ((device->pos + 2) >= device->length) { + if (2 > device->length - device->pos) { /* reallocate buffer */ - int newlen; + size_t newlen; unsigned char *tmp; - newlen = device->length + device->allocsz; - if (newlen <= 0) { + if (device->length > SIZE_MAX - device->allocsz) { /* overflow */ return -1; } - tmp = (unsigned char *)mbfl_realloc((void *)device->buffer, newlen*sizeof(unsigned char)); + + newlen = device->length + device->allocsz; + tmp = (unsigned char *)mbfl_realloc((void *)device->buffer, newlen); if (tmp == NULL) { return -1; } @@ -196,17 +199,18 @@ mbfl_memory_device_output4(int c, void* data) { mbfl_memory_device *device = (mbfl_memory_device *)data; - if ((device->pos + 4) >= device->length) { + if (4 > device->length - device->pos) { /* reallocate buffer */ - int newlen; + size_t newlen; unsigned char *tmp; - newlen = device->length + device->allocsz; - if (newlen <= 0) { + if (device->length > SIZE_MAX - device->allocsz) { /* overflow */ return -1; } - tmp = (unsigned char *)mbfl_realloc((void *)device->buffer, newlen*sizeof(unsigned char)); + + newlen = device->length + device->allocsz; + tmp = (unsigned char *)mbfl_realloc((void *)device->buffer, newlen); if (tmp == NULL) { return -1; } @@ -225,114 +229,53 @@ mbfl_memory_device_output4(int c, void* data) int mbfl_memory_device_strcat(mbfl_memory_device *device, const char *psrc) { - int len; - unsigned char *w; - const unsigned char *p; - - len = 0; - p = (const unsigned char*)psrc; - while (*p) { - p++; - len++; - } - - if ((device->pos + len) >= device->length) { - /* reallocate buffer */ - int newlen = device->length + (len + MBFL_MEMORY_DEVICE_ALLOC_SIZE)*sizeof(unsigned char); - unsigned char *tmp; - if (newlen <= 0) { - /* overflow */ - return -1; - } - tmp = (unsigned char *)mbfl_realloc((void *)device->buffer, newlen*sizeof(unsigned char)); - if (tmp == NULL) { - return -1; - } - device->length = newlen; - device->buffer = tmp; - } - - p = (const unsigned char*)psrc; - w = &device->buffer[device->pos]; - device->pos += len; - while (len > 0) { - *w++ = *p++; - len--; - } - - return len; + return mbfl_memory_device_strncat(device, psrc, strlen(psrc)); } int -mbfl_memory_device_strncat(mbfl_memory_device *device, const char *psrc, int len) +mbfl_memory_device_strncat(mbfl_memory_device *device, const char *psrc, size_t len) { unsigned char *w; - if ((device->pos + len) >= device->length) { + if (len > device->length - device->pos) { /* reallocate buffer */ - int newlen = device->length + len + MBFL_MEMORY_DEVICE_ALLOC_SIZE; + size_t newlen; unsigned char *tmp; - if (newlen <= 0) { + + if (len > SIZE_MAX - MBFL_MEMORY_DEVICE_ALLOC_SIZE + || device->length > SIZE_MAX - (len + MBFL_MEMORY_DEVICE_ALLOC_SIZE)) { /* overflow */ return -1; } - tmp = (unsigned char *)mbfl_realloc((void *)device->buffer, newlen*sizeof(unsigned char)); + + newlen = device->length + len + MBFL_MEMORY_DEVICE_ALLOC_SIZE; + tmp = (unsigned char *)mbfl_realloc((void *)device->buffer, newlen); if (tmp == NULL) { return -1; } + device->length = newlen; device->buffer = tmp; } w = &device->buffer[device->pos]; + memcpy(w, psrc, len); device->pos += len; - while (len > 0) { - *w++ = *psrc++; - len--; - } - return len; + return 0; } int mbfl_memory_device_devcat(mbfl_memory_device *dest, mbfl_memory_device *src) { - int n; - unsigned char *p, *w; - - if ((dest->pos + src->pos) >= dest->length) { - /* reallocate buffer */ - int newlen = dest->length + src->pos + MBFL_MEMORY_DEVICE_ALLOC_SIZE; - unsigned char *tmp; - if (newlen <= 0) { - /* overflow */ - return -1; - } - tmp = (unsigned char *)mbfl_realloc((void *)dest->buffer, newlen*sizeof(unsigned char)); - if (tmp == NULL) { - return -1; - } - dest->length = newlen; - dest->buffer = tmp; - } - - p = src->buffer; - w = &dest->buffer[dest->pos]; - n = src->pos; - dest->pos += n; - while (n > 0) { - *w++ = *p++; - n--; - } - - return n; + return mbfl_memory_device_strncat(dest, (const char *) src->buffer, src->pos); } void mbfl_wchar_device_init(mbfl_wchar_device *device) { if (device) { - device->buffer = (unsigned int *)0; + device->buffer = NULL; device->length = 0; device->pos= 0; device->allocsz = MBFL_MEMORY_DEVICE_ALLOC_SIZE; @@ -346,7 +289,7 @@ mbfl_wchar_device_clear(mbfl_wchar_device *device) if (device->buffer) { mbfl_free(device->buffer); } - device->buffer = (unsigned int*)0; + device->buffer = NULL; device->length = 0; device->pos = 0; } @@ -359,14 +302,20 @@ mbfl_wchar_device_output(int c, void *data) if (device->pos >= device->length) { /* reallocate buffer */ - int newlen; + size_t newlen; unsigned int *tmp; + if (device->length > SIZE_MAX - device->allocsz) { + /* overflow */ + return -1; + } + newlen = device->length + device->allocsz; - if (newlen <= 0) { + if (newlen > SIZE_MAX / sizeof(int)) { /* overflow */ return -1; } + tmp = (unsigned int *)mbfl_realloc((void *)device->buffer, newlen*sizeof(int)); if (tmp == NULL) { return -1; diff --git a/ext/mbstring/libmbfl/mbfl/mbfl_memory_device.h b/ext/mbstring/libmbfl/mbfl/mbfl_memory_device.h index 0e8a82f0e8294..985e2511582dd 100644 --- a/ext/mbstring/libmbfl/mbfl/mbfl_memory_device.h +++ b/ext/mbstring/libmbfl/mbfl/mbfl_memory_device.h @@ -38,29 +38,33 @@ typedef struct _mbfl_memory_device { unsigned char *buffer; - int length; - int pos; - int allocsz; + size_t length; + size_t pos; + size_t allocsz; } mbfl_memory_device; typedef struct _mbfl_wchar_device { unsigned int *buffer; - int length; - int pos; - int allocsz; + size_t length; + size_t pos; + size_t allocsz; } mbfl_wchar_device; -MBFLAPI extern void mbfl_memory_device_init(mbfl_memory_device *device, int initsz, int allocsz); -MBFLAPI extern void mbfl_memory_device_realloc(mbfl_memory_device *device, int initsz, int allocsz); +MBFLAPI extern void mbfl_memory_device_init( + mbfl_memory_device *device, size_t initsz, size_t allocsz); +MBFLAPI extern void mbfl_memory_device_realloc( + mbfl_memory_device *device, size_t initsz, size_t allocsz); MBFLAPI extern void mbfl_memory_device_clear(mbfl_memory_device *device); MBFLAPI extern void mbfl_memory_device_reset(mbfl_memory_device *device); -MBFLAPI extern mbfl_string * mbfl_memory_device_result(mbfl_memory_device *device, mbfl_string *result); +MBFLAPI extern mbfl_string * mbfl_memory_device_result( + mbfl_memory_device *device, mbfl_string *result); MBFLAPI extern void mbfl_memory_device_unput(mbfl_memory_device *device); MBFLAPI extern int mbfl_memory_device_output(int c, void *data); MBFLAPI extern int mbfl_memory_device_output2(int c, void *data); MBFLAPI extern int mbfl_memory_device_output4(int c, void *data); MBFLAPI extern int mbfl_memory_device_strcat(mbfl_memory_device *device, const char *psrc); -MBFLAPI extern int mbfl_memory_device_strncat(mbfl_memory_device *device, const char *psrc, int len); +MBFLAPI extern int mbfl_memory_device_strncat( + mbfl_memory_device *device, const char *psrc, size_t len); MBFLAPI extern int mbfl_memory_device_devcat(mbfl_memory_device *dest, mbfl_memory_device *src); MBFLAPI extern void mbfl_wchar_device_init(mbfl_wchar_device *device); diff --git a/ext/mbstring/libmbfl/mbfl/mbfl_string.c b/ext/mbstring/libmbfl/mbfl/mbfl_string.c index 69f594350e865..b26226500b769 100644 --- a/ext/mbstring/libmbfl/mbfl/mbfl_string.c +++ b/ext/mbstring/libmbfl/mbfl/mbfl_string.c @@ -38,6 +38,7 @@ #include "mbfl_allocators.h" #include "mbfl_string.h" +#include "mbfilter_pass.h" /* * string object @@ -47,18 +48,18 @@ mbfl_string_init(mbfl_string *string) { if (string) { string->no_language = mbfl_no_language_uni; - string->no_encoding = mbfl_no_encoding_pass; + string->encoding = &mbfl_encoding_pass; string->val = (unsigned char*)NULL; string->len = 0; } } void -mbfl_string_init_set(mbfl_string *string, mbfl_language_id no_language, mbfl_encoding_id no_encoding) +mbfl_string_init_set(mbfl_string *string, mbfl_language_id no_language, const mbfl_encoding *encoding) { if (string) { string->no_language = no_language; - string->no_encoding = no_encoding; + string->encoding = encoding; string->val = (unsigned char*)NULL; string->len = 0; } diff --git a/ext/mbstring/libmbfl/mbfl/mbfl_string.h b/ext/mbstring/libmbfl/mbfl/mbfl_string.h index 560944737ea30..43f4a5fa7527b 100644 --- a/ext/mbstring/libmbfl/mbfl/mbfl_string.h +++ b/ext/mbstring/libmbfl/mbfl/mbfl_string.h @@ -31,6 +31,7 @@ #ifndef MBFL_STRING_H #define MBFL_STRING_H +#include #include "mbfl_defs.h" #include "mbfl_encoding.h" #include "mbfl_language.h" @@ -40,13 +41,13 @@ */ typedef struct _mbfl_string { enum mbfl_no_language no_language; - enum mbfl_no_encoding no_encoding; + const mbfl_encoding *encoding; unsigned char *val; - unsigned int len; + size_t len; } mbfl_string; MBFLAPI extern void mbfl_string_init(mbfl_string *string); -MBFLAPI extern void mbfl_string_init_set(mbfl_string *string, mbfl_language_id no_language, mbfl_encoding_id no_encoding); +MBFLAPI extern void mbfl_string_init_set(mbfl_string *string, mbfl_language_id no_language, const mbfl_encoding *encoding); MBFLAPI extern void mbfl_string_clear(mbfl_string *string); #ifndef NULL diff --git a/ext/mbstring/mb_gpc.c b/ext/mbstring/mb_gpc.c index dfe96ccf13b08..2a87ecc2e7b6a 100644 --- a/ext/mbstring/mb_gpc.c +++ b/ext/mbstring/mb_gpc.c @@ -196,16 +196,16 @@ const mbfl_encoding *_php_mb_encoding_handler_ex(const php_mb_encoding_handler_i const char *s1, *s2; char *strtok_buf = NULL, **val_list = NULL; zval *array_ptr = (zval *) arg; - int n, num, *len_list = NULL; + size_t n, num, *len_list = NULL; size_t val_len, new_val_len; mbfl_string string, resvar, resval; const mbfl_encoding *from_encoding = NULL; mbfl_encoding_detector *identd = NULL; mbfl_buffer_converter *convd = NULL; - mbfl_string_init_set(&string, info->to_language, info->to_encoding->no_encoding); - mbfl_string_init_set(&resvar, info->to_language, info->to_encoding->no_encoding); - mbfl_string_init_set(&resval, info->to_language, info->to_encoding->no_encoding); + 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; @@ -225,7 +225,7 @@ const mbfl_encoding *_php_mb_encoding_handler_ex(const php_mb_encoding_handler_i num *= 2; /* need space for variable name and value */ val_list = (char **)ecalloc(num, sizeof(char *)); - len_list = (int *)ecalloc(num, sizeof(int)); + len_list = (size_t *)ecalloc(num, sizeof(size_t)); /* split and decode the query */ n = 0; @@ -253,7 +253,7 @@ const mbfl_encoding *_php_mb_encoding_handler_ex(const php_mb_encoding_handler_i var = php_strtok_r(NULL, info->separator, &strtok_buf); } - if (n > (PG(max_input_vars) * 2)) { + if (ZEND_SIZE_T_GT_ZEND_LONG(n, (PG(max_input_vars) * 2))) { php_error_docref(NULL, E_WARNING, "Input variables exceeded " ZEND_LONG_FMT ". To increase the limit change max_input_vars in php.ini.", PG(max_input_vars)); goto out; } @@ -268,7 +268,7 @@ const mbfl_encoding *_php_mb_encoding_handler_ex(const php_mb_encoding_handler_i } else { /* auto detect */ from_encoding = NULL; - identd = mbfl_encoding_detector_new2(info->from_encodings, info->num_from_encodings, MBSTRG(strict_detection)); + identd = mbfl_encoding_detector_new(info->from_encodings, info->num_from_encodings, MBSTRG(strict_detection)); if (identd != NULL) { n = 0; while (n < num) { @@ -279,7 +279,7 @@ const mbfl_encoding *_php_mb_encoding_handler_ex(const php_mb_encoding_handler_i } n++; } - from_encoding = mbfl_encoding_detector_judge2(identd); + from_encoding = mbfl_encoding_detector_judge(identd); mbfl_encoding_detector_delete(identd); } if (!from_encoding) { @@ -292,7 +292,7 @@ const mbfl_encoding *_php_mb_encoding_handler_ex(const php_mb_encoding_handler_i convd = NULL; if (from_encoding != &mbfl_encoding_pass) { - convd = mbfl_buffer_converter_new2(from_encoding, info->to_encoding, 0); + 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)); @@ -305,7 +305,7 @@ const mbfl_encoding *_php_mb_encoding_handler_ex(const php_mb_encoding_handler_i } /* convert encoding */ - string.no_encoding = from_encoding->no_encoding; + string.encoding = from_encoding; n = 0; while (n < num) { diff --git a/ext/mbstring/mbstring.c b/ext/mbstring/mbstring.c index d2e778bff53e5..0bb18e9b57410 100644 --- a/ext/mbstring/mbstring.c +++ b/ext/mbstring/mbstring.c @@ -61,7 +61,14 @@ #include "ext/standard/info.h" #include "libmbfl/mbfl/mbfl_allocators.h" +#include "libmbfl/mbfl/mbfilter_8bit.h" #include "libmbfl/mbfl/mbfilter_pass.h" +#include "libmbfl/mbfl/mbfilter_wchar.h" +#include "libmbfl/filters/mbfilter_ascii.h" +#include "libmbfl/filters/mbfilter_base64.h" +#include "libmbfl/filters/mbfilter_qprint.h" +#include "libmbfl/filters/mbfilter_ucs4.h" +#include "libmbfl/filters/mbfilter_utf8.h" #include "php_variables.h" #include "php_globals.h" @@ -647,17 +654,17 @@ static char *get_output_encoding(void) { /* {{{ allocators */ -static void *_php_mb_allocators_malloc(unsigned int sz) +static void *_php_mb_allocators_malloc(size_t sz) { return emalloc(sz); } -static void *_php_mb_allocators_realloc(void *ptr, unsigned int sz) +static void *_php_mb_allocators_realloc(void *ptr, size_t sz) { return erealloc(ptr, sz); } -static void *_php_mb_allocators_calloc(unsigned int nelems, unsigned int szelem) +static void *_php_mb_allocators_calloc(size_t nelems, size_t szelem) { return ecalloc(nelems, szelem); } @@ -667,12 +674,12 @@ static void _php_mb_allocators_free(void *ptr) efree(ptr); } -static void *_php_mb_allocators_pmalloc(unsigned int sz) +static void *_php_mb_allocators_pmalloc(size_t sz) { return pemalloc(sz, 1); } -static void *_php_mb_allocators_prealloc(void *ptr, unsigned int sz) +static void *_php_mb_allocators_prealloc(void *ptr, size_t sz) { return perealloc(ptr, sz, 1); } @@ -701,6 +708,31 @@ static sapi_post_entry mbstr_post_entries[] = { }; /* }}} */ +static const mbfl_encoding *php_mb_get_encoding(const char *encoding_name) { + if (encoding_name) { + const mbfl_encoding *encoding; + if (MBSTRG(last_used_encoding_name) + && !strcasecmp(encoding_name, MBSTRG(last_used_encoding_name))) { + return MBSTRG(last_used_encoding); + } + + encoding = mbfl_name2encoding(encoding_name); + if (!encoding) { + php_error_docref(NULL, E_WARNING, "Unknown encoding \"%s\"", encoding_name); + return NULL; + } + + if (MBSTRG(last_used_encoding_name)) { + efree(MBSTRG(last_used_encoding_name)); + } + MBSTRG(last_used_encoding_name) = estrdup(encoding_name); + MBSTRG(last_used_encoding) = encoding; + return encoding; + } else { + return MBSTRG(current_internal_encoding); + } +} + /* {{{ static int php_mb_parse_encoding_list() * Return 0 if input contains any illegal encoding, otherwise 1. * Even if any illegal encoding is detected the result may contain a list @@ -817,8 +849,9 @@ php_mb_parse_encoding_array(zval *array, const mbfl_encoding ***return_list, siz { zval *hash_entry; HashTable *target_hash; - int i, n, size, bauto, ret = SUCCESS; + int i, n, bauto, ret = SUCCESS; const mbfl_encoding **list, **entry; + size_t size; list = NULL; if (Z_TYPE_P(array) == IS_ARRAY) { @@ -912,28 +945,29 @@ static const zend_encoding *php_mb_zend_encoding_detector(const unsigned char *a string.no_language = MBSTRG(language); string.val = (unsigned char *)arg_string; string.len = arg_length; - return (const zend_encoding *) mbfl_identify_encoding2(&string, (const mbfl_encoding **)list, list_size, 0); + return (const zend_encoding *) mbfl_identify_encoding(&string, (const mbfl_encoding **)list, list_size, 0); } static size_t php_mb_zend_encoding_converter(unsigned char **to, size_t *to_length, const unsigned char *from, size_t from_length, const zend_encoding *encoding_to, const zend_encoding *encoding_from) { mbfl_string string, result; mbfl_buffer_converter *convd; - int status, loc; + int status; + size_t loc; /* new encoding */ /* initialize string */ mbfl_string_init(&string); mbfl_string_init(&result); - string.no_encoding = ((const mbfl_encoding*)encoding_from)->no_encoding; + string.encoding = (const mbfl_encoding*)encoding_from; string.no_language = MBSTRG(language); string.val = (unsigned char*)from; string.len = from_length; /* initialize converter */ - convd = mbfl_buffer_converter_new2((const mbfl_encoding *)encoding_from, (const mbfl_encoding *)encoding_to, string.len); + convd = mbfl_buffer_converter_new((const mbfl_encoding *)encoding_from, (const mbfl_encoding *)encoding_to, string.len); if (convd == NULL) { - return -1; + return (size_t) -1; } mbfl_buffer_converter_illegal_mode(convd, MBSTRG(current_filter_illegal_mode)); @@ -1081,11 +1115,11 @@ static int php_mb_nls_get_default_detect_order_list(enum mbfl_no_language lang, } /* }}} */ -static char *php_mb_rfc1867_substring_conf(const zend_encoding *encoding, char *start, int len, char quote) +static char *php_mb_rfc1867_substring_conf(const zend_encoding *encoding, char *start, size_t len, char quote) { char *result = emalloc(len + 2); char *resp = result; - int i; + size_t i; for (i = 0; i < len && start[i] != quote; ++i) { if (start[i] == '\\' && (start[i + 1] == '\\' || (quote && start[i + 1] == quote))) { @@ -1314,7 +1348,7 @@ static PHP_INI_MH(OnUpdate_mbstring_http_output) /* }}} */ /* {{{ static _php_mb_ini_mbstring_internal_encoding_set */ -int _php_mb_ini_mbstring_internal_encoding_set(const char *new_value, uint32_t new_value_length) +int _php_mb_ini_mbstring_internal_encoding_set(const char *new_value, size_t new_value_length) { const mbfl_encoding *encoding; @@ -1522,6 +1556,8 @@ ZEND_TSRMLS_CACHE_UPDATE(); #if HAVE_MBREGEX mbstring_globals->mb_regex_globals = php_mb_regex_globals_alloc(); #endif + mbstring_globals->last_used_encoding_name = NULL; + mbstring_globals->last_used_encoding = NULL; } /* }}} */ @@ -1568,6 +1604,11 @@ ZEND_TSRMLS_CACHE_UPDATE(); REGISTER_LONG_CONSTANT("MB_CASE_UPPER", PHP_UNICODE_CASE_UPPER, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("MB_CASE_LOWER", PHP_UNICODE_CASE_LOWER, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("MB_CASE_TITLE", PHP_UNICODE_CASE_TITLE, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("MB_CASE_FOLD", PHP_UNICODE_CASE_FOLD, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("MB_CASE_UPPER_SIMPLE", PHP_UNICODE_CASE_UPPER_SIMPLE, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("MB_CASE_LOWER_SIMPLE", PHP_UNICODE_CASE_LOWER_SIMPLE, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("MB_CASE_TITLE_SIMPLE", PHP_UNICODE_CASE_TITLE_SIMPLE, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("MB_CASE_FOLD_SIMPLE", PHP_UNICODE_CASE_FOLD_SIMPLE, CONST_CS | CONST_PERSISTENT); #if HAVE_MBREGEX PHP_MINIT(mb_regex) (INIT_FUNC_ARGS_PASSTHRU); @@ -1683,6 +1724,11 @@ PHP_RSHUTDOWN_FUNCTION(mbstring) MBSTRG(http_input_identify_cookie) = NULL; MBSTRG(http_input_identify_string) = NULL; + if (MBSTRG(last_used_encoding_name)) { + efree(MBSTRG(last_used_encoding_name)); + MBSTRG(last_used_encoding_name) = NULL; + } + /* clear overloaded function. */ if (MBSTRG(func_overload)){ p = &(mb_ovld[0]); @@ -1975,7 +2021,7 @@ PHP_FUNCTION(mb_detect_order) } /* }}} */ -static inline int php_mb_check_code_point(long cp) +static inline int php_mb_check_code_point(zend_long cp) { if (cp <= 0 || cp >= 0x110000) { /* Out of Unicode range */ @@ -2151,7 +2197,8 @@ PHP_FUNCTION(mb_output_handler) const char *charset; char *p; const mbfl_encoding *encoding; - int last_feed, len; + int last_feed; + size_t len; unsigned char send_text_mimetype = 0; char *s, *mimetype = NULL; @@ -2199,7 +2246,7 @@ PHP_FUNCTION(mb_output_handler) } } /* activate the converter */ - MBSTRG(outconv) = mbfl_buffer_converter_new2(MBSTRG(current_internal_encoding), encoding, 0); + MBSTRG(outconv) = mbfl_buffer_converter_new(MBSTRG(current_internal_encoding), encoding, 0); if (send_text_mimetype){ efree(mimetype); } @@ -2221,7 +2268,7 @@ PHP_FUNCTION(mb_output_handler) mbfl_string_init(&string); /* these are not needed. convd has encoding info. string.no_language = MBSTRG(language); - string.no_encoding = MBSTRG(current_internal_encoding)->no_encoding; + string.encoding = MBSTRG(current_internal_encoding); */ string.val = (unsigned char *)arg_string; string.len = arg_string_len; @@ -2248,37 +2295,29 @@ PHP_FUNCTION(mb_output_handler) Get character numbers of a string */ PHP_FUNCTION(mb_strlen) { - int n; + size_t n; mbfl_string string; - char *enc_name = NULL; - size_t enc_name_len, string_len; + char *str, *enc_name = NULL; + size_t str_len, enc_name_len; mbfl_string_init(&string); - if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|s", (char **)&string.val, &string_len, &enc_name, &enc_name_len) == FAILURE) { - return; - } - - if (ZEND_SIZE_T_UINT_OVFL(string_len)) { - php_error_docref(NULL, E_WARNING, "String overflows the max allowed length of %u", UINT_MAX); - return; - } - - string.len = (uint32_t)string_len; + ZEND_PARSE_PARAMETERS_START(1, 2) + Z_PARAM_STRING(str, str_len) + Z_PARAM_OPTIONAL + Z_PARAM_STRING(enc_name, enc_name_len) + ZEND_PARSE_PARAMETERS_END(); + string.val = (unsigned char *) str; + string.len = str_len; string.no_language = MBSTRG(language); - if (enc_name == NULL) { - string.no_encoding = MBSTRG(current_internal_encoding)->no_encoding; - } else { - string.no_encoding = mbfl_name2no_encoding(enc_name); - if (string.no_encoding == mbfl_no_encoding_invalid) { - php_error_docref(NULL, E_WARNING, "Unknown encoding \"%s\"", enc_name); - RETURN_FALSE; - } + string.encoding = php_mb_get_encoding(enc_name); + if (!string.encoding) { + RETURN_FALSE; } n = mbfl_strlen(&string); - if (n >= 0) { + if (!mbfl_is_error(n)) { RETVAL_LONG(n); } else { RETVAL_FALSE; @@ -2290,57 +2329,43 @@ PHP_FUNCTION(mb_strlen) Find position of first occurrence of a string within another */ PHP_FUNCTION(mb_strpos) { - int n, reverse = 0; - zend_long offset = 0, slen; + int reverse = 0; + zend_long offset = 0; mbfl_string haystack, needle; char *enc_name = NULL; - size_t enc_name_len, haystack_len, needle_len; + size_t enc_name_len, n; mbfl_string_init(&haystack); mbfl_string_init(&needle); - haystack.no_language = MBSTRG(language); - haystack.no_encoding = MBSTRG(current_internal_encoding)->no_encoding; - needle.no_language = MBSTRG(language); - needle.no_encoding = MBSTRG(current_internal_encoding)->no_encoding; - if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss|ls", (char **)&haystack.val, &haystack_len, (char **)&needle.val, &needle_len, &offset, &enc_name, &enc_name_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss|ls", (char **)&haystack.val, &haystack.len, (char **)&needle.val, &needle.len, &offset, &enc_name, &enc_name_len) == FAILURE) { return; } - if (ZEND_SIZE_T_UINT_OVFL(haystack_len)) { - php_error_docref(NULL, E_WARNING, "Haystack length overflows the max allowed length of %u", UINT_MAX); - return; - } else if (ZEND_SIZE_T_UINT_OVFL(needle_len)) { - php_error_docref(NULL, E_WARNING, "Needle length overflows the max allowed length of %u", UINT_MAX); - return; + haystack.no_language = needle.no_language = MBSTRG(language); + haystack.encoding = needle.encoding = php_mb_get_encoding(enc_name); + if (!haystack.encoding) { + RETURN_FALSE; } - haystack.len = (uint32_t)haystack_len; - needle.len = (uint32_t)needle_len; - - if (enc_name != NULL) { - haystack.no_encoding = needle.no_encoding = mbfl_name2no_encoding(enc_name); - if (haystack.no_encoding == mbfl_no_encoding_invalid) { - php_error_docref(NULL, E_WARNING, "Unknown encoding \"%s\"", enc_name); + if (offset != 0) { + size_t slen = mbfl_strlen(&haystack); + if (offset < 0) { + offset += slen; + } + if (offset < 0 || offset > slen) { + php_error_docref(NULL, E_WARNING, "Offset not contained in string"); RETURN_FALSE; } } - slen = mbfl_strlen(&haystack); - if (offset < 0) { - offset += slen; - } - if (offset < 0 || offset > slen) { - php_error_docref(NULL, E_WARNING, "Offset not contained in string"); - RETURN_FALSE; - } if (needle.len == 0) { php_error_docref(NULL, E_WARNING, "Empty delimiter"); RETURN_FALSE; } n = mbfl_strpos(&haystack, &needle, offset, reverse); - if (n >= 0) { + if (!mbfl_is_error(n)) { RETVAL_LONG(n); } else { switch (-n) { @@ -2368,37 +2393,27 @@ PHP_FUNCTION(mb_strpos) Find position of last occurrence of a string within another */ PHP_FUNCTION(mb_strrpos) { - int n; mbfl_string haystack, needle; char *enc_name = NULL; - size_t enc_name_len, haystack_len, needle_len; + size_t enc_name_len; zval *zoffset = NULL; - long offset = 0, str_flg; + zend_long offset = 0, str_flg, n; char *enc_name2 = NULL; - int enc_name_len2; + size_t enc_name_len2; mbfl_string_init(&haystack); mbfl_string_init(&needle); - haystack.no_language = MBSTRG(language); - haystack.no_encoding = MBSTRG(current_internal_encoding)->no_encoding; - needle.no_language = MBSTRG(language); - needle.no_encoding = MBSTRG(current_internal_encoding)->no_encoding; - if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss|zs", (char **)&haystack.val, &haystack_len, (char **)&needle.val, &needle_len, &zoffset, &enc_name, &enc_name_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss|zs", (char **)&haystack.val, &haystack.len, (char **)&needle.val, &needle.len, &zoffset, &enc_name, &enc_name_len) == FAILURE) { return; } - if (ZEND_SIZE_T_UINT_OVFL(haystack_len)) { - php_error_docref(NULL, E_WARNING, "Haystack length overflows the max allowed length of %u", UINT_MAX); - return; - } else if (ZEND_SIZE_T_UINT_OVFL(needle_len)) { - php_error_docref(NULL, E_WARNING, "Needle length overflows the max allowed length of %u", UINT_MAX); - return; + haystack.no_language = needle.no_language = MBSTRG(language); + haystack.encoding = needle.encoding = php_mb_get_encoding(enc_name); + if (!haystack.encoding) { + RETURN_FALSE; } - haystack.len = (uint32_t)haystack_len; - needle.len = (uint32_t)needle_len; - if (zoffset) { if (Z_TYPE_P(zoffset) == IS_STRING) { enc_name2 = Z_STRVAL_P(zoffset); @@ -2440,23 +2455,8 @@ PHP_FUNCTION(mb_strrpos) } } - if (enc_name != NULL) { - haystack.no_encoding = needle.no_encoding = mbfl_name2no_encoding(enc_name); - if (haystack.no_encoding == mbfl_no_encoding_invalid) { - php_error_docref(NULL, E_WARNING, "Unknown encoding \"%s\"", enc_name); - RETURN_FALSE; - } - } - - if (haystack.len <= 0) { - RETURN_FALSE; - } - if (needle.len <= 0) { - RETURN_FALSE; - } - - { - int haystack_char_len = mbfl_strlen(&haystack); + if (offset != 0) { + size_t haystack_char_len = mbfl_strlen(&haystack); if ((offset > 0 && offset > haystack_char_len) || (offset < 0 && -offset > haystack_char_len)) { php_error_docref(NULL, E_WARNING, "Offset is greater than the length of haystack string"); @@ -2465,7 +2465,7 @@ PHP_FUNCTION(mb_strrpos) } n = mbfl_strpos(&haystack, &needle, offset, 1); - if (n >= 0) { + if (!mbfl_is_error(n)) { RETVAL_LONG(n); } else { RETVAL_FALSE; @@ -2477,34 +2477,24 @@ PHP_FUNCTION(mb_strrpos) Finds position of first occurrence of a string within another, case insensitive */ PHP_FUNCTION(mb_stripos) { - int n = -1; + size_t n = (size_t) -1; zend_long offset = 0; mbfl_string haystack, needle; const char *from_encoding = MBSTRG(current_internal_encoding)->mime_name; - size_t from_encoding_len, haystack_len, needle_len; + size_t from_encoding_len; - if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss|ls", (char **)&haystack.val, &haystack_len, (char **)&needle.val, &needle_len, &offset, &from_encoding, &from_encoding_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss|ls", (char **)&haystack.val, &haystack.len, (char **)&needle.val, &needle.len, &offset, &from_encoding, &from_encoding_len) == FAILURE) { return; } - if (ZEND_SIZE_T_UINT_OVFL(haystack_len)) { - php_error_docref(NULL, E_WARNING, "Haystack length overflows the max allowed length of %u", UINT_MAX); - return; - } else if (ZEND_SIZE_T_UINT_OVFL(needle_len)) { - php_error_docref(NULL, E_WARNING, "Needle length overflows the max allowed length of %u", UINT_MAX); - return; - } - - haystack.len = (uint32_t)haystack_len; - needle.len = (uint32_t)needle_len; - if (needle.len == 0) { php_error_docref(NULL, E_WARNING, "Empty delimiter"); RETURN_FALSE; } + n = php_mb_stripos(0, (char *)haystack.val, haystack.len, (char *)needle.val, needle.len, offset, from_encoding); - if (n >= 0) { + if (!mbfl_is_error(n)) { RETVAL_LONG(n); } else { RETVAL_FALSE; @@ -2516,30 +2506,19 @@ PHP_FUNCTION(mb_stripos) Finds position of last occurrence of a string within another, case insensitive */ PHP_FUNCTION(mb_strripos) { - int n = -1; + size_t n = (size_t) -1; zend_long offset = 0; mbfl_string haystack, needle; const char *from_encoding = MBSTRG(current_internal_encoding)->mime_name; - size_t from_encoding_len, haystack_len, needle_len; + size_t from_encoding_len; - if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss|ls", (char **)&haystack.val, &haystack_len, (char **)&needle.val, &needle_len, &offset, &from_encoding, &from_encoding_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss|ls", (char **)&haystack.val, &haystack.len, (char **)&needle.val, &needle.len, &offset, &from_encoding, &from_encoding_len) == FAILURE) { return; } - if (ZEND_SIZE_T_UINT_OVFL(haystack_len)) { - php_error_docref(NULL, E_WARNING, "Haystack length overflows the max allowed length of %u", UINT_MAX); - return; - } else if (ZEND_SIZE_T_UINT_OVFL(needle_len)) { - php_error_docref(NULL, E_WARNING, "Needle length overflows the max allowed length of %u", UINT_MAX); - return; - } - - haystack.len = (uint32_t)haystack_len; - needle.len = (uint32_t)needle_len; - n = php_mb_stripos(1, (char *)haystack.val, haystack.len, (char *)needle.val, needle.len, offset, from_encoding); - if (n >= 0) { + if (!mbfl_is_error(n)) { RETVAL_LONG(n); } else { RETVAL_FALSE; @@ -2551,49 +2530,32 @@ PHP_FUNCTION(mb_strripos) Finds first occurrence of a string within another */ PHP_FUNCTION(mb_strstr) { - int n, len, mblen; + size_t n; mbfl_string haystack, needle, result, *ret = NULL; char *enc_name = NULL; - size_t enc_name_len, haystack_len, needle_len; + size_t enc_name_len; zend_bool part = 0; mbfl_string_init(&haystack); mbfl_string_init(&needle); - haystack.no_language = MBSTRG(language); - haystack.no_encoding = MBSTRG(current_internal_encoding)->no_encoding; - needle.no_language = MBSTRG(language); - needle.no_encoding = MBSTRG(current_internal_encoding)->no_encoding; - if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss|bs", (char **)&haystack.val, &haystack_len, (char **)&needle.val, &needle_len, &part, &enc_name, &enc_name_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss|bs", (char **)&haystack.val, &haystack.len, (char **)&needle.val, &needle.len, &part, &enc_name, &enc_name_len) == FAILURE) { return; } - if (ZEND_SIZE_T_UINT_OVFL(haystack_len)) { - php_error_docref(NULL, E_WARNING, "Haystack length overflows the max allowed length of %u", UINT_MAX); - return; - } else if (ZEND_SIZE_T_UINT_OVFL(needle_len)) { - php_error_docref(NULL, E_WARNING, "Needle length overflows the max allowed length of %u", UINT_MAX); - return; - } - - haystack.len = (uint32_t)haystack_len; - needle.len = (uint32_t)needle_len; - - if (enc_name != NULL) { - haystack.no_encoding = needle.no_encoding = mbfl_name2no_encoding(enc_name); - if (haystack.no_encoding == mbfl_no_encoding_invalid) { - php_error_docref(NULL, E_WARNING, "Unknown encoding \"%s\"", enc_name); - RETURN_FALSE; - } + haystack.no_language = needle.no_language = MBSTRG(language); + haystack.encoding = needle.encoding = php_mb_get_encoding(enc_name); + if (!haystack.encoding) { + RETURN_FALSE; } - if (needle.len <= 0) { + if (needle.len == 0) { php_error_docref(NULL, E_WARNING, "Empty delimiter"); RETURN_FALSE; } + n = mbfl_strpos(&haystack, &needle, 0, 0); - if (n >= 0) { - mblen = mbfl_strlen(&haystack); + if (!mbfl_is_error(n)) { if (part) { ret = mbfl_substr(&haystack, &result, 0, n); if (ret != NULL) { @@ -2604,8 +2566,7 @@ PHP_FUNCTION(mb_strstr) RETVAL_FALSE; } } else { - len = (mblen - n); - ret = mbfl_substr(&haystack, &result, n, len); + ret = mbfl_substr(&haystack, &result, n, MBFL_SUBSTR_UNTIL_END); if (ret != NULL) { // TODO: avoid reallocation ??? RETVAL_STRINGL((char *)ret->val, ret->len); @@ -2624,51 +2585,34 @@ PHP_FUNCTION(mb_strstr) Finds the last occurrence of a character in a string within another */ PHP_FUNCTION(mb_strrchr) { - int n, len, mblen; + size_t n; mbfl_string haystack, needle, result, *ret = NULL; char *enc_name = NULL; - size_t enc_name_len, haystack_len, needle_len; + size_t enc_name_len; zend_bool part = 0; mbfl_string_init(&haystack); mbfl_string_init(&needle); - haystack.no_language = MBSTRG(language); - haystack.no_encoding = MBSTRG(current_internal_encoding)->no_encoding; - needle.no_language = MBSTRG(language); - needle.no_encoding = MBSTRG(current_internal_encoding)->no_encoding; - if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss|bs", (char **)&haystack.val, &haystack_len, (char **)&needle.val, &needle_len, &part, &enc_name, &enc_name_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss|bs", (char **)&haystack.val, &haystack.len, (char **)&needle.val, &needle.len, &part, &enc_name, &enc_name_len) == FAILURE) { return; } - if (ZEND_SIZE_T_UINT_OVFL(haystack_len)) { - php_error_docref(NULL, E_WARNING, "Haystack length overflows the max allowed length of %u", UINT_MAX); - return; - } else if (ZEND_SIZE_T_UINT_OVFL(needle_len)) { - php_error_docref(NULL, E_WARNING, "Needle length overflows the max allowed length of %u", UINT_MAX); - return; - } - - haystack.len = (uint32_t)haystack_len; - needle.len = (uint32_t)needle_len; - - if (enc_name != NULL) { - haystack.no_encoding = needle.no_encoding = mbfl_name2no_encoding(enc_name); - if (haystack.no_encoding == mbfl_no_encoding_invalid) { - php_error_docref(NULL, E_WARNING, "Unknown encoding \"%s\"", enc_name); - RETURN_FALSE; - } + haystack.no_language = needle.no_language = MBSTRG(language); + haystack.encoding = needle.encoding = php_mb_get_encoding(enc_name); + if (!haystack.encoding) { + RETURN_FALSE; } - if (haystack.len <= 0) { + if (haystack.len == 0) { RETURN_FALSE; } - if (needle.len <= 0) { + if (needle.len == 0) { RETURN_FALSE; } + n = mbfl_strpos(&haystack, &needle, 0, 1); - if (n >= 0) { - mblen = mbfl_strlen(&haystack); + if (!mbfl_is_error(n)) { if (part) { ret = mbfl_substr(&haystack, &result, 0, n); if (ret != NULL) { @@ -2679,8 +2623,7 @@ PHP_FUNCTION(mb_strrchr) RETVAL_FALSE; } } else { - len = (mblen - n); - ret = mbfl_substr(&haystack, &result, n, len); + ret = mbfl_substr(&haystack, &result, n, MBFL_SUBSTR_UNTIL_END); if (ret != NULL) { // TODO: avoid reallocation ??? RETVAL_STRINGL((char *)ret->val, ret->len); @@ -2700,52 +2643,32 @@ PHP_FUNCTION(mb_strrchr) PHP_FUNCTION(mb_stristr) { zend_bool part = 0; - size_t from_encoding_len, len, mblen, haystack_len, needle_len; - int n; + size_t from_encoding_len, n; mbfl_string haystack, needle, result, *ret = NULL; - const char *from_encoding = MBSTRG(current_internal_encoding)->mime_name; + const char *from_encoding = NULL; mbfl_string_init(&haystack); mbfl_string_init(&needle); - haystack.no_language = MBSTRG(language); - haystack.no_encoding = MBSTRG(current_internal_encoding)->no_encoding; - needle.no_language = MBSTRG(language); - needle.no_encoding = MBSTRG(current_internal_encoding)->no_encoding; - - if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss|bs", (char **)&haystack.val, &haystack_len, (char **)&needle.val, &needle_len, &part, &from_encoding, &from_encoding_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss|bs", (char **)&haystack.val, &haystack.len, (char **)&needle.val, &needle.len, &part, &from_encoding, &from_encoding_len) == FAILURE) { return; } - if (ZEND_SIZE_T_UINT_OVFL(haystack_len)) { - php_error_docref(NULL, E_WARNING, "Haystack length overflows the max allowed length of %u", UINT_MAX); - return; - } else if (ZEND_SIZE_T_UINT_OVFL(needle_len)) { - php_error_docref(NULL, E_WARNING, "Needle length overflows the max allowed length of %u", UINT_MAX); - return; + haystack.no_language = needle.no_language = MBSTRG(language); + haystack.encoding = needle.encoding = php_mb_get_encoding(from_encoding); + if (!haystack.encoding) { + RETURN_FALSE; } - haystack.len = (uint32_t)haystack_len; - needle.len = (uint32_t)needle_len; - if (!needle.len) { php_error_docref(NULL, E_WARNING, "Empty delimiter"); RETURN_FALSE; } - haystack.no_encoding = needle.no_encoding = mbfl_name2no_encoding(from_encoding); - if (haystack.no_encoding == mbfl_no_encoding_invalid) { - php_error_docref(NULL, E_WARNING, "Unknown encoding \"%s\"", from_encoding); - RETURN_FALSE; - } - n = php_mb_stripos(0, (char *)haystack.val, haystack.len, (char *)needle.val, needle.len, 0, from_encoding); - - if (n <0) { + if (mbfl_is_error(n)) { RETURN_FALSE; } - mblen = mbfl_strlen(&haystack); - if (part) { ret = mbfl_substr(&haystack, &result, 0, n); if (ret != NULL) { @@ -2756,8 +2679,7 @@ PHP_FUNCTION(mb_stristr) RETVAL_FALSE; } } else { - len = (mblen - n); - ret = mbfl_substr(&haystack, &result, n, len); + ret = mbfl_substr(&haystack, &result, n, MBFL_SUBSTR_UNTIL_END); if (ret != NULL) { // TODO: avoid reallocaton ??? RETVAL_STRINGL((char *)ret->val, ret->len); @@ -2774,47 +2696,28 @@ PHP_FUNCTION(mb_stristr) PHP_FUNCTION(mb_strrichr) { zend_bool part = 0; - int n, len, mblen; - size_t from_encoding_len, haystack_len, needle_len; + size_t n; + size_t from_encoding_len; mbfl_string haystack, needle, result, *ret = NULL; - const char *from_encoding = MBSTRG(current_internal_encoding)->name; + const char *from_encoding = NULL; mbfl_string_init(&haystack); mbfl_string_init(&needle); - haystack.no_language = MBSTRG(language); - haystack.no_encoding = MBSTRG(current_internal_encoding)->no_encoding; - needle.no_language = MBSTRG(language); - needle.no_encoding = MBSTRG(current_internal_encoding)->no_encoding; - - if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss|bs", (char **)&haystack.val, &haystack_len, (char **)&needle.val, &needle_len, &part, &from_encoding, &from_encoding_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss|bs", (char **)&haystack.val, &haystack.len, (char **)&needle.val, &needle.len, &part, &from_encoding, &from_encoding_len) == FAILURE) { return; } - if (ZEND_SIZE_T_UINT_OVFL(haystack_len)) { - php_error_docref(NULL, E_WARNING, "Haystack length overflows the max allowed length of %u", UINT_MAX); - return; - } else if (ZEND_SIZE_T_UINT_OVFL(needle_len)) { - php_error_docref(NULL, E_WARNING, "Needle length overflows the max allowed length of %u", UINT_MAX); - return; - } - - haystack.len = (uint32_t)haystack_len; - needle.len = (uint32_t)needle_len; - - haystack.no_encoding = needle.no_encoding = mbfl_name2no_encoding(from_encoding); - if (haystack.no_encoding == mbfl_no_encoding_invalid) { - php_error_docref(NULL, E_WARNING, "Unknown encoding \"%s\"", from_encoding); + haystack.no_language = needle.no_language = MBSTRG(language); + haystack.encoding = needle.encoding = php_mb_get_encoding(from_encoding); + if (!haystack.encoding) { RETURN_FALSE; } n = php_mb_stripos(1, (char *)haystack.val, haystack.len, (char *)needle.val, needle.len, 0, from_encoding); - - if (n <0) { + if (mbfl_is_error(n)) { RETURN_FALSE; } - mblen = mbfl_strlen(&haystack); - if (part) { ret = mbfl_substr(&haystack, &result, 0, n); if (ret != NULL) { @@ -2825,8 +2728,7 @@ PHP_FUNCTION(mb_strrichr) RETVAL_FALSE; } } else { - len = (mblen - n); - ret = mbfl_substr(&haystack, &result, n, len); + ret = mbfl_substr(&haystack, &result, n, MBFL_SUBSTR_UNTIL_END); if (ret != NULL) { // TODO: avoid reallocation ??? RETVAL_STRINGL((char *)ret->val, ret->len); @@ -2842,48 +2744,31 @@ PHP_FUNCTION(mb_strrichr) Count the number of substring occurrences */ PHP_FUNCTION(mb_substr_count) { - int n; + size_t n; mbfl_string haystack, needle; char *enc_name = NULL; - size_t enc_name_len, haystack_len, needle_len; + size_t enc_name_len; mbfl_string_init(&haystack); mbfl_string_init(&needle); - haystack.no_language = MBSTRG(language); - haystack.no_encoding = MBSTRG(current_internal_encoding)->no_encoding; - needle.no_language = MBSTRG(language); - needle.no_encoding = MBSTRG(current_internal_encoding)->no_encoding; - if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss|s", (char **)&haystack.val, &haystack_len, (char **)&needle.val, &needle_len, &enc_name, &enc_name_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss|s", (char **)&haystack.val, &haystack.len, (char **)&needle.val, &needle.len, &enc_name, &enc_name_len) == FAILURE) { return; } - if (ZEND_SIZE_T_UINT_OVFL(haystack_len)) { - php_error_docref(NULL, E_WARNING, "Haystack length overflows the max allowed length of %u", UINT_MAX); - return; - } else if (ZEND_SIZE_T_UINT_OVFL(needle_len)) { - php_error_docref(NULL, E_WARNING, "Needle length overflows the max allowed length of %u", UINT_MAX); - return; - } - - haystack.len = (uint32_t)haystack_len; - needle.len = (uint32_t)needle_len; - - if (enc_name != NULL) { - haystack.no_encoding = needle.no_encoding = mbfl_name2no_encoding(enc_name); - if (haystack.no_encoding == mbfl_no_encoding_invalid) { - php_error_docref(NULL, E_WARNING, "Unknown encoding \"%s\"", enc_name); - RETURN_FALSE; - } + haystack.no_language = needle.no_language = MBSTRG(language); + haystack.encoding = needle.encoding = php_mb_get_encoding(enc_name); + if (!haystack.encoding) { + RETURN_FALSE; } - if (needle.len <= 0) { + if (needle.len == 0) { php_error_docref(NULL, E_WARNING, "Empty substring"); RETURN_FALSE; } n = mbfl_substr_count(&haystack, &needle); - if (n >= 0) { + if (!mbfl_is_error(n)) { RETVAL_LONG(n); } else { RETVAL_FALSE; @@ -2897,7 +2782,7 @@ PHP_FUNCTION(mb_substr) { char *str, *encoding = NULL; zend_long from, len; - int mblen; + size_t mblen, real_from, real_len; size_t str_len, encoding_len; zend_bool len_is_null = 1; mbfl_string string, result, *ret; @@ -2908,62 +2793,50 @@ PHP_FUNCTION(mb_substr) mbfl_string_init(&string); string.no_language = MBSTRG(language); - string.no_encoding = MBSTRG(current_internal_encoding)->no_encoding; - - if (encoding) { - string.no_encoding = mbfl_name2no_encoding(encoding); - if (string.no_encoding == mbfl_no_encoding_invalid) { - php_error_docref(NULL, E_WARNING, "Unknown encoding \"%s\"", encoding); - RETURN_FALSE; - } + string.encoding = php_mb_get_encoding(encoding); + if (!string.encoding) { + RETURN_FALSE; } string.val = (unsigned char *)str; string.len = str_len; - if (len_is_null) { - len = str_len; - } - /* measures length */ mblen = 0; - if (from < 0 || len < 0) { + if (from < 0 || (!len_is_null && len < 0)) { mblen = mbfl_strlen(&string); } /* if "from" position is negative, count start position from the end * of the string */ - if (from < 0) { - from = mblen + from; - if (from < 0) { - from = 0; - } + if (from >= 0) { + real_from = (size_t) from; + } else if (-from < mblen) { + real_from = mblen + from; + } else { + real_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 = (mblen - from) + len; - if (len < 0) { - len = 0; - } + if (len_is_null) { + real_len = MBFL_SUBSTR_UNTIL_END; + } else if (len >= 0) { + real_len = (size_t) len; + } else if (real_from < mblen && -len < mblen - real_from) { + real_len = (mblen - real_from) + len; + } else { + real_len = 0; } if (((MBSTRG(func_overload) & MB_OVERLOAD_STRING) == MB_OVERLOAD_STRING) - && (from >= mbfl_strlen(&string))) { + && (real_from >= mbfl_strlen(&string))) { RETURN_FALSE; } - if (from > INT_MAX) { - from = INT_MAX; - } - if (len > INT_MAX) { - len = INT_MAX; - } - - ret = mbfl_substr(&string, &result, from, len); + ret = mbfl_substr(&string, &result, real_from, real_len); if (NULL == ret) { RETURN_FALSE; } @@ -2980,31 +2853,20 @@ PHP_FUNCTION(mb_strcut) { char *encoding = NULL; zend_long from, len; - size_t encoding_len, string_len; + size_t encoding_len; zend_bool len_is_null = 1; mbfl_string string, result, *ret; mbfl_string_init(&string); - string.no_language = MBSTRG(language); - string.no_encoding = MBSTRG(current_internal_encoding)->no_encoding; - if (zend_parse_parameters(ZEND_NUM_ARGS(), "sl|l!s", (char **)&string.val, &string_len, &from, &len, &len_is_null, &encoding, &encoding_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS(), "sl|l!s", (char **)&string.val, &string.len, &from, &len, &len_is_null, &encoding, &encoding_len) == FAILURE) { return; } - if (ZEND_SIZE_T_UINT_OVFL(string_len)) { - php_error_docref(NULL, E_WARNING, "String length overflows the max allowed length of %u", UINT_MAX); - return; - } - - string.len = (uint32_t)string_len; - - if (encoding) { - string.no_encoding = mbfl_name2no_encoding(encoding); - if (string.no_encoding == mbfl_no_encoding_invalid) { - php_error_docref(NULL, E_WARNING, "Unknown encoding \"%s\"", encoding); - RETURN_FALSE; - } + string.no_language = MBSTRG(language); + string.encoding = php_mb_get_encoding(encoding); + if (!string.encoding) { + RETURN_FALSE; } if (len_is_null) { @@ -3031,7 +2893,7 @@ PHP_FUNCTION(mb_strcut) } } - if ((unsigned int)from > string.len) { + if (from > string.len) { RETURN_FALSE; } @@ -3050,37 +2912,25 @@ PHP_FUNCTION(mb_strcut) Gets terminal width of a string */ PHP_FUNCTION(mb_strwidth) { - int n; + size_t n; mbfl_string string; char *enc_name = NULL; - size_t enc_name_len, string_len; + size_t enc_name_len; mbfl_string_init(&string); - string.no_language = MBSTRG(language); - string.no_encoding = MBSTRG(current_internal_encoding)->no_encoding; - - if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|s", (char **)&string.val, &string_len, &enc_name, &enc_name_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|s", (char **)&string.val, &string.len, &enc_name, &enc_name_len) == FAILURE) { return; } - if (ZEND_SIZE_T_UINT_OVFL(string_len)) { - php_error_docref(NULL, E_WARNING, "String length overflows the max allowed length of %u", UINT_MAX); - return; - } - - string.len = (uint32_t)string_len; - - if (enc_name != NULL) { - string.no_encoding = mbfl_name2no_encoding(enc_name); - if (string.no_encoding == mbfl_no_encoding_invalid) { - php_error_docref(NULL, E_WARNING, "Unknown encoding \"%s\"", enc_name); - RETURN_FALSE; - } + string.no_language = MBSTRG(language); + string.encoding = php_mb_get_encoding(enc_name); + if (!string.encoding) { + RETURN_FALSE; } n = mbfl_strwidth(&string); - if (n >= 0) { + if (!mbfl_is_error(n)) { RETVAL_LONG(n); } else { RETVAL_FALSE; @@ -3103,23 +2953,17 @@ PHP_FUNCTION(mb_strimwidth) mbfl_string_init(&string); mbfl_string_init(&marker); - string.no_language = MBSTRG(language); - string.no_encoding = MBSTRG(current_internal_encoding)->no_encoding; - marker.no_language = MBSTRG(language); - marker.no_encoding = MBSTRG(current_internal_encoding)->no_encoding; - marker.val = NULL; - marker.len = 0; - if (encoding) { - string.no_encoding = marker.no_encoding = mbfl_name2no_encoding(encoding); - if (string.no_encoding == mbfl_no_encoding_invalid) { - php_error_docref(NULL, E_WARNING, "Unknown encoding \"%s\"", encoding); - RETURN_FALSE; - } + string.no_language = marker.no_language = MBSTRG(language); + string.encoding = marker.encoding = php_mb_get_encoding(encoding); + if (!string.encoding) { + RETURN_FALSE; } string.val = (unsigned char *)str; string.len = str_len; + marker.val = NULL; + marker.len = 0; if ((from < 0) || (width < 0)) { swidth = mbfl_strwidth(&string); @@ -3176,16 +3020,53 @@ static inline zend_bool php_mb_is_no_encoding_utf8(enum mbfl_no_encoding no_enc) return (no_enc >= mbfl_no_encoding_utf8 && no_enc <= mbfl_no_encoding_utf8_sb); } +MBSTRING_API char *php_mb_convert_encoding_ex(const char *input, size_t length, const mbfl_encoding *to_encoding, const mbfl_encoding *from_encoding, size_t *output_len) +{ + mbfl_string string, result, *ret; + mbfl_buffer_converter *convd; + char *output = NULL; + + if (output_len) { + *output_len = 0; + } + + /* initialize string */ + mbfl_string_init(&string); + mbfl_string_init(&result); + string.encoding = from_encoding; + string.no_language = MBSTRG(language); + string.val = (unsigned char *)input; + string.len = length; + + /* initialize converter */ + convd = mbfl_buffer_converter_new(from_encoding, to_encoding, string.len); + if (convd == NULL) { + php_error_docref(NULL, E_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; +} +/* }}} */ /* {{{ MBSTRING_API char *php_mb_convert_encoding() */ MBSTRING_API char *php_mb_convert_encoding(const char *input, size_t length, const char *_to_encoding, const char *_from_encodings, size_t *output_len) { - mbfl_string string, result, *ret; const mbfl_encoding *from_encoding, *to_encoding; - mbfl_buffer_converter *convd; - size_t size; - const mbfl_encoding **list; - char *output=NULL; if (output_len) { *output_len = 0; @@ -3204,33 +3085,24 @@ MBSTRING_API char *php_mb_convert_encoding(const char *input, size_t length, con 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->no_encoding; - string.no_language = MBSTRG(language); - string.val = (unsigned char *)input; - string.len = length; - /* pre-conversion encoding */ + from_encoding = MBSTRG(current_internal_encoding); if (_from_encodings) { - list = NULL; - size = 0; + const mbfl_encoding **list = NULL; + size_t 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->no_encoding; } else if (size > 1) { /* auto detect */ - from_encoding = mbfl_identify_encoding2(&string, list, size, MBSTRG(strict_detection)); - if (from_encoding) { - string.no_encoding = from_encoding->no_encoding; - } else { + mbfl_string string; + mbfl_string_init(&string); + string.val = (unsigned char *)input; + string.len = length; + from_encoding = mbfl_identify_encoding(&string, list, size, MBSTRG(strict_detection)); + if (!from_encoding) { php_error_docref(NULL, E_WARNING, "Unable to detect character encoding"); from_encoding = &mbfl_encoding_pass; - to_encoding = from_encoding; - string.no_encoding = from_encoding->no_encoding; } } else { php_error_docref(NULL, E_WARNING, "Illegal character encoding specified"); @@ -3240,28 +3112,7 @@ MBSTRING_API char *php_mb_convert_encoding(const char *input, size_t length, con } } - /* initialize converter */ - convd = mbfl_buffer_converter_new2(from_encoding, to_encoding, string.len); - if (convd == NULL) { - php_error_docref(NULL, E_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; + return php_mb_convert_encoding_ex(input, length, to_encoding, from_encoding, output_len); } /* }}} */ @@ -3283,8 +3134,7 @@ MBSTRING_API HashTable *php_mb_convert_encoding_recursive(HashTable *input, cons php_error_docref(NULL, E_WARNING, "Cannot convert recursively referenced values"); return NULL; } - output = (HashTable *)emalloc(sizeof(HashTable)); - zend_hash_init(output, zend_hash_num_elements(input), NULL, ZVAL_PTR_DTOR, 0); + output = zend_new_array(zend_hash_num_elements(input)); ZEND_HASH_FOREACH_KEY_VAL(input, idx, key, entry) { /* convert key */ if (key) { @@ -3309,8 +3159,7 @@ MBSTRING_API HashTable *php_mb_convert_encoding_recursive(HashTable *input, cons case IS_ARRAY: chash = php_mb_convert_encoding_recursive(HASH_OF(entry), _to_encoding, _from_encodings); if (!chash) { - chash = (HashTable *)emalloc(sizeof(HashTable)); - zend_hash_init(chash, 0, NULL, ZVAL_PTR_DTOR, 0); + chash = zend_new_array(0); } ZVAL_ARR(&entry_tmp, chash); break; @@ -3418,12 +3267,13 @@ PHP_FUNCTION(mb_convert_encoding) Returns a case-folded version of sourcestring */ PHP_FUNCTION(mb_convert_case) { - const char *from_encoding = MBSTRG(current_internal_encoding)->mime_name; + const char *from_encoding = NULL; char *str; size_t str_len, from_encoding_len; zend_long case_mode = 0; char *newstr; size_t ret_len; + const mbfl_encoding *enc; RETVAL_FALSE; if (zend_parse_parameters(ZEND_NUM_ARGS(), "sl|s!", &str, &str_len, @@ -3431,7 +3281,17 @@ PHP_FUNCTION(mb_convert_case) return; } - newstr = php_unicode_convert_case(case_mode, str, (size_t) str_len, &ret_len, from_encoding); + enc = php_mb_get_encoding(from_encoding); + if (!enc) { + return; + } + + if (case_mode < 0 || case_mode > PHP_UNICODE_CASE_MODE_MAX) { + php_error_docref(NULL, E_WARNING, "Invalid case mode"); + return; + } + + newstr = php_unicode_convert_case(case_mode, str, str_len, &ret_len, enc); if (newstr) { // TODO: avoid reallocation ??? @@ -3446,17 +3306,24 @@ PHP_FUNCTION(mb_convert_case) */ PHP_FUNCTION(mb_strtoupper) { - const char *from_encoding = MBSTRG(current_internal_encoding)->mime_name; + const char *from_encoding = NULL; char *str; size_t str_len, from_encoding_len; char *newstr; size_t ret_len; + const mbfl_encoding *enc; if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|s!", &str, &str_len, &from_encoding, &from_encoding_len) == FAILURE) { return; } - newstr = php_unicode_convert_case(PHP_UNICODE_CASE_UPPER, str, (size_t) str_len, &ret_len, from_encoding); + + enc = php_mb_get_encoding(from_encoding); + if (!enc) { + RETURN_FALSE; + } + + newstr = php_unicode_convert_case(PHP_UNICODE_CASE_UPPER, str, str_len, &ret_len, enc); if (newstr) { // TODO: avoid reallocation ??? @@ -3473,17 +3340,24 @@ PHP_FUNCTION(mb_strtoupper) */ PHP_FUNCTION(mb_strtolower) { - const char *from_encoding = MBSTRG(current_internal_encoding)->mime_name; + const char *from_encoding = NULL; char *str; size_t str_len, from_encoding_len; char *newstr; size_t ret_len; + const mbfl_encoding *enc; if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|s!", &str, &str_len, &from_encoding, &from_encoding_len) == FAILURE) { return; } - newstr = php_unicode_convert_case(PHP_UNICODE_CASE_LOWER, str, (size_t) str_len, &ret_len, from_encoding); + + enc = php_mb_get_encoding(from_encoding); + if (!enc) { + RETURN_FALSE; + } + + newstr = php_unicode_convert_case(PHP_UNICODE_CASE_LOWER, str, str_len, &ret_len, enc); if (newstr) { // TODO: avoid reallocation ??? @@ -3544,7 +3418,7 @@ PHP_FUNCTION(mb_detect_encoding) } if (ZEND_NUM_ARGS() < 3) { - strict = (zend_bool)MBSTRG(strict_detection); + strict = MBSTRG(strict_detection); } if (size > 0 && list != NULL) { @@ -3558,7 +3432,7 @@ PHP_FUNCTION(mb_detect_encoding) string.no_language = MBSTRG(language); string.val = (unsigned char *)str; string.len = str_len; - ret = mbfl_identify_encoding2(&string, elist, size, strict); + ret = mbfl_identify_encoding(&string, elist, size, strict); if (list != NULL) { efree((void *)list); @@ -3625,53 +3499,46 @@ PHP_FUNCTION(mb_encoding_aliases) Converts the string to MIME "encoded-word" in the format of =?charset?(B|Q)?encoded_string?= */ PHP_FUNCTION(mb_encode_mimeheader) { - enum mbfl_no_encoding charset, transenc; + const mbfl_encoding *charset, *transenc; mbfl_string string, result, *ret; char *charset_name = NULL; size_t charset_name_len; char *trans_enc_name = NULL; size_t trans_enc_name_len; char *linefeed = "\r\n"; - size_t linefeed_len, string_len; + size_t linefeed_len; zend_long indent = 0; mbfl_string_init(&string); string.no_language = MBSTRG(language); - string.no_encoding = MBSTRG(current_internal_encoding)->no_encoding; + string.encoding = MBSTRG(current_internal_encoding); - if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|sssl", (char **)&string.val, &string_len, &charset_name, &charset_name_len, &trans_enc_name, &trans_enc_name_len, &linefeed, &linefeed_len, &indent) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|sssl", (char **)&string.val, &string.len, &charset_name, &charset_name_len, &trans_enc_name, &trans_enc_name_len, &linefeed, &linefeed_len, &indent) == FAILURE) { return; } - if (ZEND_SIZE_T_UINT_OVFL(string_len)) { - php_error_docref(NULL, E_WARNING, "String length overflows the max allowed length of %u", UINT_MAX); - return; - } - - string.len = (uint32_t)string_len; - - charset = mbfl_no_encoding_pass; - transenc = mbfl_no_encoding_base64; + charset = &mbfl_encoding_pass; + transenc = &mbfl_encoding_base64; if (charset_name != NULL) { - charset = mbfl_name2no_encoding(charset_name); - if (charset == mbfl_no_encoding_invalid) { + charset = mbfl_name2encoding(charset_name); + if (!charset) { php_error_docref(NULL, E_WARNING, "Unknown encoding \"%s\"", charset_name); RETURN_FALSE; } } else { const mbfl_language *lang = mbfl_no2language(MBSTRG(language)); if (lang != NULL) { - charset = lang->mail_charset; - transenc = lang->mail_header_encoding; + charset = mbfl_no2encoding(lang->mail_charset); + transenc = mbfl_no2encoding(lang->mail_header_encoding); } } if (trans_enc_name != NULL) { if (*trans_enc_name == 'B' || *trans_enc_name == 'b') { - transenc = mbfl_no_encoding_base64; + transenc = &mbfl_encoding_base64; } else if (*trans_enc_name == 'Q' || *trans_enc_name == 'q') { - transenc = mbfl_no_encoding_qprint; + transenc = &mbfl_encoding_qprint; } } @@ -3692,25 +3559,17 @@ PHP_FUNCTION(mb_encode_mimeheader) PHP_FUNCTION(mb_decode_mimeheader) { mbfl_string string, result, *ret; - size_t string_len; mbfl_string_init(&string); string.no_language = MBSTRG(language); - string.no_encoding = MBSTRG(current_internal_encoding)->no_encoding; + string.encoding = MBSTRG(current_internal_encoding); - if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", (char **)&string.val, &string_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", (char **)&string.val, &string.len) == FAILURE) { return; } - if (ZEND_SIZE_T_UINT_OVFL(string_len)) { - php_error_docref(NULL, E_WARNING, "String length overflows the max allowed length of %u", UINT_MAX); - return; - } - - string.len = (uint32_t)string_len; - mbfl_string_init(&result); - ret = mbfl_mime_header_decode(&string, &result, MBSTRG(current_internal_encoding)->no_encoding); + ret = mbfl_mime_header_decode(&string, &result, MBSTRG(current_internal_encoding)); if (ret != NULL) { // TODO: avoid reallocation ??? RETVAL_STRINGL((char *)ret->val, ret->len); /* the string is already strdup()'ed */ @@ -3725,33 +3584,23 @@ PHP_FUNCTION(mb_decode_mimeheader) Conversion between full-width character and half-width character (Japanese) */ PHP_FUNCTION(mb_convert_kana) { - int opt, i; + int opt; mbfl_string string, result, *ret; char *optstr = NULL; size_t optstr_len; char *encname = NULL; - size_t encname_len, string_len; + size_t encname_len; mbfl_string_init(&string); - string.no_language = MBSTRG(language); - string.no_encoding = MBSTRG(current_internal_encoding)->no_encoding; - if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|ss", (char **)&string.val, &string_len, &optstr, &optstr_len, &encname, &encname_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|ss", (char **)&string.val, &string.len, &optstr, &optstr_len, &encname, &encname_len) == FAILURE) { return; } - if (ZEND_SIZE_T_UINT_OVFL(string_len)) { - php_error_docref(NULL, E_WARNING, "String length overflows the max allowed length of %u", UINT_MAX); - return; - } - - string.len = (uint32_t)string_len; - /* option */ if (optstr != NULL) { char *p = optstr; - int n = optstr_len; - i = 0; + size_t i = 0, n = optstr_len; opt = 0; while (i < n) { i++; @@ -3814,12 +3663,10 @@ PHP_FUNCTION(mb_convert_kana) } /* encoding */ - if (encname != NULL) { - string.no_encoding = mbfl_name2no_encoding(encname); - if (string.no_encoding == mbfl_no_encoding_invalid) { - php_error_docref(NULL, E_WARNING, "Unknown encoding \"%s\"", encname); - RETURN_FALSE; - } + string.no_language = MBSTRG(language); + string.encoding = php_mb_get_encoding(encname); + if (!string.encoding) { + RETURN_FALSE; } ret = mbfl_ja_jp_hantozen(&string, &result, opt); @@ -3868,7 +3715,7 @@ PHP_FUNCTION(mb_convert_variables) mbfl_string_init(&string); mbfl_string_init(&result); from_encoding = MBSTRG(current_internal_encoding); - string.no_encoding = from_encoding->no_encoding; + string.encoding = from_encoding; string.no_language = MBSTRG(language); /* pre-conversion encoding */ @@ -3894,7 +3741,7 @@ PHP_FUNCTION(mb_convert_variables) stack_max = PHP_MBSTR_STACK_BLOCK_SIZE; stack = (zval *)safe_emalloc(stack_max, sizeof(zval), 0); stack_level = 0; - identd = mbfl_encoding_detector_new2(elist, elistsz, MBSTRG(strict_detection)); + identd = mbfl_encoding_detector_new(elist, elistsz, MBSTRG(strict_detection)); if (identd != NULL) { n = 0; while (n < argc || stack_level > 0) { @@ -3960,7 +3807,7 @@ PHP_FUNCTION(mb_convert_variables) } } detect_end: - from_encoding = mbfl_encoding_detector_judge2(identd); + from_encoding = mbfl_encoding_detector_judge(identd); mbfl_encoding_detector_delete(identd); } if (recursion_error) { @@ -3991,7 +3838,7 @@ PHP_FUNCTION(mb_convert_variables) /* create converter */ convd = NULL; if (from_encoding != &mbfl_encoding_pass) { - convd = mbfl_buffer_converter_new2(from_encoding, to_encoding, 0); + convd = mbfl_buffer_converter_new(from_encoding, to_encoding, 0); if (convd == NULL) { php_error_docref(NULL, E_WARNING, "Unable to create converter"); RETURN_FALSE; @@ -4118,7 +3965,6 @@ php_mb_numericentity_exec(INTERNAL_FUNCTION_PARAMETERS, int type) int i, *convmap, *mapelm, mapsize=0; zend_bool is_hex = 0; mbfl_string string, result, *ret; - enum mbfl_no_encoding no_encoding; if (zend_parse_parameters(ZEND_NUM_ARGS(), "sz|sb", &str, &str_len, &zconvmap, &encoding, &encoding_len, &is_hex) == FAILURE) { return; @@ -4126,18 +3972,16 @@ php_mb_numericentity_exec(INTERNAL_FUNCTION_PARAMETERS, int type) mbfl_string_init(&string); string.no_language = MBSTRG(language); - string.no_encoding = MBSTRG(current_internal_encoding)->no_encoding; + string.encoding = MBSTRG(current_internal_encoding); string.val = (unsigned char *)str; string.len = str_len; /* encoding */ if (encoding && encoding_len > 0) { - no_encoding = mbfl_name2no_encoding(encoding); - if (no_encoding == mbfl_no_encoding_invalid) { + string.encoding = mbfl_name2encoding(encoding); + if (!string.encoding) { php_error_docref(NULL, E_WARNING, "Unknown encoding \"%s\"", encoding); RETURN_FALSE; - } else { - string.no_encoding = no_encoding; } } @@ -4383,17 +4227,16 @@ static int _php_mbstr_parse_mail_headers(HashTable *ht, const char *str, size_t PHP_FUNCTION(mb_send_mail) { - int n; - char *to = NULL; + char *to; size_t to_len; - char *message = NULL; + char *message; size_t message_len; - char *subject = NULL; + char *subject; size_t subject_len; zval *headers = NULL; zend_string *extra_cmd = NULL; - zend_string *str_headers=NULL, *tmp_headers; - int i; + zend_string *str_headers = NULL, *tmp_headers; + size_t n, i; char *to_r = NULL; char *force_extra_parameters = INI_STR("mail.force_extra_parameters"); struct { @@ -4404,10 +4247,10 @@ PHP_FUNCTION(mb_send_mail) char *message_buf = NULL, *subject_buf = NULL, *p; mbfl_string orig_str, conv_str; mbfl_string *pstr; /* pointer to mbfl string for return value */ - enum mbfl_no_encoding - tran_cs, /* transfar text charset */ - head_enc, /* header transfar encoding */ - body_enc; /* body transfar encoding */ + enum mbfl_no_encoding; + const mbfl_encoding *tran_cs, /* transfar text charset */ + *head_enc, /* header transfar encoding */ + *body_enc; /* body transfar encoding */ mbfl_memory_device device; /* automatic allocateable buffer for additional header */ const mbfl_language *lang; int err = 0; @@ -4422,14 +4265,14 @@ PHP_FUNCTION(mb_send_mail) mbfl_string_init(&conv_str); /* character-set, transfer-encoding */ - tran_cs = mbfl_no_encoding_utf8; - head_enc = mbfl_no_encoding_base64; - body_enc = mbfl_no_encoding_base64; + tran_cs = &mbfl_encoding_utf8; + head_enc = &mbfl_encoding_base64; + body_enc = &mbfl_encoding_base64; lang = mbfl_no2language(MBSTRG(language)); if (lang != NULL) { - tran_cs = lang->mail_charset; - head_enc = lang->mail_header_encoding; - body_enc = lang->mail_body_encoding; + tran_cs = mbfl_no2encoding(lang->mail_charset); + head_enc = mbfl_no2encoding(lang->mail_header_encoding); + body_enc = mbfl_no2encoding(lang->mail_body_encoding); } if (zend_parse_parameters(ZEND_NUM_ARGS(), "sss|zS", &to, &to_len, &subject, &subject_len, &message, &message_len, &headers, &extra_cmd) == FAILURE) { @@ -4483,16 +4326,16 @@ PHP_FUNCTION(mb_send_mail) if (*p != '\0') { if ((param_name = php_strtok_r(p, "= ", &tmp)) != NULL) { if (strcasecmp(param_name, "charset") == 0) { - enum mbfl_no_encoding _tran_cs = tran_cs; + const mbfl_encoding *_tran_cs = tran_cs; charset = php_strtok_r(NULL, "= \"", &tmp); if (charset != NULL) { - _tran_cs = mbfl_name2no_encoding(charset); + _tran_cs = mbfl_name2encoding(charset); } - if (_tran_cs == mbfl_no_encoding_invalid) { + if (!_tran_cs) { php_error_docref(NULL, E_WARNING, "Unsupported charset \"%s\" - will be regarded as ascii", charset); - _tran_cs = mbfl_no_encoding_ascii; + _tran_cs = &mbfl_encoding_ascii; } tran_cs = _tran_cs; } @@ -4503,11 +4346,11 @@ PHP_FUNCTION(mb_send_mail) } if ((s = zend_hash_str_find(&ht_headers, "CONTENT-TRANSFER-ENCODING", sizeof("CONTENT-TRANSFER-ENCODING") - 1))) { - enum mbfl_no_encoding _body_enc; + const mbfl_encoding *_body_enc; ZEND_ASSERT(Z_TYPE_P(s) == IS_STRING); - _body_enc = mbfl_name2no_encoding(Z_STRVAL_P(s)); - switch (_body_enc) { + _body_enc = mbfl_name2encoding(Z_STRVAL_P(s)); + switch (_body_enc ? _body_enc->no_encoding : mbfl_no_encoding_invalid) { case mbfl_no_encoding_base64: case mbfl_no_encoding_7bit: case mbfl_no_encoding_8bit: @@ -4516,89 +4359,73 @@ PHP_FUNCTION(mb_send_mail) default: php_error_docref(NULL, E_WARNING, "Unsupported transfer encoding \"%s\" - will be regarded as 8bit", Z_STRVAL_P(s)); - body_enc = mbfl_no_encoding_8bit; + body_enc = &mbfl_encoding_8bit; break; } suppressed_hdrs.cnt_trans_enc = 1; } /* To: */ - if (to != NULL) { - if (to_len > 0) { - to_r = estrndup(to, to_len); - for (; to_len; to_len--) { - if (!isspace((unsigned char) to_r[to_len - 1])) { - break; - } - to_r[to_len - 1] = '\0'; - } - for (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] = ' '; - } + if (to_len > 0) { + to_r = estrndup(to, to_len); + for (; to_len; to_len--) { + if (!isspace((unsigned char) to_r[to_len - 1])) { + break; } - } else { - to_r = to; + to_r[to_len - 1] = '\0'; + } + for (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 { - php_error_docref(NULL, E_WARNING, "Missing To: field"); - err = 1; + to_r = to; } /* Subject: */ - if (subject != NULL) { - orig_str.no_language = MBSTRG(language); - orig_str.val = (unsigned char *)subject; - orig_str.len = subject_len; - orig_str.no_encoding = MBSTRG(current_internal_encoding)->no_encoding; - if (orig_str.no_encoding == mbfl_no_encoding_invalid || orig_str.no_encoding == mbfl_no_encoding_pass) { - const mbfl_encoding *encoding = mbfl_identify_encoding2(&orig_str, MBSTRG(current_detect_order_list), MBSTRG(current_detect_order_list_size), MBSTRG(strict_detection)); - orig_str.no_encoding = encoding ? encoding->no_encoding: mbfl_no_encoding_invalid; - } - pstr = mbfl_mime_header_encode(&orig_str, &conv_str, tran_cs, head_enc, "\n", sizeof("Subject: [PHP-jp nnnnnnnn]")); - if (pstr != NULL) { - subject_buf = subject = (char *)pstr->val; - } - } else { - php_error_docref(NULL, E_WARNING, "Missing Subject: field"); - err = 1; + orig_str.no_language = MBSTRG(language); + orig_str.val = (unsigned char *)subject; + orig_str.len = subject_len; + orig_str.encoding = MBSTRG(current_internal_encoding); + if (orig_str.encoding->no_encoding == mbfl_no_encoding_invalid + || orig_str.encoding->no_encoding == mbfl_no_encoding_pass) { + orig_str.encoding = mbfl_identify_encoding(&orig_str, MBSTRG(current_detect_order_list), MBSTRG(current_detect_order_list_size), MBSTRG(strict_detection)); + } + pstr = mbfl_mime_header_encode(&orig_str, &conv_str, tran_cs, head_enc, "\n", sizeof("Subject: [PHP-jp nnnnnnnn]")); + if (pstr != NULL) { + subject_buf = subject = (char *)pstr->val; } /* message body */ - if (message != NULL) { - orig_str.no_language = MBSTRG(language); - orig_str.val = (unsigned char *)message; - orig_str.len = (unsigned int)message_len; - orig_str.no_encoding = MBSTRG(current_internal_encoding)->no_encoding; + orig_str.no_language = MBSTRG(language); + orig_str.val = (unsigned char *)message; + orig_str.len = message_len; + orig_str.encoding = MBSTRG(current_internal_encoding); - if (orig_str.no_encoding == mbfl_no_encoding_invalid || orig_str.no_encoding == mbfl_no_encoding_pass) { - const mbfl_encoding *encoding = mbfl_identify_encoding2(&orig_str, MBSTRG(current_detect_order_list), MBSTRG(current_detect_order_list_size), MBSTRG(strict_detection)); - orig_str.no_encoding = encoding ? encoding->no_encoding: mbfl_no_encoding_invalid; - } + if (orig_str.encoding->no_encoding == mbfl_no_encoding_invalid + || orig_str.encoding->no_encoding == mbfl_no_encoding_pass) { + orig_str.encoding = mbfl_identify_encoding(&orig_str, MBSTRG(current_detect_order_list), MBSTRG(current_detect_order_list_size), MBSTRG(strict_detection)); + } - pstr = NULL; - { - mbfl_string tmpstr; + 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); - efree(tmpstr.val); - } - } - if (pstr != NULL) { - message_buf = message = (char *)pstr->val; + if (mbfl_convert_encoding(&orig_str, &tmpstr, tran_cs) != NULL) { + tmpstr.encoding = &mbfl_encoding_8bit; + pstr = mbfl_convert_encoding(&tmpstr, &conv_str, body_enc); + efree(tmpstr.val); } - } else { - /* this is not really an error, so it is allowed. */ - php_error_docref(NULL, E_WARNING, "Empty message body"); - message = NULL; + } + if (pstr != NULL) { + message_buf = message = (char *)pstr->val; } /* other headers */ @@ -4624,7 +4451,7 @@ PHP_FUNCTION(mb_send_mail) if (!suppressed_hdrs.cnt_type) { mbfl_memory_device_strncat(&device, PHP_MBSTR_MAIL_MIME_HEADER2, sizeof(PHP_MBSTR_MAIL_MIME_HEADER2) - 1); - p = (char *)mbfl_no2preferred_mime_name(tran_cs); + p = (char *)mbfl_no2preferred_mime_name(tran_cs->no_encoding); 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); @@ -4633,7 +4460,7 @@ PHP_FUNCTION(mb_send_mail) } if (!suppressed_hdrs.cnt_trans_enc) { mbfl_memory_device_strncat(&device, PHP_MBSTR_MAIL_MIME_HEADER4, sizeof(PHP_MBSTR_MAIL_MIME_HEADER4) - 1); - p = (char *)mbfl_no2preferred_mime_name(body_enc); + p = (char *)mbfl_no2preferred_mime_name(body_enc->no_encoding); if (p == NULL) { p = "7bit"; } @@ -4868,7 +4695,7 @@ static inline mbfl_buffer_converter *php_mb_init_convd(const mbfl_encoding *enco { mbfl_buffer_converter *convd; - convd = mbfl_buffer_converter_new2(encoding, encoding, 0); + convd = mbfl_buffer_converter_new(encoding, encoding, 0); if (convd == NULL) { return NULL; } @@ -4880,10 +4707,10 @@ static inline mbfl_buffer_converter *php_mb_init_convd(const mbfl_encoding *enco static inline int php_mb_check_encoding_impl(mbfl_buffer_converter *convd, const char *input, size_t length, const mbfl_encoding *encoding) { mbfl_string string, result, *ret = NULL; - long illegalchars = 0; + size_t illegalchars = 0; /* initialize string */ - mbfl_string_init_set(&string, mbfl_no_language_neutral, encoding->no_encoding); + mbfl_string_init_set(&string, mbfl_no_language_neutral, encoding); mbfl_string_init(&result); string.val = (unsigned char *) input; @@ -5051,26 +4878,19 @@ PHP_FUNCTION(mb_check_encoding) /* }}} */ -static inline zend_long php_mb_ord(const char* str, size_t str_len, const char* enc) +static inline zend_long php_mb_ord(const char* str, size_t str_len, const char* enc_name) { + const mbfl_encoding *enc; enum mbfl_no_encoding no_enc; - char* ret; - size_t ret_len; - zend_long cp; - if (enc == NULL) { - no_enc = MBSTRG(current_internal_encoding)->no_encoding; - } else { - no_enc = mbfl_name2no_encoding(enc); - - if (no_enc == mbfl_no_encoding_invalid) { - php_error_docref(NULL, E_WARNING, "Unknown encoding \"%s\"", enc); - return -1; - } + enc = php_mb_get_encoding(enc_name); + if (!enc) { + return -1; } + no_enc = enc->no_encoding; if (php_mb_is_unsupported_no_encoding(no_enc)) { - php_error_docref(NULL, E_WARNING, "Unsupported encoding \"%s\"", enc); + php_error_docref(NULL, E_WARNING, "Unsupported encoding \"%s\"", enc_name); return -1; } @@ -5080,32 +4900,32 @@ static inline zend_long php_mb_ord(const char* str, size_t str_len, const char* } { - long orig_illegalchars = MBSTRG(illegalchars); - MBSTRG(illegalchars) = 0; - ret = php_mb_convert_encoding(str, str_len, "UCS-4BE", enc, &ret_len); - if (MBSTRG(illegalchars) != 0) { - if (ret) { - efree(ret); - } - MBSTRG(illegalchars) = orig_illegalchars; + mbfl_wchar_device dev; + mbfl_convert_filter *filter; + zend_long cp; + + mbfl_wchar_device_init(&dev); + filter = mbfl_convert_filter_new( + enc, &mbfl_encoding_wchar, + mbfl_wchar_device_output, 0, &dev); + if (!filter) { + php_error_docref(NULL, E_WARNING, "Creation of filter failed"); return -1; } - MBSTRG(illegalchars) = orig_illegalchars; - } + mbfl_convert_filter_feed_string(filter, (const unsigned char *) str, str_len); + mbfl_convert_filter_flush(filter); + mbfl_convert_filter_delete(filter); - if (ret == NULL) { - return -1; - } - - cp = (unsigned char) ret[0] << 24 | \ - (unsigned char) ret[1] << 16 | \ - (unsigned char) ret[2] << 8 | \ - (unsigned char) ret[3]; - - efree(ret); + if (dev.pos < 1 || filter->num_illegalchar || dev.buffer[0] >= MBFL_WCSGROUP_UCS4MAX) { + mbfl_wchar_device_clear(&dev); + return -1; + } - return cp; + cp = dev.buffer[0]; + mbfl_wchar_device_clear(&dev); + return cp; + } } @@ -5135,26 +4955,22 @@ PHP_FUNCTION(mb_ord) /* }}} */ -static inline char* php_mb_chr(zend_long cp, const char* enc, size_t *output_len) +static inline zend_string *php_mb_chr(zend_long cp, const char *enc_name) { + const mbfl_encoding *enc; enum mbfl_no_encoding no_enc; + zend_string *ret; char* buf; size_t buf_len; - char* ret; - size_t ret_len; - if (enc == NULL) { - no_enc = MBSTRG(current_internal_encoding)->no_encoding; - } else { - no_enc = mbfl_name2no_encoding(enc); - if (no_enc == mbfl_no_encoding_invalid) { - php_error_docref(NULL, E_WARNING, "Unknown encoding \"%s\"", enc); - return NULL; - } + enc = php_mb_get_encoding(enc_name); + if (!enc) { + return NULL; } + no_enc = enc->no_encoding; if (php_mb_is_unsupported_no_encoding(no_enc)) { - php_error_docref(NULL, E_WARNING, "Unsupported encoding \"%s\"", enc); + php_error_docref(NULL, E_WARNING, "Unsupported encoding \"%s\"", enc_name); return NULL; } @@ -5168,42 +4984,32 @@ static inline char* php_mb_chr(zend_long cp, const char* enc, size_t *output_len } if (cp < 0x80) { - ret_len = 1; - ret = (char *) safe_emalloc(ret_len, 1, 1); - ret[0] = cp; - ret[1] = 0; + ret = ZSTR_CHAR(cp); } else if (cp < 0x800) { - ret_len = 2; - ret = (char *) safe_emalloc(ret_len, 1, 1); - ret[0] = 0xc0 | (cp >> 6); - ret[1] = 0x80 | (cp & 0x3f); - ret[2] = 0; + ret = zend_string_alloc(2, 0); + ZSTR_VAL(ret)[0] = 0xc0 | (cp >> 6); + ZSTR_VAL(ret)[1] = 0x80 | (cp & 0x3f); + ZSTR_VAL(ret)[2] = 0; } else if (cp < 0x10000) { - ret_len = 3; - ret = (char *) safe_emalloc(ret_len, 1, 1); - ret[0] = 0xe0 | (cp >> 12); - ret[1] = 0x80 | ((cp >> 6) & 0x3f); - ret[2] = 0x80 | (cp & 0x3f); - ret[3] = 0; + ret = zend_string_alloc(3, 0); + ZSTR_VAL(ret)[0] = 0xe0 | (cp >> 12); + ZSTR_VAL(ret)[1] = 0x80 | ((cp >> 6) & 0x3f); + ZSTR_VAL(ret)[2] = 0x80 | (cp & 0x3f); + ZSTR_VAL(ret)[3] = 0; } else { - ret_len = 4; - ret = (char *) safe_emalloc(ret_len, 1, 1); - ret[0] = 0xf0 | (cp >> 18); - ret[1] = 0x80 | ((cp >> 12) & 0x3f); - ret[2] = 0x80 | ((cp >> 6) & 0x3f); - ret[3] = 0x80 | (cp & 0x3f); - ret[4] = 0; - } - - if (output_len) { - *output_len = ret_len; + ret = zend_string_alloc(4, 0); + ZSTR_VAL(ret)[0] = 0xf0 | (cp >> 18); + ZSTR_VAL(ret)[1] = 0x80 | ((cp >> 12) & 0x3f); + ZSTR_VAL(ret)[2] = 0x80 | ((cp >> 6) & 0x3f); + ZSTR_VAL(ret)[3] = 0x80 | (cp & 0x3f); + ZSTR_VAL(ret)[4] = 0; } return ret; } buf_len = 4; - buf = (char *) safe_emalloc(buf_len, 1, 1); + buf = (char *) emalloc(buf_len + 1); buf[0] = (cp >> 24) & 0xff; buf[1] = (cp >> 16) & 0xff; buf[2] = (cp >> 8) & 0xff; @@ -5211,24 +5017,24 @@ static inline char* php_mb_chr(zend_long cp, const char* enc, size_t *output_len buf[4] = 0; { + char *ret_str; + size_t ret_len; long orig_illegalchars = MBSTRG(illegalchars); MBSTRG(illegalchars) = 0; - ret = php_mb_convert_encoding(buf, buf_len, enc, "UCS-4BE", &ret_len); + ret_str = php_mb_convert_encoding_ex(buf, buf_len, enc, &mbfl_encoding_ucs4be, &ret_len); if (MBSTRG(illegalchars) != 0) { efree(buf); - efree(ret); + efree(ret_str); MBSTRG(illegalchars) = orig_illegalchars; return NULL; } + ret = zend_string_init(ret_str, ret_len, 0); + efree(ret_str); MBSTRG(illegalchars) = orig_illegalchars; } efree(buf); - if (output_len) { - *output_len = ret_len; - } - return ret; } @@ -5239,8 +5045,7 @@ PHP_FUNCTION(mb_chr) zend_long cp; char* enc = NULL; size_t enc_len; - char* ret; - size_t ret_len; + zend_string* ret; ZEND_PARSE_PARAMETERS_START(1, 2) Z_PARAM_LONG(cp) @@ -5248,45 +5053,42 @@ PHP_FUNCTION(mb_chr) Z_PARAM_STRING(enc, enc_len) ZEND_PARSE_PARAMETERS_END(); - ret = php_mb_chr(cp, enc, &ret_len); - + ret = php_mb_chr(cp, enc); if (ret == NULL) { RETURN_FALSE; } - RETVAL_STRING(ret); - efree(ret); + RETURN_STR(ret); } /* }}} */ -static inline char* php_mb_scrub(const char* str, size_t str_len, const char* enc) +static inline char* php_mb_scrub(const char* str, size_t str_len, const mbfl_encoding *enc) { size_t ret_len; - return php_mb_convert_encoding(str, str_len, enc, enc, &ret_len); + return php_mb_convert_encoding_ex(str, str_len, enc, enc, &ret_len); } /* {{{ proto bool mb_scrub([string str[, string encoding]]) */ PHP_FUNCTION(mb_scrub) { + const mbfl_encoding *enc; char* str; size_t str_len; - char *enc = NULL; - size_t enc_len; + char *enc_name = NULL; + size_t enc_name_len; char *ret; ZEND_PARSE_PARAMETERS_START(1, 2) Z_PARAM_STRING(str, str_len) Z_PARAM_OPTIONAL - Z_PARAM_STRING(enc, enc_len) + Z_PARAM_STRING(enc_name, enc_name_len) ZEND_PARSE_PARAMETERS_END(); - if (enc == NULL) { - enc = (char *) MBSTRG(current_internal_encoding)->name; - } else if (!mbfl_is_support_encoding(enc)) { - php_error_docref(NULL, E_WARNING, "Unknown encoding \"%s\"", enc); + enc = php_mb_get_encoding(enc_name); + if (!enc) { RETURN_FALSE; } @@ -5412,63 +5214,65 @@ MBSTRING_API char *php_mb_safe_strrchr(const char *s, unsigned int c, size_t nby /* {{{ MBSTRING_API int php_mb_stripos() */ -MBSTRING_API int php_mb_stripos(int mode, const char *old_haystack, unsigned int old_haystack_len, const char *old_needle, unsigned int old_needle_len, long offset, const char *from_encoding) +MBSTRING_API size_t php_mb_stripos(int mode, const char *old_haystack, size_t old_haystack_len, const char *old_needle, size_t old_needle_len, zend_long offset, const char *from_encoding) { - int n; + size_t n = (size_t) -1; mbfl_string haystack, needle; - n = -1; + const mbfl_encoding *enc; + + enc = php_mb_get_encoding(from_encoding); + if (!enc) { + return (size_t) -1; + } mbfl_string_init(&haystack); mbfl_string_init(&needle); haystack.no_language = MBSTRG(language); - haystack.no_encoding = MBSTRG(current_internal_encoding)->no_encoding; + haystack.encoding = enc; needle.no_language = MBSTRG(language); - needle.no_encoding = MBSTRG(current_internal_encoding)->no_encoding; + needle.encoding = enc; do { + /* We're using simple case-folding here, because we'd have to deal with remapping of + * offsets otherwise. */ + size_t len = 0; - haystack.val = (unsigned char *)php_unicode_convert_case(PHP_UNICODE_CASE_UPPER, (char *)old_haystack, old_haystack_len, &len, from_encoding); + haystack.val = (unsigned char *)php_unicode_convert_case(PHP_UNICODE_CASE_FOLD_SIMPLE, (char *)old_haystack, old_haystack_len, &len, enc); haystack.len = len; if (!haystack.val) { break; } - if (haystack.len <= 0) { + if (haystack.len == 0) { break; } - needle.val = (unsigned char *)php_unicode_convert_case(PHP_UNICODE_CASE_UPPER, (char *)old_needle, old_needle_len, &len, from_encoding); + needle.val = (unsigned char *)php_unicode_convert_case(PHP_UNICODE_CASE_FOLD_SIMPLE, (char *)old_needle, old_needle_len, &len, enc); needle.len = len; 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) { - php_error_docref(NULL, E_WARNING, "Unknown encoding \"%s\"", from_encoding); + if (needle.len == 0) { break; } - { - int haystack_char_len = mbfl_strlen(&haystack); + if (offset != 0) { + size_t haystack_char_len = mbfl_strlen(&haystack); if (mode) { - if ((offset > 0 && offset > haystack_char_len) || - (offset < 0 && -offset > haystack_char_len)) { + if ((offset > 0 && (size_t)offset > haystack_char_len) || + (offset < 0 && (size_t)(-offset) > haystack_char_len)) { php_error_docref(NULL, E_WARNING, "Offset is greater than the length of haystack string"); break; } } else { if (offset < 0) { - offset += (long)haystack_char_len; + offset += (zend_long)haystack_char_len; } - if (offset < 0 || offset > haystack_char_len) { + if (offset < 0 || (size_t)offset > haystack_char_len) { php_error_docref(NULL, E_WARNING, "Offset not contained in string"); break; } diff --git a/ext/mbstring/mbstring.h b/ext/mbstring/mbstring.h index 4772898c89c3b..1b8e618af54a2 100644 --- a/ext/mbstring/mbstring.h +++ b/ext/mbstring/mbstring.h @@ -140,6 +140,9 @@ MBSTRING_API char *php_mb_safe_strrchr_ex(const char *s, unsigned int c, MBSTRING_API char *php_mb_safe_strrchr(const char *s, unsigned int c, size_t nbytes); +MBSTRING_API char *php_mb_convert_encoding_ex( + const char *input, size_t length, + const mbfl_encoding *to_encoding, const mbfl_encoding *from_encoding, size_t *output_len); MBSTRING_API char * php_mb_convert_encoding(const char *input, size_t length, const char *_to_encoding, const char *_from_encodings, @@ -150,20 +153,14 @@ MBSTRING_API int php_mb_check_encoding_list(const char *encoding_list); MBSTRING_API size_t php_mb_mbchar_bytes_ex(const char *s, const mbfl_encoding *enc); MBSTRING_API size_t php_mb_mbchar_bytes(const char *s); -MBSTRING_API int php_mb_encoding_detector_ex(const char *arg_string, int arg_length, - char *arg_list); - -MBSTRING_API int php_mb_encoding_converter_ex(char **str, int *len, const char *encoding_to, - const char *encoding_from); -MBSTRING_API int php_mb_stripos(int mode, const char *old_haystack, unsigned int old_haystack_len, const char *old_needle, unsigned int old_needle_len, long offset, const char *from_encoding); +MBSTRING_API size_t php_mb_stripos(int mode, const char *old_haystack, size_t old_haystack_len, const char *old_needle, size_t old_needle_len, zend_long offset, const char *from_encoding); MBSTRING_API int php_mb_check_encoding(const char *input, size_t length, const char *enc); /* internal use only */ -int _php_mb_ini_mbstring_internal_encoding_set(const char *new_value, uint32_t new_value_length); +int _php_mb_ini_mbstring_internal_encoding_set(const char *new_value, size_t new_value_length); ZEND_BEGIN_MODULE_GLOBALS(mbstring) char *internal_encoding_name; - enum mbfl_no_language language; const mbfl_encoding *internal_encoding; const mbfl_encoding *current_internal_encoding; const mbfl_encoding *http_output_encoding; @@ -185,15 +182,18 @@ ZEND_BEGIN_MODULE_GLOBALS(mbstring) int filter_illegal_substchar; int current_filter_illegal_mode; int current_filter_illegal_substchar; - long func_overload; + zend_long func_overload; + enum mbfl_no_language language; zend_bool encoding_translation; - long strict_detection; - long illegalchars; + zend_bool strict_detection; + size_t illegalchars; mbfl_buffer_converter *outconv; void *http_output_conv_mimetypes; #if HAVE_MBREGEX struct _zend_mb_regex_globals *mb_regex_globals; #endif + char *last_used_encoding_name; + const mbfl_encoding *last_used_encoding; ZEND_END_MODULE_GLOBALS(mbstring) #define MB_OVERLOAD_MAIL 1 diff --git a/ext/mbstring/php_unicode.c b/ext/mbstring/php_unicode.c index 485988fe35d91..3b928bcebb53c 100644 --- a/ext/mbstring/php_unicode.c +++ b/ext/mbstring/php_unicode.c @@ -43,22 +43,10 @@ #include "mbstring.h" #include "php_unicode.h" #include "unicode_data.h" +#include "libmbfl/mbfl/mbfilter_wchar.h" ZEND_EXTERN_MODULE_GLOBALS(mbstring) -/* - * 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; @@ -98,241 +86,352 @@ static int prop_lookup(unsigned long code, unsigned long n) } -MBSTRING_API int php_unicode_is_prop(unsigned long code, unsigned long mask1, - unsigned long mask2) +MBSTRING_API int php_unicode_is_prop1(unsigned long code, int prop) { - unsigned long i; + return prop_lookup(code, prop); +} - if (mask1 == 0 && mask2 == 0) - return 0; +MBSTRING_API int php_unicode_is_prop(unsigned long code, ...) +{ + int result = 0; + va_list va; + va_start(va, code); - for (i = 0; mask1 && i < 32; i++) { - if ((mask1 & masks32[i]) && prop_lookup(code, i)) - return 1; - } + while (1) { + int prop = va_arg(va, int); + if (prop < 0) { + break; + } - for (i = 32; mask2 && i < _ucprop_size; i++) { - if ((mask2 & masks32[i & 31]) && prop_lookup(code, i)) - return 1; + if (prop_lookup(code, prop)) { + result = 1; + break; + } } - return 0; + va_end(va); + return result; +} + +static inline unsigned mph_hash(unsigned d, unsigned x) { + x ^= d; + x = ((x >> 16) ^ x) * 0x45d9f3b; + return x; } -static unsigned long case_lookup(unsigned long code, long l, long r, int field) +#define CODE_NOT_FOUND ((unsigned) -1) + +static inline unsigned mph_lookup( + unsigned code, + const short *g_table, unsigned g_table_size, + const unsigned *table, unsigned table_size) { - long m; - const unsigned int *tmp; + short g = g_table[mph_hash(0, code) % g_table_size]; - /* - * 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; - tmp = &_uccase_map[m*3]; - if (code > *tmp) - l = m + 1; - else if (code < *tmp) - r = m - 1; - else if (code == *tmp) - return tmp[field]; + unsigned idx; + if (g <= 0) { + idx = -g; + } else { + idx = mph_hash(g, code) % table_size; } - return code; + if (table[2*idx] == code) { + return table[2*idx + 1]; + } + return CODE_NOT_FOUND; } -MBSTRING_API unsigned long php_turkish_toupper(unsigned long code, long l, long r, int field) +#define CASE_LOOKUP(code, type) \ + mph_lookup(code, _uccase_##type##_g, _uccase_##type##_g_size, \ + _uccase_##type##_table, _uccase_##type##_table_size) + +static unsigned php_unicode_toupper_raw(unsigned code, enum mbfl_no_encoding enc) { - if (code == 0x0069L) { - return 0x0130L; + if (code < 0x80) { + /* Fast path for ASCII */ + if (code >= 0x61 && code <= 0x7A) { + if (UNEXPECTED(enc == mbfl_no_encoding_8859_9 && code == 0x69)) { + return 0x130; + } + return code - 0x20; + } + return code; + } else { + unsigned new_code = CASE_LOOKUP(code, upper); + if (new_code != CODE_NOT_FOUND) { + return new_code; + } + return code; } - return case_lookup(code, l, r, field); } -MBSTRING_API unsigned long php_turkish_tolower(unsigned long code, long l, long r, int field) +static unsigned php_unicode_tolower_raw(unsigned code, enum mbfl_no_encoding enc) { - if (code == 0x0049L) { - return 0x0131L; + if (code < 0x80) { + /* Fast path for ASCII */ + if (code >= 0x41 && code <= 0x5A) { + if (UNEXPECTED(enc == mbfl_no_encoding_8859_9 && code == 0x0049L)) { + return 0x0131L; + } + return code + 0x20; + } + return code; + } else { + unsigned new_code = CASE_LOOKUP(code, lower); + if (new_code != CODE_NOT_FOUND) { + if (UNEXPECTED(enc == mbfl_no_encoding_8859_9 && code == 0x130)) { + return 0x69; + } + return new_code; + } + return code; } - return case_lookup(code, l, r, field); } -MBSTRING_API unsigned long php_unicode_toupper(unsigned long code, enum mbfl_no_encoding enc) +static unsigned php_unicode_totitle_raw(unsigned code, enum mbfl_no_encoding enc) { - int field; - long l, r; - - if (php_unicode_is_upper(code)) - return code; + unsigned new_code = CASE_LOOKUP(code, title); + if (new_code != CODE_NOT_FOUND) { + return new_code; + } - if (php_unicode_is_lower(code)) { - /* - * The character is lower case. - */ - field = 1; - l = _uccase_len[0]; - r = (l + _uccase_len[1]) - 1; + /* No dedicated title-case variant, use to-upper instead */ + return php_unicode_toupper_raw(code, enc); +} - if (enc == mbfl_no_encoding_8859_9) { - return php_turkish_toupper(code, l, r, field); +unsigned php_unicode_tofold_raw(unsigned code, enum mbfl_no_encoding enc) +{ + if (code < 0x80) { + /* Fast path for ASCII */ + if (code >= 0x41 && code <= 0x5A) { + if (UNEXPECTED(enc == mbfl_no_encoding_8859_9 && code == 0x49)) { + return 0x131; + } + return code + 0x20; } - + return code; } else { - /* - * The character is title case. - */ - field = 1; - l = _uccase_len[0] + _uccase_len[1]; - r = _uccase_size - 1; + unsigned new_code = CASE_LOOKUP(code, fold); + if (new_code != CODE_NOT_FOUND) { + if (UNEXPECTED(enc == mbfl_no_encoding_8859_9 && code == 0x130)) { + return 0x69; + } + return new_code; + } + return code; } - return case_lookup(code, l, r, field); } -MBSTRING_API 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] - 1; - - if (enc == mbfl_no_encoding_8859_9) { - return php_turkish_tolower(code, l, r, field); - } +static inline unsigned php_unicode_tolower_simple(unsigned code, enum mbfl_no_encoding enc) { + code = php_unicode_tolower_raw(code, enc); + if (UNEXPECTED(code > 0xffffff)) { + return _uccase_extra_table[code & 0xffffff]; + } + return code; +} +static inline unsigned php_unicode_toupper_simple(unsigned code, enum mbfl_no_encoding enc) { + code = php_unicode_toupper_raw(code, enc); + if (UNEXPECTED(code > 0xffffff)) { + return _uccase_extra_table[code & 0xffffff]; + } + return code; +} +static inline unsigned php_unicode_totitle_simple(unsigned code, enum mbfl_no_encoding enc) { + code = php_unicode_totitle_raw(code, enc); + if (UNEXPECTED(code > 0xffffff)) { + return _uccase_extra_table[code & 0xffffff]; + } + return code; +} +static inline unsigned php_unicode_tofold_simple(unsigned code, enum mbfl_no_encoding enc) { + code = php_unicode_tofold_raw(code, enc); + if (UNEXPECTED(code > 0xffffff)) { + return _uccase_extra_table[code & 0xffffff]; + } + return code; +} - } else { - /* - * The character is title case. - */ - field = 2; - l = _uccase_len[0] + _uccase_len[1]; - r = _uccase_size - 1; +static inline unsigned php_unicode_tolower_full( + unsigned code, enum mbfl_no_encoding enc, unsigned *out) { + code = php_unicode_tolower_raw(code, enc); + if (UNEXPECTED(code > 0xffffff)) { + unsigned len = code >> 24; + const unsigned *p = &_uccase_extra_table[code & 0xffffff]; + memcpy(out, p + 1, len * sizeof(unsigned)); + return len; + } + *out = code; + return 1; +} +static inline unsigned php_unicode_toupper_full( + unsigned code, enum mbfl_no_encoding enc, unsigned *out) { + code = php_unicode_toupper_raw(code, enc); + if (UNEXPECTED(code > 0xffffff)) { + unsigned len = code >> 24; + const unsigned *p = &_uccase_extra_table[code & 0xffffff]; + memcpy(out, p + 1, len * sizeof(unsigned)); + return len; + } + *out = code; + return 1; +} +static inline unsigned php_unicode_totitle_full( + unsigned code, enum mbfl_no_encoding enc, unsigned *out) { + code = php_unicode_totitle_raw(code, enc); + if (UNEXPECTED(code > 0xffffff)) { + unsigned len = code >> 24; + const unsigned *p = &_uccase_extra_table[code & 0xffffff]; + memcpy(out, p + 1, len * sizeof(unsigned)); + return len; + } + *out = code; + return 1; +} +static inline unsigned php_unicode_tofold_full( + unsigned code, enum mbfl_no_encoding enc, unsigned *out) { + code = php_unicode_tofold_raw(code, enc); + if (UNEXPECTED(code > 0xffffff)) { + unsigned len = code >> 24; + const unsigned *p = &_uccase_extra_table[code & 0xffffff]; + memcpy(out, p + 1, len * sizeof(unsigned)); + return len; } - return case_lookup(code, l, r, field); + *out = code; + return 1; } -MBSTRING_API unsigned long php_unicode_totitle(unsigned long code, enum mbfl_no_encoding enc) +struct convert_case_data { + mbfl_convert_filter *next_filter; + enum mbfl_no_encoding no_encoding; + int case_mode; + int title_mode; +}; + +static int convert_case_filter(int c, void *void_data) { - int field; - long l, r; + struct convert_case_data *data = (struct convert_case_data *) void_data; + unsigned out[3]; + unsigned len, i; + switch (data->case_mode) { + case PHP_UNICODE_CASE_UPPER_SIMPLE: + out[0] = php_unicode_toupper_simple(c, data->no_encoding); + len = 1; + break; - if (php_unicode_is_title(code)) - return code; + case PHP_UNICODE_CASE_UPPER: + len = php_unicode_toupper_full(c, data->no_encoding, out); + break; - /* - * The offset will always be the same for converting to title case. - */ - field = 2; + case PHP_UNICODE_CASE_LOWER_SIMPLE: + out[0] = php_unicode_tolower_simple(c, data->no_encoding); + len = 1; + break; - if (php_unicode_is_upper(code)) { - /* - * The character is upper case. - */ - l = 0; - r = _uccase_len[0] - 1; - } else { - /* - * The character is lower case. - */ - l = _uccase_len[0]; - r = (l + _uccase_len[1]) - 1; - } - return case_lookup(code, l, r, field); + case PHP_UNICODE_CASE_LOWER: + len = php_unicode_tolower_full(c, data->no_encoding, out); + break; -} + case PHP_UNICODE_CASE_FOLD: + len = php_unicode_tofold_full(c, data->no_encoding, out); + break; + case PHP_UNICODE_CASE_FOLD_SIMPLE: + out[0] = php_unicode_tofold_simple(c, data->no_encoding); + len = 1; + break; -#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] ) + case PHP_UNICODE_CASE_TITLE_SIMPLE: + case PHP_UNICODE_CASE_TITLE: + { + if (data->title_mode) { + if (data->case_mode == PHP_UNICODE_CASE_TITLE_SIMPLE) { + out[0] = php_unicode_tolower_simple(c, data->no_encoding); + len = 1; + } else { + len = php_unicode_tolower_full(c, data->no_encoding, out); + } + } else { + if (data->case_mode == PHP_UNICODE_CASE_TITLE_SIMPLE) { + out[0] = php_unicode_totitle_simple(c, data->no_encoding); + len = 1; + } else { + len = php_unicode_totitle_full(c, data->no_encoding, out); + } + } + if (!php_unicode_is_case_ignorable(c)) { + data->title_mode = php_unicode_is_cased(c); + } + break; + } + default: + assert(0); + break; + } -#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;\ + for (i = 0; i < len; i++) { + (*data->next_filter->filter_function)(out[i], data->next_filter); + } + return 0; } -MBSTRING_API char *php_unicode_convert_case(int case_mode, const char *srcstr, size_t srclen, size_t *ret_len, - const char *src_encoding) +MBSTRING_API char *php_unicode_convert_case( + int case_mode, const char *srcstr, size_t srclen, size_t *ret_len, + const mbfl_encoding *src_encoding) { - char *unicode, *newstr; - size_t unicode_len; - unsigned char *unicode_ptr; - size_t i; - enum mbfl_no_encoding _src_encoding = mbfl_name2no_encoding(src_encoding); - - if (_src_encoding == mbfl_no_encoding_invalid) { - php_error_docref(NULL, E_WARNING, "Unknown encoding \"%s\"", src_encoding); + struct convert_case_data data; + mbfl_convert_filter *from_wchar, *to_wchar; + mbfl_string result, *result_ptr; + + mbfl_memory_device device; + mbfl_memory_device_init(&device, srclen + 1, 0); + + /* encoding -> wchar filter */ + to_wchar = mbfl_convert_filter_new(src_encoding, + &mbfl_encoding_wchar, convert_case_filter, NULL, &data); + if (to_wchar == NULL) { + mbfl_memory_device_clear(&device); return NULL; } - unicode = php_mb_convert_encoding(srcstr, srclen, "UCS-4BE", src_encoding, &unicode_len); - if (unicode == NULL) + /* wchar -> encoding filter */ + from_wchar = mbfl_convert_filter_new( + &mbfl_encoding_wchar, src_encoding, + mbfl_memory_device_output, NULL, &device); + if (from_wchar == NULL) { + mbfl_convert_filter_delete(to_wchar); + mbfl_memory_device_clear(&device); 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)); + data.next_filter = from_wchar; + data.no_encoding = src_encoding->no_encoding; + data.case_mode = case_mode; + data.title_mode = 0; + + { + /* feed data */ + const unsigned char *p = (const unsigned char *) srcstr; + size_t n = srclen; + while (n > 0) { + if ((*to_wchar->filter_function)(*p++, to_wchar) < 0) { + break; } - break; + n--; + } + } - 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|UC_PO|UC_OS, 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; + mbfl_convert_filter_flush(to_wchar); + mbfl_convert_filter_flush(from_wchar); + result_ptr = mbfl_memory_device_result(&device, &result); + mbfl_convert_filter_delete(to_wchar); + mbfl_convert_filter_delete(from_wchar); + if (!result_ptr) { + return NULL; } - newstr = php_mb_convert_encoding(unicode, unicode_len, src_encoding, "UCS-4BE", ret_len); - efree(unicode); - - return newstr; + *ret_len = result.len; + return (char *) result.val; } diff --git a/ext/mbstring/php_unicode.h b/ext/mbstring/php_unicode.h index a1eb3c1e12cd6..b287a70fe241f 100644 --- a/ext/mbstring/php_unicode.h +++ b/ext/mbstring/php_unicode.h @@ -34,155 +34,149 @@ #define PHP_UNICODE_H #if HAVE_MBSTRING -/* - * 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 */ - -MBSTRING_API int php_unicode_is_prop(unsigned long code, unsigned long mask1, - unsigned long mask2); -MBSTRING_API char *php_unicode_convert_case(int case_mode, const char *srcstr, size_t srclen, size_t *retlen, - const char *src_encoding); - -#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) +#define UC_MN 0 /* Mark, Non-Spacing */ +#define UC_MC 1 /* Mark, Spacing Combining */ +#define UC_ME 2 /* Mark, Enclosing */ +#define UC_ND 3 /* Number, Decimal Digit */ +#define UC_NL 4 /* Number, Letter */ +#define UC_NO 5 /* Number, Other */ +#define UC_ZS 6 /* Separator, Space */ +#define UC_ZL 7 /* Separator, Line */ +#define UC_ZP 8 /* Separator, Paragraph */ +#define UC_CC 9 /* Other, Control */ +#define UC_CF 10 /* Other, Format */ +#define UC_OS 11 /* Other, Surrogate */ +#define UC_CO 12 /* Other, Private Use */ +#define UC_CN 13 /* Other, Not Assigned */ +#define UC_LU 14 /* Letter, Uppercase */ +#define UC_LL 15 /* Letter, Lowercase */ +#define UC_LT 16 /* Letter, Titlecase */ +#define UC_LM 17 /* Letter, Modifier */ +#define UC_LO 18 /* Letter, Other */ +#define UC_PC 19 /* Punctuation, Connector */ +#define UC_PD 20 /* Punctuation, Dash */ +#define UC_PS 21 /* Punctuation, Open */ +#define UC_PE 22 /* Punctuation, Close */ +#define UC_PO 23 /* Punctuation, Other */ +#define UC_SM 24 /* Symbol, Math */ +#define UC_SC 25 /* Symbol, Currency */ +#define UC_SK 26 /* Symbol, Modifier */ +#define UC_SO 27 /* Symbol, Other */ +#define UC_L 28 /* Left-To-Right */ +#define UC_R 29 /* Right-To-Left */ +#define UC_EN 30 /* European Number */ +#define UC_ES 31 /* European Number Separator */ +#define UC_ET 32 /* European Number Terminator */ +#define UC_AN 33 /* Arabic Number */ +#define UC_CS 34 /* Common Number Separator */ +#define UC_B 35 /* Block Separator */ +#define UC_S 36 /* Segment Separator */ +#define UC_WS 37 /* Whitespace */ +#define UC_ON 38 /* Other Neutrals */ +#define UC_PI 39 /* Punctuation, Initial */ +#define UC_PF 40 /* Punctuation, Final */ +#define UC_AL 41 /* Arabic Letter */ + +/* Derived properties from DerivedCoreProperties.txt */ +#define UC_CASED 42 +#define UC_CASE_IGNORABLE 43 + + +MBSTRING_API int php_unicode_is_prop(unsigned long code, ...); +MBSTRING_API int php_unicode_is_prop1(unsigned long code, int prop); + +MBSTRING_API char *php_unicode_convert_case( + int case_mode, const char *srcstr, size_t srclen, size_t *retlen, + const mbfl_encoding *src_encoding); + +#define PHP_UNICODE_CASE_UPPER 0 +#define PHP_UNICODE_CASE_LOWER 1 +#define PHP_UNICODE_CASE_TITLE 2 +#define PHP_UNICODE_CASE_FOLD 3 +#define PHP_UNICODE_CASE_UPPER_SIMPLE 4 +#define PHP_UNICODE_CASE_LOWER_SIMPLE 5 +#define PHP_UNICODE_CASE_TITLE_SIMPLE 6 +#define PHP_UNICODE_CASE_FOLD_SIMPLE 7 +#define PHP_UNICODE_CASE_MODE_MAX 7 + +/* Optimize the common ASCII case for lower/upper */ + +static inline int php_unicode_is_lower(unsigned long code) { + if (code < 0x80) { + return code >= 0x61 && code <= 0x7A; + } else { + return php_unicode_is_prop1(code, UC_LL); + } +} + +static inline int php_unicode_is_upper(unsigned long code) { + if (code < 0x80) { + return code >= 0x41 && code <= 0x5A; + } else { + return php_unicode_is_prop1(code, UC_LU); + } +} + +#define php_unicode_is_alpha(cc) php_unicode_is_prop(cc, UC_LU, UC_LL, UC_LM, UC_LO, UC_LT, -1) +#define php_unicode_is_digit(cc) php_unicode_is_prop1(cc, UC_ND) +#define php_unicode_is_alnum(cc) php_unicode_is_prop(cc, UC_LU, UC_LL, UC_LM, UC_LO, UC_LT, UC_ND, -1) +#define php_unicode_is_cntrl(cc) php_unicode_is_prop(cc, UC_CC, UC_CF, -1) +#define php_unicode_is_blank(cc) php_unicode_is_prop1(cc, UC_ZS) +#define php_unicode_is_punct(cc) php_unicode_is_prop(cc, UC_PD, UC_PS, UC_PE, UC_PO, UC_PI, UC_PF, -1) +#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, -1) +#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, -1) +#define php_unicode_is_title(cc) php_unicode_is_prop1(cc, UC_LT) + +#define php_unicode_is_isocntrl(cc) php_unicode_is_prop1(cc, UC_CC) +#define php_unicode_is_fmtcntrl(cc) php_unicode_is_prop1(cc, UC_CF) + +#define php_unicode_is_symbol(cc) php_unicode_is_prop(cc, UC_SM, UC_SC, UC_SO, UC_SK, -1) +#define php_unicode_is_number(cc) php_unicode_is_prop(cc, UC_ND, UC_NO, UC_NL, -1) +#define php_unicode_is_nonspacing(cc) php_unicode_is_prop1(cc, UC_MN) +#define php_unicode_is_openpunct(cc) php_unicode_is_prop1(cc, UC_PS) +#define php_unicode_is_closepunct(cc) php_unicode_is_prop1(cc, UC_PE) +#define php_unicode_is_initialpunct(cc) php_unicode_is_prop1(cc, UC_PI) +#define php_unicode_is_finalpunct(cc) php_unicode_is_prop1(cc, UC_PF) /* * 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) +#define php_unicode_is_rtl(cc) php_unicode_is_prop1(cc, UC_R) +#define php_unicode_is_ltr(cc) php_unicode_is_prop1(cc, UC_L) +#define php_unicode_is_strong(cc) php_unicode_is_prop(cc, UC_L, UC_R, -1) +#define php_unicode_is_weak(cc) php_unicode_is_prop(cc, UC_EN, UC_ES, UC_ET, UC_AN, UC_CS, -1) +#define php_unicode_is_neutral(cc) php_unicode_is_prop(cc, UC_B, UC_S, UC_WS, UC_ON, -1) +#define php_unicode_is_separator(cc) php_unicode_is_prop(cc, UC_B, UC_S, -1) /* * 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) +#define php_unicode_is_mark(cc) php_unicode_is_prop(cc, UC_MN, UC_MC, UC_ME, -1) +#define php_unicode_is_modif(cc) php_unicode_is_prop1(cc, UC_LM) +#define php_unicode_is_letnum(cc) php_unicode_is_prop1(cc, UC_NL) +#define php_unicode_is_connect(cc) php_unicode_is_prop1(cc, UC_PC) +#define php_unicode_is_dash(cc) php_unicode_is_prop1(cc, UC_PD) +#define php_unicode_is_math(cc) php_unicode_is_prop1(cc, UC_SM) +#define php_unicode_is_currency(cc) php_unicode_is_prop1(cc, UC_SC) +#define php_unicode_is_modifsymbol(cc) php_unicode_is_prop1(cc, UC_SK) +#define php_unicode_is_nsmark(cc) php_unicode_is_prop1(cc, UC_MN) +#define php_unicode_is_spmark(cc) php_unicode_is_prop1(cc, UC_MC) +#define php_unicode_is_enclosing(cc) php_unicode_is_prop1(cc, UC_ME) +#define php_unicode_is_private(cc) php_unicode_is_prop1(cc, UC_CO) +#define php_unicode_is_surrogate(cc) php_unicode_is_prop1(cc, UC_OS) +#define php_unicode_is_lsep(cc) php_unicode_is_prop1(cc, UC_ZL) +#define php_unicode_is_psep(cc) php_unicode_is_prop1(cc, UC_ZP) + +#define php_unicode_is_identstart(cc) php_unicode_is_prop(cc, UC_LU, UC_LL, UC_LT, UC_LO, UC_NL, -1) +#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, -1) /* * Other miscellaneous character property macros. @@ -191,6 +185,13 @@ MBSTRING_API char *php_unicode_convert_case(int case_mode, const char *srcstr, s ((cc) >= 0xf900 && (cc) <= 0xfaff)) #define php_unicode_is_hangul(cc) ((cc) >= 0xac00 && (cc) <= 0xd7ff) +/* + * Derived core properties. + */ + +#define php_unicode_is_cased(cc) php_unicode_is_prop1(cc, UC_CASED) +#define php_unicode_is_case_ignorable(cc) php_unicode_is_prop1(cc, UC_CASE_IGNORABLE) + #endif diff --git a/ext/mbstring/tests/bug65544.phpt b/ext/mbstring/tests/bug65544.phpt new file mode 100644 index 0000000000000..904b6d6611a2c --- /dev/null +++ b/ext/mbstring/tests/bug65544.phpt @@ -0,0 +1,8 @@ +--TEST-- +Bug #65544: mb title case conversion-first word in quotation isn't capitalized +--FILE-- + +--EXPECT-- +string(80) ""Or Else It Doesn't, You Know. The Name Of The Song Is Called 'Haddocks' Eyes.'"" diff --git a/ext/mbstring/tests/bug69267.phpt b/ext/mbstring/tests/bug69267.phpt index 958f1c548b930..d8ca541e11768 100644 --- a/ext/mbstring/tests/bug69267.phpt +++ b/ext/mbstring/tests/bug69267.phpt @@ -38,7 +38,7 @@ string(8) "Džljnjdz" string(8) "Džljnjdz" string(3) "á¾³" string(3) "á¾³" -string(3) "á¾¼" -string(3) "á¾¼" +string(4) "ΑΙ" +string(4) "ΑΙ" string(3) "á¾¼" string(3) "á¾¼" diff --git a/ext/mbstring/tests/bug71298.phpt b/ext/mbstring/tests/bug71298.phpt new file mode 100644 index 0000000000000..f69ba29cbb0d0 --- /dev/null +++ b/ext/mbstring/tests/bug71298.phpt @@ -0,0 +1,8 @@ +--TEST-- +Bug #71298: MB_CASE_TITLE misbehaves with curled apostrophe/quote (HTML ’) +--FILE-- + +--EXPECT-- +People's Issues Versus People’s Issues diff --git a/ext/mbstring/tests/casefolding.phpt b/ext/mbstring/tests/casefolding.phpt new file mode 100644 index 0000000000000..34f7984b07694 --- /dev/null +++ b/ext/mbstring/tests/casefolding.phpt @@ -0,0 +1,38 @@ +--TEST-- +Case-insensitive string comparisons use case folding +--FILE-- + +--EXPECT-- +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) diff --git a/ext/mbstring/tests/casemapping.phpt b/ext/mbstring/tests/casemapping.phpt new file mode 100644 index 0000000000000..1f0e9fb1d5ba1 --- /dev/null +++ b/ext/mbstring/tests/casemapping.phpt @@ -0,0 +1,109 @@ +--TEST-- +Unicode case mapping +--FILE-- + +--EXPECT-- +String: ß +Lower: ß +Lower Simple: ß +Upper: SS +Upper Simple: ß +Title: Ss +Title Simple: ß +Fold: ss +Fold Simple: ß + +String: ff +Lower: ff +Lower Simple: ff +Upper: FF +Upper Simple: ff +Title: Ff +Title Simple: ff +Fold: ff +Fold Simple: ff + +String: İ +Lower: i̇ +Lower Simple: i +Upper: İ +Upper Simple: İ +Title: İ +Title Simple: İ +Fold: i̇ +Fold Simple: İ + +69 +69 +69 +69 + +49 +49 +fd +fd + +fd +fd +fd +fd + +dd +dd +69 +69 diff --git a/ext/mbstring/tests/mb_convert_case_invalid_mode.phpt b/ext/mbstring/tests/mb_convert_case_invalid_mode.phpt new file mode 100644 index 0000000000000..af59cd21065f7 --- /dev/null +++ b/ext/mbstring/tests/mb_convert_case_invalid_mode.phpt @@ -0,0 +1,11 @@ +--TEST-- +Calling mb_convert_case() with an invalid casing mode +--FILE-- + +--EXPECTF-- +Warning: mb_convert_case(): Invalid case mode in %s on line %d +bool(false) diff --git a/ext/mbstring/tests/mb_strtolower_variation2.phpt b/ext/mbstring/tests/mb_strtolower_variation2.phpt index 43d0f537286fd..ef69eb00af783 100644 --- a/ext/mbstring/tests/mb_strtolower_variation2.phpt +++ b/ext/mbstring/tests/mb_strtolower_variation2.phpt @@ -157,14 +157,10 @@ Warning: mb_strtolower(): Unknown encoding "0.5" in %s on line %d bool(false) -- Iteration 10 -- - -Warning: mb_strtolower(): Unknown encoding "(null)" in %s on line %d -bool(false) +string(24) "68656c6c6f2c20776f726c64" -- Iteration 11 -- - -Warning: mb_strtolower(): Unknown encoding "(null)" in %s on line %d -bool(false) +string(24) "68656c6c6f2c20776f726c64" -- Iteration 12 -- @@ -209,17 +205,13 @@ string(24) "68656c6c6f2c20776f726c64" string(24) "68656c6c6f2c20776f726c64" -- Iteration 22 -- - -Warning: mb_strtolower(): Unknown encoding "(null)" in %s on line %d -bool(false) +string(24) "68656c6c6f2c20776f726c64" -- Iteration 23 -- - -Warning: mb_strtolower(): Unknown encoding "(null)" in %s on line %d -bool(false) +string(24) "68656c6c6f2c20776f726c64" -- Iteration 24 -- Warning: mb_strtolower() expects parameter 2 to be string, resource given in %s on line %d NULL -Done \ No newline at end of file +Done diff --git a/ext/mbstring/tests/mb_strtoupper_variation2.phpt b/ext/mbstring/tests/mb_strtoupper_variation2.phpt index 52beb3d7410c3..25b9a53e917da 100644 --- a/ext/mbstring/tests/mb_strtoupper_variation2.phpt +++ b/ext/mbstring/tests/mb_strtoupper_variation2.phpt @@ -158,14 +158,10 @@ Warning: mb_strtoupper(): Unknown encoding "0.5" in %s on line %d bool(false) -- Iteration 10 -- - -Warning: mb_strtoupper(): Unknown encoding "(null)" in %s on line %d -bool(false) +string(24) "48454c4c4f2c20574f524c44" -- Iteration 11 -- - -Warning: mb_strtoupper(): Unknown encoding "(null)" in %s on line %d -bool(false) +string(24) "48454c4c4f2c20574f524c44" -- Iteration 12 -- @@ -210,17 +206,13 @@ string(24) "48454c4c4f2c20574f524c44" string(24) "48454c4c4f2c20574f524c44" -- Iteration 22 -- - -Warning: mb_strtoupper(): Unknown encoding "(null)" in %s on line %d -bool(false) +string(24) "48454c4c4f2c20574f524c44" -- Iteration 23 -- - -Warning: mb_strtoupper(): Unknown encoding "(null)" in %s on line %d -bool(false) +string(24) "48454c4c4f2c20574f524c44" -- Iteration 24 -- Warning: mb_strtoupper() expects parameter 2 to be string, resource given in %s on line %d NULL -Done \ No newline at end of file +Done diff --git a/ext/mbstring/ucgendat/README b/ext/mbstring/ucgendat/README index 7717bf89f9804..b5af1b8319320 100644 --- a/ext/mbstring/ucgendat/README +++ b/ext/mbstring/ucgendat/README @@ -3,7 +3,7 @@ This file is not necessary to build PHP. It's only necessary to rebuild unicode_data.h from Unicode ucd files. Example usage: -./ucgendat UnicodeData-6.0.0d7.txt -x CompositionExclusions-6.0.0d2.txt +php ucgendat.php UnicodeData.txt diff --git a/ext/mbstring/ucgendat/ucgendat.c b/ext/mbstring/ucgendat/ucgendat.c deleted file mode 100644 index c0d9b432ba7f9..0000000000000 --- a/ext/mbstring/ucgendat/ucgendat.c +++ /dev/null @@ -1,1999 +0,0 @@ -/* Further modified for PHP */ -/* $Id$ */ - -/* $OpenLDAP: pkg/ldap/libraries/liblunicode/ucdata/ucgendat.c,v 1.36.2.4 2007/01/02 21:43:51 kurt Exp $ */ -/* This work is part of OpenLDAP Software . - * - * Copyright 1998-2007 The OpenLDAP Foundation. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted only as authorized by the OpenLDAP - * Public License. - * - * A copy of this license is available at - * . - */ - -/* 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. - * - * 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 COMPUTING RESEARCH LAB OR NEW MEXICO STATE UNIVERSITY 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. - */ -/* orig Id: ucgendat.c,v 1.4 2001/01/02 18:46:20 mleisher Exp $" */ - -#include -#include -#include -#include -#include - -#define ac_uint2 unsigned short -#define ac_uint4 unsigned int -#define LDAP_DIRSEP "/" -#define AC_MEMCPY memcpy - -#ifndef HARDCODE_DATA -#define HARDCODE_DATA 1 -#endif - -#undef ishdigit -#define ishdigit(cc) (((cc) >= '0' && (cc) <= '9') ||\ - ((cc) >= 'A' && (cc) <= 'F') ||\ - ((cc) >= 'a' && (cc) <= 'f')) - -/* - * A header written to the output file with the byte-order-mark and the number - * of property nodes. - */ -static ac_uint2 hdr[2] = {0xfeff, 0}; - -#define NUMPROPS 50 -#define NEEDPROPS (NUMPROPS + (4 - (NUMPROPS & 3))) - -typedef struct { - char *name; - int len; -} _prop_t; - -/* - * List of properties expected to be found in the Unicode Character Database - * including some implementation specific properties. - * - * The implementation specific properties are: - * Cm = Composed (can be decomposed) - * Nb = Non-breaking - * Sy = Symmetric (has left and right forms) - * Hd = Hex digit - * Qm = Quote marks - * Mr = Mirroring - * Ss = Space, other - * Cp = Defined character - */ -static _prop_t props[NUMPROPS] = { - {"Mn", 2}, {"Mc", 2}, {"Me", 2}, {"Nd", 2}, {"Nl", 2}, {"No", 2}, - {"Zs", 2}, {"Zl", 2}, {"Zp", 2}, {"Cc", 2}, {"Cf", 2}, {"Cs", 2}, - {"Co", 2}, {"Cn", 2}, {"Lu", 2}, {"Ll", 2}, {"Lt", 2}, {"Lm", 2}, - {"Lo", 2}, {"Pc", 2}, {"Pd", 2}, {"Ps", 2}, {"Pe", 2}, {"Po", 2}, - {"Sm", 2}, {"Sc", 2}, {"Sk", 2}, {"So", 2}, {"L", 1}, {"R", 1}, - {"EN", 2}, {"ES", 2}, {"ET", 2}, {"AN", 2}, {"CS", 2}, {"B", 1}, - {"S", 1}, {"WS", 2}, {"ON", 2}, - {"Cm", 2}, {"Nb", 2}, {"Sy", 2}, {"Hd", 2}, {"Qm", 2}, {"Mr", 2}, - {"Ss", 2}, {"Cp", 2}, {"Pi", 2}, {"Pf", 2}, {"AL", 2} -}; - -typedef struct { - ac_uint4 *ranges; - ac_uint2 used; - ac_uint2 size; -} _ranges_t; - -static _ranges_t proptbl[NUMPROPS]; - -/* - * Make sure this array is sized to be on a 4-byte boundary at compile time. - */ -static ac_uint2 propcnt[NEEDPROPS]; - -/* - * Array used to collect a decomposition before adding it to the decomposition - * table. - */ -static ac_uint4 dectmp[64]; -static ac_uint4 dectmp_size; - -typedef struct { - ac_uint4 code; - ac_uint2 size; - ac_uint2 used; - ac_uint4 *decomp; -} _decomp_t; - -/* - * List of decomposition. Created and expanded in order as the characters are - * encountered. First list contains canonical mappings, second also includes - * compatibility mappings. - */ -static _decomp_t *decomps; -static ac_uint4 decomps_used; -static ac_uint4 decomps_size; - -static _decomp_t *kdecomps; -static ac_uint4 kdecomps_used; -static ac_uint4 kdecomps_size; - -/* - * Composition exclusion table stuff. - */ -#define COMPEX_SET(c) (compexs[(c) >> 5] |= (1 << ((c) & 31))) -#define COMPEX_TEST(c) (compexs[(c) >> 5] & (1 << ((c) & 31))) -static ac_uint4 compexs[8192]; - -/* - * Struct for holding a composition pair, and array of composition pairs - */ -typedef struct { - ac_uint4 comp; - ac_uint4 count; - ac_uint4 code1; - ac_uint4 code2; -} _comp_t; - -#if 0 -static _comp_t *comps; -#endif -static ac_uint4 comps_used; - -/* - * Types and lists for handling lists of case mappings. - */ -typedef struct { - ac_uint4 key; - ac_uint4 other1; - ac_uint4 other2; -} _case_t; - -static _case_t *upper; -static _case_t *lower; -static _case_t *title; -static ac_uint4 upper_used; -static ac_uint4 upper_size; -static ac_uint4 lower_used; -static ac_uint4 lower_size; -static ac_uint4 title_used; -static ac_uint4 title_size; - -/* - * Array used to collect case mappings before adding them to a list. - */ -static ac_uint4 cases[3]; - -/* - * An array to hold ranges for combining classes. - */ -static ac_uint4 *ccl; -static ac_uint4 ccl_used; -static ac_uint4 ccl_size; - -/* - * Structures for handling numbers. - */ -typedef struct { - ac_uint4 code; - ac_uint4 idx; -} _codeidx_t; - -typedef struct { - short numerator; - short denominator; -} _num_t; - -/* - * Arrays to hold the mapping of codes to numbers. - */ -static _codeidx_t *ncodes; -static ac_uint4 ncodes_used; -static ac_uint4 ncodes_size; - -static _num_t *nums; -static ac_uint4 nums_used; -static ac_uint4 nums_size; - -/* - * Array for holding numbers. - */ -static _num_t *nums; -static ac_uint4 nums_used; -static ac_uint4 nums_size; - -static void -add_range(ac_uint4 start, ac_uint4 end, char *p1, char *p2) -{ - int i, j, k, len; - _ranges_t *rlp; - char *name; - - for (k = 0; k < 2; k++) { - if (k == 0) { - name = p1; - len = 2; - } else { - if (p2 == 0) - break; - - name = p2; - len = 1; - } - - for (i = 0; i < NUMPROPS; i++) { - if (props[i].len == len && memcmp(props[i].name, name, len) == 0) - break; - } - - if (i == NUMPROPS) - continue; - - rlp = &proptbl[i]; - - /* - * Resize the range list if necessary. - */ - if (rlp->used == rlp->size) { - if (rlp->size == 0) - rlp->ranges = (ac_uint4 *) - malloc(sizeof(ac_uint4) << 3); - else - rlp->ranges = (ac_uint4 *) - realloc((char *) rlp->ranges, - sizeof(ac_uint4) * (rlp->size + 8)); - rlp->size += 8; - } - - /* - * If this is the first code for this property list, just add it - * and return. - */ - if (rlp->used == 0) { - rlp->ranges[0] = start; - rlp->ranges[1] = end; - rlp->used += 2; - continue; - } - - /* - * Optimize the case of adding the range to the end. - */ - j = rlp->used - 1; - if (start > rlp->ranges[j]) { - j = rlp->used; - rlp->ranges[j++] = start; - rlp->ranges[j++] = end; - rlp->used = j; - continue; - } - - /* - * Need to locate the insertion point. - */ - for (i = 0; - i < rlp->used && start > rlp->ranges[i + 1] + 1; i += 2) ; - - /* - * If the start value lies in the current range, then simply set the - * new end point of the range to the end value passed as a parameter. - */ - if (rlp->ranges[i] <= start && start <= rlp->ranges[i + 1] + 1) { - rlp->ranges[i + 1] = end; - return; - } - - /* - * Shift following values up by two. - */ - for (j = rlp->used; j > i; j -= 2) { - rlp->ranges[j] = rlp->ranges[j - 2]; - rlp->ranges[j + 1] = rlp->ranges[j - 1]; - } - - /* - * Add the new range at the insertion point. - */ - rlp->ranges[i] = start; - rlp->ranges[i + 1] = end; - rlp->used += 2; - } -} - -static void -ordered_range_insert(ac_uint4 c, char *name, int len) -{ - int i, j; - ac_uint4 s, e; - _ranges_t *rlp; - - if (len == 0) - return; - - /* - * Deal with directionality codes introduced in Unicode 3.0. - */ - if ((len == 2 && memcmp(name, "BN", 2) == 0) || - (len == 3 && - (memcmp(name, "NSM", 3) == 0 || memcmp(name, "PDF", 3) == 0 || - memcmp(name, "LRE", 3) == 0 || memcmp(name, "LRO", 3) == 0 || - memcmp(name, "RLE", 3) == 0 || memcmp(name, "RLO", 3) == 0 || - memcmp(name, "LRI", 3) == 0 || memcmp(name, "RLI", 3) == 0 || - memcmp(name, "FSI", 3) == 0 || memcmp(name, "PDI", 3) == 0))) { - /* - * Mark all of these as Other Neutral to preserve compatibility with - * older versions. - */ - len = 2; - name = "ON"; - } - - for (i = 0; i < NUMPROPS; i++) { - if (props[i].len == len && memcmp(props[i].name, name, len) == 0) - break; - } - - if (i == NUMPROPS) { - printf("Unknown property %s\n", name); - return; - } - - /* - * Have a match, so insert the code in order. - */ - rlp = &proptbl[i]; - - /* - * Resize the range list if necessary. - */ - if (rlp->used == rlp->size) { - if (rlp->size == 0) - rlp->ranges = (ac_uint4 *) - malloc(sizeof(ac_uint4) << 3); - else - rlp->ranges = (ac_uint4 *) - realloc((char *) rlp->ranges, - sizeof(ac_uint4) * (rlp->size + 8)); - rlp->size += 8; - } - - /* - * If this is the first code for this property list, just add it - * and return. - */ - if (rlp->used == 0) { - rlp->ranges[0] = rlp->ranges[1] = c; - rlp->used += 2; - return; - } - - /* - * Optimize the cases of extending the last range and adding new ranges to - * the end. - */ - j = rlp->used - 1; - e = rlp->ranges[j]; - s = rlp->ranges[j - 1]; - - if (c == e + 1) { - /* - * Extend the last range. - */ - rlp->ranges[j] = c; - return; - } - - if (c > e + 1) { - /* - * Start another range on the end. - */ - j = rlp->used; - rlp->ranges[j] = rlp->ranges[j + 1] = c; - rlp->used += 2; - return; - } - - if (c >= s) - /* - * The code is a duplicate of a code in the last range, so just return. - */ - return; - - /* - * The code should be inserted somewhere before the last range in the - * list. Locate the insertion point. - */ - for (i = 0; - i < rlp->used && c > rlp->ranges[i + 1] + 1; i += 2) ; - - s = rlp->ranges[i]; - e = rlp->ranges[i + 1]; - - if (c == e + 1) - /* - * Simply extend the current range. - */ - rlp->ranges[i + 1] = c; - else if (c < s) { - /* - * Add a new entry before the current location. Shift all entries - * before the current one up by one to make room. - */ - for (j = rlp->used; j > i; j -= 2) { - rlp->ranges[j] = rlp->ranges[j - 2]; - rlp->ranges[j + 1] = rlp->ranges[j - 1]; - } - rlp->ranges[i] = rlp->ranges[i + 1] = c; - - rlp->used += 2; - } -} - -static void -add_decomp(ac_uint4 code, short compat) -{ - ac_uint4 i, j, size; - _decomp_t **pdecomps; - ac_uint4 *pdecomps_used; - ac_uint4 *pdecomps_size; - - if (compat) { - pdecomps = &kdecomps; - pdecomps_used = &kdecomps_used; - pdecomps_size = &kdecomps_size; - } else { - pdecomps = &decomps; - pdecomps_used = &decomps_used; - pdecomps_size = &decomps_size; - } - - /* - * Add the code to the composite property. - */ - if (!compat) { - ordered_range_insert(code, "Cm", 2); - } - - /* - * Locate the insertion point for the code. - */ - for (i = 0; i < *pdecomps_used && code > (*pdecomps)[i].code; i++) ; - - /* - * Allocate space for a new decomposition. - */ - if (*pdecomps_used == *pdecomps_size) { - if (*pdecomps_size == 0) - *pdecomps = (_decomp_t *) malloc(sizeof(_decomp_t) << 3); - else - *pdecomps = (_decomp_t *) - realloc((char *) *pdecomps, - sizeof(_decomp_t) * (*pdecomps_size + 8)); - (void) memset((char *) (*pdecomps + *pdecomps_size), '\0', - sizeof(_decomp_t) << 3); - *pdecomps_size += 8; - } - - if (i < *pdecomps_used && code != (*pdecomps)[i].code) { - /* - * Shift the decomps up by one if the codes don't match. - */ - for (j = *pdecomps_used; j > i; j--) - (void) AC_MEMCPY((char *) &(*pdecomps)[j], (char *) &(*pdecomps)[j - 1], - sizeof(_decomp_t)); - } - - /* - * Insert or replace a decomposition. - */ - size = dectmp_size + (4 - (dectmp_size & 3)); - if ((*pdecomps)[i].size < size) { - if ((*pdecomps)[i].size == 0) - (*pdecomps)[i].decomp = (ac_uint4 *) - malloc(sizeof(ac_uint4) * size); - else - (*pdecomps)[i].decomp = (ac_uint4 *) - realloc((char *) (*pdecomps)[i].decomp, - sizeof(ac_uint4) * size); - (*pdecomps)[i].size = size; - } - - if ((*pdecomps)[i].code != code) - (*pdecomps_used)++; - - (*pdecomps)[i].code = code; - (*pdecomps)[i].used = dectmp_size; - (void) AC_MEMCPY((char *) (*pdecomps)[i].decomp, (char *) dectmp, - sizeof(ac_uint4) * dectmp_size); - - /* - * NOTICE: This needs changing later so it is more general than simply - * pairs. This calculation is done here to simplify allocation elsewhere. - */ - if (!compat && dectmp_size == 2) - comps_used++; -} - -static void -add_title(ac_uint4 code) -{ - ac_uint4 i, j; - - /* - * Always map the code to itself. - */ - cases[2] = code; - - /* If lower/upper case does not exist, stay the same */ - if (!cases[0]) cases[0] = code; - if (!cases[1]) cases[1] = code; - - if (title_used == title_size) { - if (title_size == 0) - title = (_case_t *) malloc(sizeof(_case_t) << 3); - else - title = (_case_t *) realloc((char *) title, - sizeof(_case_t) * (title_size + 8)); - title_size += 8; - } - - /* - * Locate the insertion point. - */ - for (i = 0; i < title_used && code > title[i].key; i++) ; - - if (i < title_used) { - /* - * Shift the array up by one. - */ - for (j = title_used; j > i; j--) - (void) AC_MEMCPY((char *) &title[j], (char *) &title[j - 1], - sizeof(_case_t)); - } - - title[i].key = cases[2]; /* Title */ - title[i].other1 = cases[0]; /* Upper */ - title[i].other2 = cases[1]; /* Lower */ - - title_used++; -} - -static void -add_upper(ac_uint4 code) -{ - ac_uint4 i, j; - - /* - * Always map the code to itself. - */ - cases[0] = code; - - /* - * If the title case character is not present, then make it the same as - * the upper case. - */ - if (cases[2] == 0) - cases[2] = code; - - if (upper_used == upper_size) { - if (upper_size == 0) - upper = (_case_t *) malloc(sizeof(_case_t) << 3); - else - upper = (_case_t *) realloc((char *) upper, - sizeof(_case_t) * (upper_size + 8)); - upper_size += 8; - } - - /* - * Locate the insertion point. - */ - for (i = 0; i < upper_used && code > upper[i].key; i++) ; - - if (i < upper_used) { - /* - * Shift the array up by one. - */ - for (j = upper_used; j > i; j--) - (void) AC_MEMCPY((char *) &upper[j], (char *) &upper[j - 1], - sizeof(_case_t)); - } - - upper[i].key = cases[0]; /* Upper */ - upper[i].other1 = cases[1]; /* Lower */ - upper[i].other2 = cases[2]; /* Title */ - - upper_used++; -} - -static void -add_lower(ac_uint4 code) -{ - ac_uint4 i, j; - - /* - * Always map the code to itself. - */ - cases[1] = code; - - /* - * If the title case character is empty, then make it the same as the - * upper case. - */ - if (cases[2] == 0) - cases[2] = cases[0]; - - if (lower_used == lower_size) { - if (lower_size == 0) - lower = (_case_t *) malloc(sizeof(_case_t) << 3); - else - lower = (_case_t *) realloc((char *) lower, - sizeof(_case_t) * (lower_size + 8)); - lower_size += 8; - } - - /* - * Locate the insertion point. - */ - for (i = 0; i < lower_used && code > lower[i].key; i++) ; - - if (i < lower_used) { - /* - * Shift the array up by one. - */ - for (j = lower_used; j > i; j--) - (void) AC_MEMCPY((char *) &lower[j], (char *) &lower[j - 1], - sizeof(_case_t)); - } - - lower[i].key = cases[1]; /* Lower */ - lower[i].other1 = cases[0]; /* Upper */ - lower[i].other2 = cases[2]; /* Title */ - - lower_used++; -} - -static void -ordered_ccl_insert(ac_uint4 c, ac_uint4 ccl_code) -{ - ac_uint4 i, j; - - if (ccl_used == ccl_size) { - if (ccl_size == 0) - ccl = (ac_uint4 *) malloc(sizeof(ac_uint4) * 24); - else - ccl = (ac_uint4 *) - realloc((char *) ccl, sizeof(ac_uint4) * (ccl_size + 24)); - ccl_size += 24; - } - - /* - * Optimize adding the first item. - */ - if (ccl_used == 0) { - ccl[0] = ccl[1] = c; - ccl[2] = ccl_code; - ccl_used += 3; - return; - } - - /* - * Handle the special case of extending the range on the end. This - * requires that the combining class codes are the same. - */ - if (ccl_code == ccl[ccl_used - 1] && c == ccl[ccl_used - 2] + 1) { - ccl[ccl_used - 2] = c; - return; - } - - /* - * Handle the special case of adding another range on the end. - */ - if (c > ccl[ccl_used - 2] + 1 || - (c == ccl[ccl_used - 2] + 1 && ccl_code != ccl[ccl_used - 1])) { - ccl[ccl_used++] = c; - ccl[ccl_used++] = c; - ccl[ccl_used++] = ccl_code; - return; - } - - /* - * Locate either the insertion point or range for the code. - */ - for (i = 0; i < ccl_used && c > ccl[i + 1] + 1; i += 3) ; - - if (ccl_code == ccl[i + 2] && c == ccl[i + 1] + 1) { - /* - * Extend an existing range. - */ - ccl[i + 1] = c; - return; - } else if (c < ccl[i]) { - /* - * Start a new range before the current location. - */ - for (j = ccl_used; j > i; j -= 3) { - ccl[j] = ccl[j - 3]; - ccl[j - 1] = ccl[j - 4]; - ccl[j - 2] = ccl[j - 5]; - } - ccl[i] = ccl[i + 1] = c; - ccl[i + 2] = ccl_code; - } -} - -/* - * Adds a number if it does not already exist and returns an index value - * multiplied by 2. - */ -static ac_uint4 -make_number(short num, short denom) -{ - ac_uint4 n; - - /* - * Determine if the number already exists. - */ - for (n = 0; n < nums_used; n++) { - if (nums[n].numerator == num && nums[n].denominator == denom) - return n << 1; - } - - if (nums_used == nums_size) { - if (nums_size == 0) - nums = (_num_t *) malloc(sizeof(_num_t) << 3); - else - nums = (_num_t *) realloc((char *) nums, - sizeof(_num_t) * (nums_size + 8)); - nums_size += 8; - } - - n = nums_used++; - nums[n].numerator = num; - nums[n].denominator = denom; - - return n << 1; -} - -static void -add_number(ac_uint4 code, short num, short denom) -{ - ac_uint4 i, j; - - /* - * Insert the code in order. - */ - for (i = 0; i < ncodes_used && code > ncodes[i].code; i++) ; - - /* - * Handle the case of the codes matching and simply replace the number - * that was there before. - */ - if (i < ncodes_used && code == ncodes[i].code) { - ncodes[i].idx = make_number(num, denom); - return; - } - - /* - * Resize the array if necessary. - */ - if (ncodes_used == ncodes_size) { - if (ncodes_size == 0) - ncodes = (_codeidx_t *) malloc(sizeof(_codeidx_t) << 3); - else - ncodes = (_codeidx_t *) - realloc((char *) ncodes, sizeof(_codeidx_t) * (ncodes_size + 8)); - - ncodes_size += 8; - } - - /* - * Shift things around to insert the code if necessary. - */ - if (i < ncodes_used) { - for (j = ncodes_used; j > i; j--) { - ncodes[j].code = ncodes[j - 1].code; - ncodes[j].idx = ncodes[j - 1].idx; - } - } - ncodes[i].code = code; - ncodes[i].idx = make_number(num, denom); - - ncodes_used++; -} - -/* - * This routine assumes that the line is a valid Unicode Character Database - * entry. - */ -static void -read_cdata(FILE *in) -{ - ac_uint4 i, lineno, skip, code, ccl_code; - short wnum, neg, number[2], compat; - char line[512], *s, *e; - - lineno = skip = 0; - while (fgets(line, sizeof(line), in)) { - int is_title = 0; - - if( (s=strchr(line, '\n')) ) *s = '\0'; - lineno++; - - /* - * Skip blank lines and lines that start with a '#'. - */ - if (line[0] == 0 || line[0] == '#') - continue; - - /* - * If lines need to be skipped, do it here. - */ - if (skip) { - skip--; - continue; - } - - /* - * Collect the code. The code can be up to 6 hex digits in length to - * allow surrogates to be specified. - */ - for (s = line, i = code = 0; *s != ';' && i < 6; i++, s++) { - code <<= 4; - if (*s >= '0' && *s <= '9') - code += *s - '0'; - else if (*s >= 'A' && *s <= 'F') - code += (*s - 'A') + 10; - else if (*s >= 'a' && *s <= 'f') - code += (*s - 'a') + 10; - } - - /* - * Handle the following special cases: - * 1. 4E00-9FA5 CJK Ideographs. - * 2. AC00-D7A3 Hangul Syllables. - * 3. D800-DFFF Surrogates. - * 4. E000-F8FF Private Use Area. - * 5. F900-FA2D Han compatibility. - * ...Plus additional ranges in newer Unicode versions... - */ - switch (code) { - case 0x3400: - /* CJK Ideograph Extension A */ - add_range(0x3400, 0x4db5, "Lo", "L"); - - add_range(0x3400, 0x4db5, "Cp", 0); - - skip = 1; - break; - case 0x4e00: - /* - * The Han ideographs. - */ - add_range(0x4e00, 0x9fff, "Lo", "L"); - - /* - * Add the characters to the defined category. - */ - add_range(0x4e00, 0x9fa5, "Cp", 0); - - skip = 1; - break; - case 0xac00: - /* - * The Hangul syllables. - */ - add_range(0xac00, 0xd7a3, "Lo", "L"); - - /* - * Add the characters to the defined category. - */ - add_range(0xac00, 0xd7a3, "Cp", 0); - - skip = 1; - break; - case 0xd800: - /* - * Make a range of all surrogates and assume some default - * properties. - */ - add_range(0x010000, 0x10ffff, "Cs", "L"); - skip = 5; - break; - case 0xe000: - /* - * The Private Use area. Add with a default set of properties. - */ - add_range(0xe000, 0xf8ff, "Co", "L"); - skip = 1; - break; - case 0xf900: - /* - * The CJK compatibility area. - */ - add_range(0xf900, 0xfaff, "Lo", "L"); - - /* - * Add the characters to the defined category. - */ - add_range(0xf900, 0xfaff, "Cp", 0); - - skip = 1; - break; - case 0x20000: - /* CJK Ideograph Extension B */ - add_range(0x20000, 0x2a6d6, "Lo", "L"); - - add_range(0x20000, 0x2a6d6, "Cp", 0); - - skip = 1; - break; - case 0xf0000: - /* Plane 15 private use */ - add_range(0xf0000, 0xffffd, "Co", "L"); - skip = 1; - break; - - case 0x100000: - /* Plane 16 private use */ - add_range(0x100000, 0x10fffd, "Co", "L"); - skip = 1; - break; - } - - if (skip) - continue; - - /* - * Add the code to the defined category. - */ - ordered_range_insert(code, "Cp", 2); - - /* - * Locate the first character property field. - */ - for (i = 0; *s != 0 && i < 2; s++) { - if (*s == ';') - i++; - } - for (e = s; *e && *e != ';'; e++) ; - - ordered_range_insert(code, s, e - s); - - if (e - s == 2 && s[0] == 'L' && s[1] == 't') { - is_title = 1; - } - - /* - * Locate the combining class code. - */ - for (s = e; *s != 0 && i < 3; s++) { - if (*s == ';') - i++; - } - - /* - * Convert the combining class code from decimal. - */ - for (ccl_code = 0, e = s; *e && *e != ';'; e++) - ccl_code = (ccl_code * 10) + (*e - '0'); - - /* - * Add the code if it not 0. - */ - if (ccl_code != 0) - ordered_ccl_insert(code, ccl_code); - - /* - * Locate the second character property field. - */ - for (s = e; *s != 0 && i < 4; s++) { - if (*s == ';') - i++; - } - for (e = s; *e && *e != ';'; e++) ; - - ordered_range_insert(code, s, e - s); - - /* - * Check for a decomposition. - */ - s = ++e; - if (*s != ';') { - compat = *s == '<'; - if (compat) { - /* - * Skip compatibility formatting tag. - */ - while (*s++ != '>'); - } - /* - * Collect the codes of the decomposition. - */ - for (dectmp_size = 0; *s != ';'; ) { - /* - * Skip all leading non-hex digits. - */ - while (!ishdigit(*s)) - s++; - - for (dectmp[dectmp_size] = 0; ishdigit(*s); s++) { - dectmp[dectmp_size] <<= 4; - if (*s >= '0' && *s <= '9') - dectmp[dectmp_size] += *s - '0'; - else if (*s >= 'A' && *s <= 'F') - dectmp[dectmp_size] += (*s - 'A') + 10; - else if (*s >= 'a' && *s <= 'f') - dectmp[dectmp_size] += (*s - 'a') + 10; - } - dectmp_size++; - } - - /* - * If there are any codes in the temporary decomposition array, - * then add the character with its decomposition. - */ - if (dectmp_size > 0) { - if (!compat) { - add_decomp(code, 0); - } - add_decomp(code, 1); - } - } - - /* - * Skip to the number field. - */ - for (i = 0; i < 3 && *s; s++) { - if (*s == ';') - i++; - } - - /* - * Scan the number in. - */ - number[0] = number[1] = 0; - for (e = s, neg = wnum = 0; *e && *e != ';'; e++) { - if (*e == '-') { - neg = 1; - continue; - } - - if (*e == '/') { - /* - * Move the denominator of the fraction. - */ - if (neg) - number[wnum] *= -1; - neg = 0; - e++; - wnum++; - } - number[wnum] = (number[wnum] * 10) + (*e - '0'); - } - - if (e > s) { - /* - * Adjust the denominator in case of integers and add the number. - */ - if (wnum == 0) - number[1] = 1; - - add_number(code, number[0], number[1]); - } - - /* - * Skip to the start of the possible case mappings. - */ - for (s = e, i = 0; i < 4 && *s; s++) { - if (*s == ';') - i++; - } - - /* - * Collect the case mappings. - */ - cases[0] = cases[1] = cases[2] = 0; - for (i = 0; i < 3; i++) { - while (ishdigit(*s)) { - cases[i] <<= 4; - if (*s >= '0' && *s <= '9') - cases[i] += *s - '0'; - else if (*s >= 'A' && *s <= 'F') - cases[i] += (*s - 'A') + 10; - else if (*s >= 'a' && *s <= 'f') - cases[i] += (*s - 'a') + 10; - s++; - } - if (*s == ';') - s++; - } - if (is_title) - /* - * Add the upper and lower mappings for a title case character. - */ - add_title(code); - else if (cases[1]) - /* - * Add the lower and title case mappings for the upper case - * character. - */ - add_upper(code); - else if (cases[0]) - /* - * Add the upper and title case mappings for the lower case - * character. - */ - add_lower(code); - } -} - -#if 0 - -static _decomp_t * -find_decomp(ac_uint4 code, short compat) -{ - long l, r, m; - _decomp_t *decs; - - l = 0; - r = (compat ? kdecomps_used : decomps_used) - 1; - decs = compat ? kdecomps : decomps; - while (l <= r) { - m = (l + r) >> 1; - if (code > decs[m].code) - l = m + 1; - else if (code < decs[m].code) - r = m - 1; - else - return &decs[m]; - } - return 0; -} - -static void -decomp_it(_decomp_t *d, short compat) -{ - ac_uint4 i; - _decomp_t *dp; - - for (i = 0; i < d->used; i++) { - if ((dp = find_decomp(d->decomp[i], compat)) != 0) - decomp_it(dp, compat); - else - dectmp[dectmp_size++] = d->decomp[i]; - } -} - - -/* - * Expand all decompositions by recursively decomposing each character - * in the decomposition. - */ -static void -expand_decomp(void) -{ - ac_uint4 i; - - for (i = 0; i < decomps_used; i++) { - dectmp_size = 0; - decomp_it(&decomps[i], 0); - if (dectmp_size > 0) - add_decomp(decomps[i].code, 0); - } - - for (i = 0; i < kdecomps_used; i++) { - dectmp_size = 0; - decomp_it(&kdecomps[i], 1); - if (dectmp_size > 0) - add_decomp(kdecomps[i].code, 1); - } -} - -static int -cmpcomps(const void *v_comp1, const void *v_comp2) -{ - const _comp_t *comp1 = v_comp1, *comp2 = v_comp2; - long diff = comp1->code1 - comp2->code1; - - if (!diff) - diff = comp1->code2 - comp2->code2; - return (int) diff; -} - -#endif - -/* - * Load composition exclusion data - */ -static void -read_compexdata(FILE *in) -{ - ac_uint2 i; - ac_uint4 code; - char line[512], *s; - - (void) memset((char *) compexs, 0, sizeof(compexs)); - - while (fgets(line, sizeof(line), in)) { - if( (s=strchr(line, '\n')) ) *s = '\0'; - /* - * Skip blank lines and lines that start with a '#'. - */ - if (line[0] == 0 || line[0] == '#') - continue; - - /* - * Collect the code. Assume max 6 digits - */ - - for (s = line, i = code = 0; *s != '#' && i < 6; i++, s++) { - if (isspace((unsigned char)*s)) break; - code <<= 4; - if (*s >= '0' && *s <= '9') - code += *s - '0'; - else if (*s >= 'A' && *s <= 'F') - code += (*s - 'A') + 10; - else if (*s >= 'a' && *s <= 'f') - code += (*s - 'a') + 10; - } - COMPEX_SET(code); - } -} - -#if 0 - -/* - * Creates array of compositions from decomposition array - */ -static void -create_comps(void) -{ - ac_uint4 i, cu; - - comps = (_comp_t *) malloc(comps_used * sizeof(_comp_t)); - - for (i = cu = 0; i < decomps_used; i++) { - if (decomps[i].used != 2 || COMPEX_TEST(decomps[i].code)) - continue; - comps[cu].comp = decomps[i].code; - comps[cu].count = 2; - comps[cu].code1 = decomps[i].decomp[0]; - comps[cu].code2 = decomps[i].decomp[1]; - cu++; - } - comps_used = cu; - qsort(comps, comps_used, sizeof(_comp_t), cmpcomps); -} - -#endif - -#if HARDCODE_DATA -static void -write_case(FILE *out, _case_t *tab, int num, int first) -{ - int i; - - for (i=0; i 0) { - for (j=0; j 0) - fwrite((char *) proptbl[i].ranges, sizeof(ac_uint4), - proptbl[i].used, out); - } - - fclose(out); -#endif - - /***************************************************************** - * - * Generate the case mapping data. - * - *****************************************************************/ - -#if HARDCODE_DATA - fprintf(out, PREF "unsigned int _uccase_size = %ld;\n\n", - (long) (upper_used + lower_used + title_used)); - - fprintf(out, - "/* Starting indexes of the case tables\n" - " * UpperIndex = 0\n" - " * LowerIndex = _uccase_len[0]\n" - " * TitleIndex = LowerIndex + _uccase_len[1] */\n\n"); - fprintf(out, PREF "unsigned short _uccase_len[2] = {%ld, %ld};\n\n", - (long) upper_used, (long) lower_used); - fprintf(out, PREF "unsigned int _uccase_map[] = {"); - - if (upper_used > 0) - /* - * Write the upper case table. - */ - write_case(out, upper, upper_used, 1); - - if (lower_used > 0) - /* - * Write the lower case table. - */ - write_case(out, lower, lower_used, !upper_used); - - if (title_used > 0) - /* - * Write the title case table. - */ - write_case(out, title, title_used, !(upper_used||lower_used)); - - if (!(upper_used || lower_used || title_used)) - fprintf(out, "\t0"); - - fprintf(out, "\n};\n\n"); -#else - /* - * Open the case.dat file. - */ - snprintf(path, sizeof path, "%s" LDAP_DIRSEP "case.dat", opath); - if ((out = fopen(path, "wb")) == 0) - return; - - /* - * Write the case mapping tables. - */ - hdr[1] = upper_used + lower_used + title_used; - casecnt[0] = upper_used; - casecnt[1] = lower_used; - - /* - * Write the header. - */ - fwrite((char *) hdr, sizeof(ac_uint2), 2, out); - - /* - * Write the upper and lower case table sizes. - */ - fwrite((char *) casecnt, sizeof(ac_uint2), 2, out); - - if (upper_used > 0) - /* - * Write the upper case table. - */ - fwrite((char *) upper, sizeof(_case_t), upper_used, out); - - if (lower_used > 0) - /* - * Write the lower case table. - */ - fwrite((char *) lower, sizeof(_case_t), lower_used, out); - - if (title_used > 0) - /* - * Write the title case table. - */ - fwrite((char *) title, sizeof(_case_t), title_used, out); - - fclose(out); -#endif - -#if 0 - - /***************************************************************** - * - * Generate the composition data. - * - *****************************************************************/ - - /* - * Create compositions from decomposition data - */ - create_comps(); - -#if HARDCODE_DATA - fprintf(out, PREF "ac_uint4 _uccomp_size = %ld;\n\n", - comps_used * 4L); - - fprintf(out, PREF "ac_uint4 _uccomp_data[] = {"); - - /* - * Now, if comps exist, write them out. - */ - if (comps_used > 0) { - for (i=0; i 0) - fwrite((char *) comps, sizeof(_comp_t), comps_used, out); - - fclose(out); -#endif - - /***************************************************************** - * - * Generate the decomposition data. - * - *****************************************************************/ - - /* - * Fully expand all decompositions before generating the output file. - */ - expand_decomp(); - -#if HARDCODE_DATA - fprintf(out, PREF "ac_uint4 _ucdcmp_size = %ld;\n\n", - decomps_used * 2L); - - fprintf(out, PREF "ac_uint4 _ucdcmp_nodes[] = {"); - - if (decomps_used) { - /* - * Write the list of decomp nodes. - */ - for (i = idx = 0; i < decomps_used; i++) { - fprintf(out, "\n\t0x%08lx, 0x%08lx,", - (unsigned long) decomps[i].code, (unsigned long) idx); - idx += decomps[i].used; - } - - /* - * Write the sentinel index as the last decomp node. - */ - fprintf(out, "\n\t0x%08lx\n};\n\n", (unsigned long) idx); - - fprintf(out, PREF "ac_uint4 _ucdcmp_decomp[] = {"); - /* - * Write the decompositions themselves. - */ - k = 0; - for (i = 0; i < decomps_used; i++) - for (j=0; j 0) { - /* - * Write the combining class ranges out. - */ - for (i = 0; i 0) - /* - * Write the combining class ranges out. - */ - fwrite((char *) ccl, sizeof(ac_uint4), ccl_used, out); - - fclose(out); -#endif - - /***************************************************************** - * - * Generate the number data. - * - *****************************************************************/ - -#if HARDCODE_DATA - fprintf(out, PREF "ac_uint4 _ucnum_size = %lu;\n\n", - (unsigned long)ncodes_used<<1); - - fprintf(out, PREF "ac_uint4 _ucnum_nodes[] = {"); - - /* - * Now, if number mappings exist, write them out. - */ - if (ncodes_used > 0) { - for (i = 0; i 0) { - fwrite((char *) ncodes, sizeof(_codeidx_t), ncodes_used, out); - fwrite((char *) nums, sizeof(_num_t), nums_used, out); - } -#endif - -#endif - - fclose(out); -} - -static void -usage(char *prog) -{ - fprintf(stderr, - "Usage: %s [-o output-directory|-x composition-exclusions]", prog); - fprintf(stderr, " datafile1 datafile2 ...\n\n"); - fprintf(stderr, - "-o output-directory\n\t\tWrite the output files to a different"); - fprintf(stderr, " directory (default: .).\n"); - fprintf(stderr, - "-x composition-exclusion\n\t\tFile of composition codes"); - fprintf(stderr, " that should be excluded.\n"); - exit(1); -} - -int -main(int argc, char *argv[]) -{ - FILE *in; - char *prog, *opath; - - prog = argv[1]; - - opath = 0; - in = stdin; - - argc--; - argv++; - - while (argc > 0) { - if (argv[0][0] == '-') { - switch (argv[0][1]) { - case 'o': - argc--; - argv++; - opath = argv[0]; - break; - case 'x': - argc--; - argv++; - if ((in = fopen(argv[0], "r")) == 0) - fprintf(stderr, - "%s: unable to open composition exclusion file %s\n", - prog, argv[0]); - else { - read_compexdata(in); - fclose(in); - in = 0; - } - break; - default: - usage(prog); - } - } else { - if (in != stdin && in != NULL) - fclose(in); - if ((in = fopen(argv[0], "r")) == 0) - fprintf(stderr, "%s: unable to open ctype file %s\n", - prog, argv[0]); - else { - read_cdata(in); - fclose(in); - in = 0; - } - } - argc--; - argv++; - } - - if (opath == 0) - opath = "."; - write_cdata(opath); - - return 0; -} diff --git a/ext/mbstring/ucgendat/ucgendat.php b/ext/mbstring/ucgendat/ucgendat.php new file mode 100644 index 0000000000000..556a8cf98f7ad --- /dev/null +++ b/ext/mbstring/ucgendat/ucgendat.php @@ -0,0 +1,641 @@ +. + */ + +/* 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. + * + * 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 COMPUTING RESEARCH LAB OR NEW MEXICO STATE UNIVERSITY 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. + */ + +if ($argc < 2) { + echo "Usage: php ucgendata.php ./datadir\n"; + echo "./datadir must contain:\n"; + echo "UnicodeData.txt, CaseFolding.txt, SpecialCasing.txt and DerivedCoreProperties.txt\n"; + return; +} + +$dir = $argv[1]; +$unicodeDataFile = $dir . '/UnicodeData.txt'; +$caseFoldingFile = $dir . '/CaseFolding.txt'; +$specialCasingFile = $dir . '/SpecialCasing.txt'; +$derivedCorePropertiesFile = $dir . '/DerivedCoreProperties.txt'; + +$files = [$unicodeDataFile, $caseFoldingFile, $specialCasingFile, $derivedCorePropertiesFile]; +foreach ($files as $file) { + if (!file_exists($file)) { + echo "File $file does not exist.\n"; + return; + } +} + +$outputFile = __DIR__ . "/../unicode_data.h"; + +$data = new UnicodeData; +parseUnicodeData($data, file_get_contents($unicodeDataFile)); +parseCaseFolding($data, file_get_contents($caseFoldingFile)); +parseSpecialCasing($data, file_get_contents($specialCasingFile)); +parseDerivedCoreProperties($data, file_get_contents($derivedCorePropertiesFile)); +file_put_contents($outputFile, generateData($data)); + +class Range { + public $start; + public $end; + + public function __construct(int $start, int $end) { + $this->start = $start; + $this->end = $end; + } +} + +class UnicodeData { + public $propIndexes; + public $numProps; + public $propRanges; + public $caseMaps; + public $extraCaseData; + + public function __construct() { + /* + * List of properties expected to be found in the Unicode Character Database. + */ + $this->propIndexes = array_flip([ + "Mn", "Mc", "Me", "Nd", "Nl", "No", + "Zs", "Zl", "Zp", "Cc", "Cf", "Cs", + "Co", "Cn", "Lu", "Ll", "Lt", "Lm", + "Lo", "Pc", "Pd", "Ps", "Pe", "Po", + "Sm", "Sc", "Sk", "So", "L", "R", + "EN", "ES", "ET", "AN", "CS", "B", + "S", "WS", "ON", "Pi", "Pf", "AL", + "Cased", "Case_Ignorable" + ]); + $this->numProps = count($this->propIndexes); + + $this->propRanges = array_fill(0, $this->numProps, []); + $this->caseMaps = [ + 'upper' => [], + 'lower' => [], + 'title' => [], + 'fold' => [], + ]; + $this->extraCaseData = []; + } + + function propToIndex(string $prop) : int { + /* Deal with directionality codes introduced in Unicode 3.0. */ + if (in_array($prop, ["BN", "NSM", "PDF", "LRE", "LRO", "RLE", "RLO", "LRI", "RLI", "FSI", "PDI"])) { + /* + * Mark all of these as Other Neutral to preserve compatibility with + * older versions. + */ + $prop = "ON"; + } + + if (!isset($this->propIndexes[$prop])) { + throw new Exception("Unknown property $prop"); + } + + return $this->propIndexes[$prop]; + } + + public function addProp(int $code, string $prop) { + $propIdx = self::propToIndex($prop); + + // Check if this extends the last range + $ranges = $this->propRanges[$propIdx]; + if (!empty($ranges)) { + $lastRange = $ranges[count($ranges) - 1]; + if ($code === $lastRange->end + 1) { + $lastRange->end++; + return; + } + } + + $this->propRanges[$propIdx][] = new Range($code, $code); + } + + public function addPropRange(int $startCode, int $endCode, string $prop) { + $propIdx = self::propToIndex($prop); + $this->propRanges[$propIdx][] = new Range($startCode, $endCode); + } + + public function addCaseMapping(string $case, int $origCode, int $mappedCode) { + $this->caseMaps[$case][$origCode] = $mappedCode; + } + + public function compactRangeArray(array $ranges) : array { + // Sort by start codepoint + usort($ranges, function (Range $r1, Range $r2) { + return $r1->start <=> $r2->start; + }); + + $lastRange = new Range(-1, -1); + $newRanges = []; + foreach ($ranges as $range) { + if ($lastRange->end == -1) { + $lastRange = $range; + } else if ($range->start == $lastRange->end + 1) { + $lastRange->end = $range->end; + } else if ($range->start > $lastRange->end + 1) { + $newRanges[] = $lastRange; + $lastRange = $range; + } else { + throw new Exception(sprintf( + "Overlapping ranges [%x, %x] and [%x, %x]", + $lastRange->start, $lastRange->end, + $range->start, $range->end + )); + } + } + if ($lastRange->end != -1) { + $newRanges[] = $lastRange; + } + return $newRanges; + } + + public function compactPropRanges() { + foreach ($this->propRanges as &$ranges) { + $ranges = $this->compactRangeArray($ranges); + } + } +} + +function parseDataFile(string $input) { + $lines = explode("\n", $input); + foreach ($lines as $line) { + // Strip comments + if (false !== $hashPos = strpos($line, '#')) { + $line = substr($line, 0, $hashPos); + } + + // Skip empty lines + $line = trim($line); + if ($line === '') { + continue; + } + + $fields = array_map('trim', explode(';', $line)); + yield $fields; + } +} + +function parseUnicodeData(UnicodeData $data, string $input) : void { + $lines = parseDataFile($input); + foreach ($lines as $fields) { + if (count($fields) != 15) { + throw new Exception("Line does not contain 15 fields"); + } + + $code = intval($fields[0], 16); + + $name = $fields[1]; + if ($name === '') { + throw new Exception("Empty name"); + } + + if ($name[0] === '<' && $name !== '') { + // This is a character range + $lines->next(); + $nextFields = $lines->current(); + $nextCode = intval($nextFields[0], 16); + + $generalCategory = $fields[2]; + $data->addPropRange($code, $nextCode, $generalCategory); + + $bidiClass = $fields[4]; + $data->addPropRange($code, $nextCode, $bidiClass); + continue; + } + + $generalCategory = $fields[2]; + $data->addProp($code, $generalCategory); + + $bidiClass = $fields[4]; + $data->addProp($code, $bidiClass); + + $upperCase = intval($fields[12], 16); + $lowerCase = intval($fields[13], 16); + $titleCase = intval($fields[14], 16) ?: $upperCase; + if ($upperCase) { + $data->addCaseMapping('upper', $code, $upperCase); + } + if ($lowerCase) { + $data->addCaseMapping('lower', $code, $lowerCase); + } + if ($titleCase) { + $data->addCaseMapping('title', $code, $titleCase); + } + } +} + +function parseCodes(string $strCodes) : array { + $codes = []; + foreach (explode(' ', $strCodes) as $strCode) { + $codes[] = intval($strCode, 16); + } + return $codes; +} + +function parseCaseFolding(UnicodeData $data, string $input) : void { + foreach (parseDataFile($input) as $fields) { + if (count($fields) != 4) { + throw new Exception("Line does not contain 4 fields"); + } + + $code = intval($fields[0], 16); + $status = $fields[1]; + if ($status == 'T') { + // Use language-agnostic case folding + continue; + } + + if ($status == 'C' || $status == 'S') { + $foldCode = intval($fields[2], 16); + if (!isset($data->caseMaps['fold'][$code])) { + $data->addCaseMapping('fold', $code, $foldCode); + } else { + // Add simple mapping to full mapping data + assert(is_array($data->caseMaps['fold'][$code])); + $data->caseMaps['fold'][$code][0] = $foldCode; + } + } else if ($status == 'F') { + $foldCodes = parseCodes($fields[2]); + $existingFoldCode = $data->caseMaps['fold'][$code] ?? $code; + $data->caseMaps['fold'][$code] = array_merge([$code], $foldCodes); + } else { + assert(0); + } + } +} + +function addSpecialCasing(UnicodeData $data, string $type, int $code, array $caseCodes) : void { + $simpleCaseCode = $data->caseMaps[$type][$code] ?? $code; + if (count($caseCodes) == 1) { + if ($caseCodes[0] != $simpleCaseCode) { + throw new Exception("Simple case code in special casing does not match"); + } + + // Special case: If a title-case character maps to itself, we may still have to store it, + // if there is a non-trivial upper-case mapping for it + if ($type == 'title' && $code == $caseCodes[0] + && ($data->caseMaps['upper'][$code] ?? $code) != $code) { + $data->caseMaps['title'][$code] = $code; + } + return; + } + + if (count($caseCodes) > 3) { + throw new Exception("Special case mapping with more than 3 code points"); + } + + $data->caseMaps[$type][$code] = array_merge([$simpleCaseCode], $caseCodes); +} + +function parseSpecialCasing(UnicodeData $data, string $input) : void { + foreach (parseDataFile($input) as $fields) { + if (count($fields) != 5 && count($fields) != 6) { + throw new Exception("Line does not contain 5 or 6 fields"); + } + + $code = intval($fields[0], 16); + $lower = parseCodes($fields[1]); + $title = parseCodes($fields[2]); + $upper = parseCodes($fields[3]); + + $cond = $fields[4]; + if ($cond) { + // Only use unconditional mappings + continue; + } + + addSpecialCasing($data, 'lower', $code, $lower); + addSpecialCasing($data, 'upper', $code, $upper); + + // Should happen last + addSpecialCasing($data, 'title', $code, $title); + } +} + +function parseDerivedCoreProperties(UnicodeData $data, string $input) : void { + foreach (parseDataFile($input) as $fields) { + if (count($fields) != 2) { + throw new Exception("Line does not contain 2 fields"); + } + + $property = $fields[1]; + if ($property != 'Cased' && $property != 'Case_Ignorable') { + continue; + } + + $range = explode('..', $fields[0]); + if (count($range) == 2) { + $data->addPropRange(intval($range[0], 16), intval($range[1], 16), $property); + } else if (count($range) == 1) { + $data->addProp(intval($range[0], 16), $property); + } else { + throw new Exception("Invalid range"); + } + } +} + +function formatArray(array $values, int $width, string $format) : string { + $result = ''; + $i = 0; + $c = count($values); + for ($i = 0; $i < $c; $i++) { + if ($i != 0) { + $result .= ','; + } + + $result .= $i % $width == 0 ? "\n\t" : " "; + $result .= sprintf($format, $values[$i]); + } + return $result; +} + +function formatShortHexArray(array $values, int $width) : string { + return formatArray($values, $width, "0x%04x"); +} +function formatShortDecArray(array $values, int $width) : string { + return formatArray($values, $width, "% 5d"); +} +function formatIntArray(array $values, int $width) : string { + return formatArray($values, $width, "0x%08x"); +} + +function generatePropData(UnicodeData $data) { + $data->compactPropRanges(); + + $propOffsets = []; + $idx = 0; + foreach ($data->propRanges as $ranges) { + $num = count($ranges); + $propOffsets[] = $num ? $idx : 0xffff; + $idx += 2*$num; + } + + // Add sentinel for binary search + $propOffsets[] = $idx; + + // TODO ucgendat.c pads the prop offsets to the next multiple of 4 + // for rather debious reasons of alignment. This should probably be + // dropped + while (count($propOffsets) % 4 != 0) { + $propOffsets[] = 0; + } + + $totalRanges = $idx; + + $result = ""; + $result .= "static const unsigned short _ucprop_size = $data->numProps;\n\n"; + $result .= "static const unsigned short _ucprop_offsets[] = {"; + $result .= formatShortHexArray($propOffsets, 8); + $result .= "\n};\n\n"; + + $values = []; + foreach ($data->propRanges as $ranges) { + foreach ($ranges as $range) { + $values[] = $range->start; + $values[] = $range->end; + } + } + + $result .= "static const unsigned int _ucprop_ranges[] = {"; + $result .= formatIntArray($values, 4); + $result .= "\n};\n\n"; + return $result; +} + +function flatten(array $array) { + $result = []; + foreach ($array as $arr) { + foreach ($arr as $v) { + $result[] = $v; + } + } + return $result; +} + +function prepareCaseData(UnicodeData $data) { + // Don't store titlecase if it's the same as uppercase + foreach ($data->caseMaps['title'] as $code => $titleCode) { + if ($titleCode == ($data->caseMaps['upper'][$code] ?? $code)) { + unset($data->caseMaps['title'][$code]); + } + } + + // Store full (multi-char) case mappings in a separate table and only + // store an index into it + foreach ($data->caseMaps as $type => $caseMap) { + foreach ($caseMap as $code => $caseCode) { + if (is_array($caseCode)) { + // -1 because the first entry is the simple case mapping + $len = count($caseCode) - 1; + $idx = count($data->extraCaseData); + $data->caseMaps[$type][$code] = ($len << 24) | $idx; + + foreach ($caseCode as $c) { + $data->extraCaseData[] = $c; + } + } + } + } +} + +function generateCaseMPH(string $name, array $map) { + $prefix = "_uccase_" . $name; + list($gTable, $table) = generateMPH($map, $fast = false); + echo "$name: n=", count($table), ", g=", count($gTable), "\n"; + + $result = ""; + $result .= "static const unsigned {$prefix}_g_size = " . count($gTable) . ";\n"; + $result .= "static const short {$prefix}_g[] = {"; + $result .= formatShortDecArray($gTable, 8); + $result .= "\n};\n\n"; + $result .= "static const unsigned {$prefix}_table_size = " . count($table) . ";\n"; + $result .= "static const unsigned {$prefix}_table[] = {"; + $result .= formatIntArray(flatten($table), 4); + $result .= "\n};\n\n"; + return $result; +} + +function generateCaseData(UnicodeData $data) { + prepareCaseData($data); + + $result = ""; + $result .= generateCaseMPH('upper', $data->caseMaps['upper']); + $result .= generateCaseMPH('lower', $data->caseMaps['lower']); + $result .= generateCaseMPH('title', $data->caseMaps['title']); + $result .= generateCaseMPH('fold', $data->caseMaps['fold']); + $result .= "static const unsigned _uccase_extra_table[] = {"; + $result .= formatIntArray($data->extraCaseData, 4); + $result .= "\n};\n\n"; + return $result; +} + +function generateData(UnicodeData $data) { + $result = <<<'HEADER' +/* This file was generated from a modified version UCData's ucgendat. + * + * DO NOT EDIT THIS FILE! + * + * Instead, compile ucgendat.c (bundled with PHP in ext/mbstring), download + * the appropriate UnicodeData-x.x.x.txt and CompositionExclusions-x.x.x.txt + * files from http://www.unicode.org/Public/ and run this program. + * + * More information can be found in the UCData package. Unfortunately, + * the project's page doesn't seem to be live anymore, so you can use + * OpenLDAPs modified copy (look in libraries/liblunicode/ucdata) */ +HEADER; + $result .= "\n\n" . generatePropData($data); + $result .= generateCaseData($data); + + return $result; +} + +/* + * Minimal Perfect Hash Generation + * + * Based on "Hash, displace, and compress" algorithm due to + * Belazzougui, Botelho and Dietzfelbinger. + * + * Hash function based on https://stackoverflow.com/a/12996028/385378. + * MPH implementation based on http://stevehanov.ca/blog/index.php?id=119. + */ + +function hashInt(int $d, int $x) { + $x ^= $d; + $x = (($x >> 16) ^ $x) * 0x45d9f3b; + return $x & 0xffffffff; +} + +function tryGenerateMPH(array $map, int $gSize) { + $tableSize = count($map); + $table = []; + $gTable = array_fill(0, $gSize, 0x7fff); + $buckets = []; + + foreach ($map as $k => $v) { + $h = hashInt(0, $k) % $gSize; + $buckets[$h][] = [$k, $v]; + } + + // Sort by descending number of collisions + usort($buckets, function ($b1, $b2) { + return -(count($b1) <=> count($b2)); + }); + + foreach ($buckets as $bucket) { + $collisions = count($bucket); + if ($collisions <= 1) { + continue; + } + + // Try values of $d until all elements placed in different slots + $d = 1; + $i = 0; + $used = []; + while ($i < $collisions) { + if ($d > 0x7fff) { + return []; + } + + list($k) = $bucket[$i]; + $slot = hashInt($d, $k) % $tableSize; + if (isset($table[$slot]) || isset($used[$slot])) { + $d++; + $i = 0; + $used = []; + } else { + $i++; + $used[$slot] = true; + } + } + + $g = hashInt(0, $bucket[0][0]) % $gSize; + $gTable[$g] = $d; + foreach ($bucket as $elem) { + $table[hashInt($d, $elem[0]) % $tableSize] = $elem; + } + } + + $freeSlots = []; + for ($i = 0; $i < $tableSize; $i++) { + if (!isset($table[$i])) { + $freeSlots[] = $i; + } + } + + // For buckets with only one element, we directly store the index + $freeIdx = 0; + foreach ($buckets as $bucket) { + if (count($bucket) != 1) { + continue; + } + + $elem = $bucket[0]; + $slot = $freeSlots[$freeIdx++]; + $table[$slot] = $elem; + + $g = hashInt(0, $elem[0]) % $gSize; + $gTable[$g] = -$slot; + } + + ksort($gTable); + ksort($table); + + return [$gTable, $table]; +} + +function generateMPH(array $map, bool $fast) { + if ($fast) { + // Check size starting lambda=5.0 in 0.5 increments + for ($lambda = 5.0;; $lambda -= 0.5) { + $m = (int) (count($map) / $lambda); + $tmpMph = tryGenerateMPH($map, $m); + if (!empty($tmpMph)) { + $mph = $tmpMph; + break; + } + } + } else { + // Check all sizes starting lambda=7.0 + $m = (int) (count($map) / 7.0); + for (;; $m++) { + $tmpMph = tryGenerateMPH($map, $m); + if (!empty($tmpMph)) { + $mph = $tmpMph; + break; + } + } + } + + return $mph; +} diff --git a/ext/mbstring/ucgendat/uctest.php b/ext/mbstring/ucgendat/uctest.php new file mode 100644 index 0000000000000..62a4e71c5e802 --- /dev/null +++ b/ext/mbstring/ucgendat/uctest.php @@ -0,0 +1,131 @@ += 5); + + $code = intval($fields[0], 16); + $lower = parseCodes($fields[1]); + $title = parseCodes($fields[2]); + $upper = parseCodes($fields[3]); + + $cond = $fields[4]; + if ($cond) { + // We don't support conditional mappings + continue; + } + + testCaseMap(MB_CASE_LOWER, $code, $lower); + testCaseMap(MB_CASE_UPPER, $code, $upper); + testCaseMap(MB_CASE_TITLE, $code, $title); + } +} diff --git a/ext/mbstring/unicode_data.h b/ext/mbstring/unicode_data.h index cad451c943d7b..9e40e4c92292f 100644 --- a/ext/mbstring/unicode_data.h +++ b/ext/mbstring/unicode_data.h @@ -10,16 +10,15 @@ * the project's page doesn't seem to be live anymore, so you can use * OpenLDAPs modified copy (look in libraries/liblunicode/ucdata) */ -static const unsigned short _ucprop_size = 50; +static const unsigned short _ucprop_size = 44; static const unsigned short _ucprop_offsets[] = { 0x0000, 0x025a, 0x039a, 0x03a4, 0x0412, 0x042a, 0x04a2, 0x04b0, 0x04b2, 0x04b4, 0x04b8, 0x04dc, 0x04de, 0xffff, 0x04e4, 0x09ca, - 0x0ebc, 0x0ed0, 0x0f42, 0x12de, 0x12ea, 0x130c, 0x13a2, 0x1432, - 0x1584, 0x1604, 0x1626, 0x1660, 0x17ba, 0x1b4a, 0x1bca, 0x1be2, - 0x1bf4, 0x1c20, 0x1c2c, 0x1c46, 0x1c50, 0x1c56, 0x1c64, 0x200a, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x21d6, 0x26ee, - 0x2704, 0x2718, 0x278a, 0x0000 + 0x0ebc, 0x0ed0, 0x0f42, 0x12d8, 0x12e4, 0x1306, 0x139c, 0x142c, + 0x157e, 0x15fe, 0x1620, 0x165a, 0x17b4, 0x1cea, 0x1d6a, 0x1d82, + 0x1d94, 0x1dc0, 0x1dcc, 0x1de6, 0x1df0, 0x1df6, 0x1e04, 0x21aa, + 0x21c0, 0x21d4, 0x2246, 0x2354, 0x264e, 0x0000, 0x0000, 0x0000 }; static const unsigned int _ucprop_ranges[] = { @@ -334,7 +333,7 @@ static const unsigned int _ucprop_ranges[] = { 0x0000fff9, 0x0000fffb, 0x000110bd, 0x000110bd, 0x0001bca0, 0x0001bca3, 0x0001d173, 0x0001d17a, 0x000e0001, 0x000e0001, 0x000e0020, 0x000e007f, - 0x00010000, 0x0010ffff, 0x0000e000, 0x0000f8ff, + 0x0000d800, 0x0000dfff, 0x0000e000, 0x0000f8ff, 0x000f0000, 0x000ffffd, 0x00100000, 0x0010fffd, 0x00000041, 0x0000005a, 0x000000c0, 0x000000d6, 0x000000d8, 0x000000de, 0x00000100, 0x00000100, @@ -1110,32 +1109,33 @@ static const unsigned int _ucprop_ranges[] = { 0x000030a1, 0x000030fa, 0x000030ff, 0x000030ff, 0x00003105, 0x0000312e, 0x00003131, 0x0000318e, 0x000031a0, 0x000031ba, 0x000031f0, 0x000031ff, - 0x00003400, 0x00004db5, 0x00004e00, 0x0000a014, - 0x0000a016, 0x0000a48c, 0x0000a4d0, 0x0000a4f7, - 0x0000a500, 0x0000a60b, 0x0000a610, 0x0000a61f, - 0x0000a62a, 0x0000a62b, 0x0000a66e, 0x0000a66e, - 0x0000a6a0, 0x0000a6e5, 0x0000a78f, 0x0000a78f, - 0x0000a7f7, 0x0000a7f7, 0x0000a7fb, 0x0000a801, - 0x0000a803, 0x0000a805, 0x0000a807, 0x0000a80a, - 0x0000a80c, 0x0000a822, 0x0000a840, 0x0000a873, - 0x0000a882, 0x0000a8b3, 0x0000a8f2, 0x0000a8f7, - 0x0000a8fb, 0x0000a8fb, 0x0000a8fd, 0x0000a8fd, - 0x0000a90a, 0x0000a925, 0x0000a930, 0x0000a946, - 0x0000a960, 0x0000a97c, 0x0000a984, 0x0000a9b2, - 0x0000a9e0, 0x0000a9e4, 0x0000a9e7, 0x0000a9ef, - 0x0000a9fa, 0x0000a9fe, 0x0000aa00, 0x0000aa28, - 0x0000aa40, 0x0000aa42, 0x0000aa44, 0x0000aa4b, - 0x0000aa60, 0x0000aa6f, 0x0000aa71, 0x0000aa76, - 0x0000aa7a, 0x0000aa7a, 0x0000aa7e, 0x0000aaaf, - 0x0000aab1, 0x0000aab1, 0x0000aab5, 0x0000aab6, - 0x0000aab9, 0x0000aabd, 0x0000aac0, 0x0000aac0, - 0x0000aac2, 0x0000aac2, 0x0000aadb, 0x0000aadc, - 0x0000aae0, 0x0000aaea, 0x0000aaf2, 0x0000aaf2, - 0x0000ab01, 0x0000ab06, 0x0000ab09, 0x0000ab0e, - 0x0000ab11, 0x0000ab16, 0x0000ab20, 0x0000ab26, - 0x0000ab28, 0x0000ab2e, 0x0000abc0, 0x0000abe2, - 0x0000ac00, 0x0000d7a3, 0x0000d7b0, 0x0000d7c6, - 0x0000d7cb, 0x0000d7fb, 0x0000f900, 0x0000faff, + 0x00003400, 0x00004db5, 0x00004e00, 0x00009fea, + 0x0000a000, 0x0000a014, 0x0000a016, 0x0000a48c, + 0x0000a4d0, 0x0000a4f7, 0x0000a500, 0x0000a60b, + 0x0000a610, 0x0000a61f, 0x0000a62a, 0x0000a62b, + 0x0000a66e, 0x0000a66e, 0x0000a6a0, 0x0000a6e5, + 0x0000a78f, 0x0000a78f, 0x0000a7f7, 0x0000a7f7, + 0x0000a7fb, 0x0000a801, 0x0000a803, 0x0000a805, + 0x0000a807, 0x0000a80a, 0x0000a80c, 0x0000a822, + 0x0000a840, 0x0000a873, 0x0000a882, 0x0000a8b3, + 0x0000a8f2, 0x0000a8f7, 0x0000a8fb, 0x0000a8fb, + 0x0000a8fd, 0x0000a8fd, 0x0000a90a, 0x0000a925, + 0x0000a930, 0x0000a946, 0x0000a960, 0x0000a97c, + 0x0000a984, 0x0000a9b2, 0x0000a9e0, 0x0000a9e4, + 0x0000a9e7, 0x0000a9ef, 0x0000a9fa, 0x0000a9fe, + 0x0000aa00, 0x0000aa28, 0x0000aa40, 0x0000aa42, + 0x0000aa44, 0x0000aa4b, 0x0000aa60, 0x0000aa6f, + 0x0000aa71, 0x0000aa76, 0x0000aa7a, 0x0000aa7a, + 0x0000aa7e, 0x0000aaaf, 0x0000aab1, 0x0000aab1, + 0x0000aab5, 0x0000aab6, 0x0000aab9, 0x0000aabd, + 0x0000aac0, 0x0000aac0, 0x0000aac2, 0x0000aac2, + 0x0000aadb, 0x0000aadc, 0x0000aae0, 0x0000aaea, + 0x0000aaf2, 0x0000aaf2, 0x0000ab01, 0x0000ab06, + 0x0000ab09, 0x0000ab0e, 0x0000ab11, 0x0000ab16, + 0x0000ab20, 0x0000ab26, 0x0000ab28, 0x0000ab2e, + 0x0000abc0, 0x0000abe2, 0x0000ac00, 0x0000d7a3, + 0x0000d7b0, 0x0000d7c6, 0x0000d7cb, 0x0000d7fb, + 0x0000f900, 0x0000fa6d, 0x0000fa70, 0x0000fad9, 0x0000fb1d, 0x0000fb1d, 0x0000fb1f, 0x0000fb28, 0x0000fb2a, 0x0000fb36, 0x0000fb38, 0x0000fb3c, 0x0000fb3e, 0x0000fb3e, 0x0000fb40, 0x0000fb41, @@ -1204,532 +1204,530 @@ static const unsigned int _ucprop_ranges[] = { 0x00016ad0, 0x00016aed, 0x00016b00, 0x00016b2f, 0x00016b63, 0x00016b77, 0x00016b7d, 0x00016b8f, 0x00016f00, 0x00016f44, 0x00016f50, 0x00016f50, - 0x00017000, 0x00017000, 0x000187ec, 0x000187ec, - 0x00018800, 0x00018af2, 0x0001b000, 0x0001b11e, - 0x0001b170, 0x0001b2fb, 0x0001bc00, 0x0001bc6a, - 0x0001bc70, 0x0001bc7c, 0x0001bc80, 0x0001bc88, - 0x0001bc90, 0x0001bc99, 0x0001e800, 0x0001e8c4, - 0x0001ee00, 0x0001ee03, 0x0001ee05, 0x0001ee1f, - 0x0001ee21, 0x0001ee22, 0x0001ee24, 0x0001ee24, - 0x0001ee27, 0x0001ee27, 0x0001ee29, 0x0001ee32, - 0x0001ee34, 0x0001ee37, 0x0001ee39, 0x0001ee39, - 0x0001ee3b, 0x0001ee3b, 0x0001ee42, 0x0001ee42, - 0x0001ee47, 0x0001ee47, 0x0001ee49, 0x0001ee49, - 0x0001ee4b, 0x0001ee4b, 0x0001ee4d, 0x0001ee4f, - 0x0001ee51, 0x0001ee52, 0x0001ee54, 0x0001ee54, - 0x0001ee57, 0x0001ee57, 0x0001ee59, 0x0001ee59, - 0x0001ee5b, 0x0001ee5b, 0x0001ee5d, 0x0001ee5d, - 0x0001ee5f, 0x0001ee5f, 0x0001ee61, 0x0001ee62, - 0x0001ee64, 0x0001ee64, 0x0001ee67, 0x0001ee6a, - 0x0001ee6c, 0x0001ee72, 0x0001ee74, 0x0001ee77, - 0x0001ee79, 0x0001ee7c, 0x0001ee7e, 0x0001ee7e, - 0x0001ee80, 0x0001ee89, 0x0001ee8b, 0x0001ee9b, - 0x0001eea1, 0x0001eea3, 0x0001eea5, 0x0001eea9, - 0x0001eeab, 0x0001eebb, 0x00020000, 0x0002a6d6, - 0x0002a700, 0x0002a700, 0x0002b734, 0x0002b734, - 0x0002b740, 0x0002b740, 0x0002b81d, 0x0002b81d, - 0x0002b820, 0x0002b820, 0x0002cea1, 0x0002cea1, - 0x0002ceb0, 0x0002ceb0, 0x0002ebe0, 0x0002ebe0, - 0x0002f800, 0x0002fa1d, 0x0000005f, 0x0000005f, - 0x0000203f, 0x00002040, 0x00002054, 0x00002054, - 0x0000fe33, 0x0000fe34, 0x0000fe4d, 0x0000fe4f, - 0x0000ff3f, 0x0000ff3f, 0x0000002d, 0x0000002d, - 0x0000058a, 0x0000058a, 0x000005be, 0x000005be, - 0x00001400, 0x00001400, 0x00001806, 0x00001806, - 0x00002010, 0x00002015, 0x00002e17, 0x00002e17, - 0x00002e1a, 0x00002e1a, 0x00002e3a, 0x00002e3b, - 0x00002e40, 0x00002e40, 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, 0x00002308, 0x00002308, - 0x0000230a, 0x0000230a, 0x00002329, 0x00002329, - 0x00002768, 0x00002768, 0x0000276a, 0x0000276a, - 0x0000276c, 0x0000276c, 0x0000276e, 0x0000276e, - 0x00002770, 0x00002770, 0x00002772, 0x00002772, - 0x00002774, 0x00002774, 0x000027c5, 0x000027c5, - 0x000027e6, 0x000027e6, 0x000027e8, 0x000027e8, - 0x000027ea, 0x000027ea, 0x000027ec, 0x000027ec, - 0x000027ee, 0x000027ee, 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, 0x00002e22, 0x00002e22, - 0x00002e24, 0x00002e24, 0x00002e26, 0x00002e26, - 0x00002e28, 0x00002e28, 0x00002e42, 0x00002e42, - 0x00003008, 0x00003008, 0x0000300a, 0x0000300a, - 0x0000300c, 0x0000300c, 0x0000300e, 0x0000300e, - 0x00003010, 0x00003010, 0x00003014, 0x00003014, - 0x00003016, 0x00003016, 0x00003018, 0x00003018, - 0x0000301a, 0x0000301a, 0x0000301d, 0x0000301d, - 0x0000fd3f, 0x0000fd3f, 0x0000fe17, 0x0000fe17, - 0x0000fe35, 0x0000fe35, 0x0000fe37, 0x0000fe37, - 0x0000fe39, 0x0000fe39, 0x0000fe3b, 0x0000fe3b, - 0x0000fe3d, 0x0000fe3d, 0x0000fe3f, 0x0000fe3f, - 0x0000fe41, 0x0000fe41, 0x0000fe43, 0x0000fe43, - 0x0000fe47, 0x0000fe47, 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, - 0x00002309, 0x00002309, 0x0000230b, 0x0000230b, - 0x0000232a, 0x0000232a, 0x00002769, 0x00002769, - 0x0000276b, 0x0000276b, 0x0000276d, 0x0000276d, - 0x0000276f, 0x0000276f, 0x00002771, 0x00002771, - 0x00002773, 0x00002773, 0x00002775, 0x00002775, - 0x000027c6, 0x000027c6, 0x000027e7, 0x000027e7, - 0x000027e9, 0x000027e9, 0x000027eb, 0x000027eb, - 0x000027ed, 0x000027ed, 0x000027ef, 0x000027ef, - 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, - 0x00002e23, 0x00002e23, 0x00002e25, 0x00002e25, - 0x00002e27, 0x00002e27, 0x00002e29, 0x00002e29, - 0x00003009, 0x00003009, 0x0000300b, 0x0000300b, - 0x0000300d, 0x0000300d, 0x0000300f, 0x0000300f, - 0x00003011, 0x00003011, 0x00003015, 0x00003015, - 0x00003017, 0x00003017, 0x00003019, 0x00003019, - 0x0000301b, 0x0000301b, 0x0000301e, 0x0000301f, - 0x0000fd3e, 0x0000fd3e, 0x0000fe18, 0x0000fe18, - 0x0000fe36, 0x0000fe36, 0x0000fe38, 0x0000fe38, - 0x0000fe3a, 0x0000fe3a, 0x0000fe3c, 0x0000fe3c, - 0x0000fe3e, 0x0000fe3e, 0x0000fe40, 0x0000fe40, - 0x0000fe42, 0x0000fe42, 0x0000fe44, 0x0000fe44, - 0x0000fe48, 0x0000fe48, 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, - 0x000000a7, 0x000000a7, 0x000000b6, 0x000000b7, - 0x000000bf, 0x000000bf, 0x0000037e, 0x0000037e, - 0x00000387, 0x00000387, 0x0000055a, 0x0000055f, - 0x00000589, 0x00000589, 0x000005c0, 0x000005c0, - 0x000005c3, 0x000005c3, 0x000005c6, 0x000005c6, - 0x000005f3, 0x000005f4, 0x00000609, 0x0000060a, - 0x0000060c, 0x0000060d, 0x0000061b, 0x0000061b, - 0x0000061e, 0x0000061f, 0x0000066a, 0x0000066d, - 0x000006d4, 0x000006d4, 0x00000700, 0x0000070d, - 0x000007f7, 0x000007f9, 0x00000830, 0x0000083e, - 0x0000085e, 0x0000085e, 0x00000964, 0x00000965, - 0x00000970, 0x00000970, 0x000009fd, 0x000009fd, - 0x00000af0, 0x00000af0, 0x00000df4, 0x00000df4, - 0x00000e4f, 0x00000e4f, 0x00000e5a, 0x00000e5b, - 0x00000f04, 0x00000f12, 0x00000f14, 0x00000f14, - 0x00000f85, 0x00000f85, 0x00000fd0, 0x00000fd4, - 0x00000fd9, 0x00000fda, 0x0000104a, 0x0000104f, - 0x000010fb, 0x000010fb, 0x00001360, 0x00001368, - 0x0000166d, 0x0000166e, 0x000016eb, 0x000016ed, - 0x00001735, 0x00001736, 0x000017d4, 0x000017d6, - 0x000017d8, 0x000017da, 0x00001800, 0x00001805, - 0x00001807, 0x0000180a, 0x00001944, 0x00001945, - 0x00001a1e, 0x00001a1f, 0x00001aa0, 0x00001aa6, - 0x00001aa8, 0x00001aad, 0x00001b5a, 0x00001b60, - 0x00001bfc, 0x00001bff, 0x00001c3b, 0x00001c3f, - 0x00001c7e, 0x00001c7f, 0x00001cc0, 0x00001cc7, - 0x00001cd3, 0x00001cd3, 0x00002016, 0x00002017, - 0x00002020, 0x00002027, 0x00002030, 0x00002038, - 0x0000203b, 0x0000203e, 0x00002041, 0x00002043, - 0x00002047, 0x00002051, 0x00002053, 0x00002053, - 0x00002055, 0x0000205e, 0x00002cf9, 0x00002cfc, - 0x00002cfe, 0x00002cff, 0x00002d70, 0x00002d70, - 0x00002e00, 0x00002e01, 0x00002e06, 0x00002e08, - 0x00002e0b, 0x00002e0b, 0x00002e0e, 0x00002e16, - 0x00002e18, 0x00002e19, 0x00002e1b, 0x00002e1b, - 0x00002e1e, 0x00002e1f, 0x00002e2a, 0x00002e2e, - 0x00002e30, 0x00002e39, 0x00002e3c, 0x00002e3f, - 0x00002e41, 0x00002e41, 0x00002e43, 0x00002e49, - 0x00003001, 0x00003003, 0x0000303d, 0x0000303d, - 0x000030fb, 0x000030fb, 0x0000a4fe, 0x0000a4ff, - 0x0000a60d, 0x0000a60f, 0x0000a673, 0x0000a673, - 0x0000a67e, 0x0000a67e, 0x0000a6f2, 0x0000a6f7, - 0x0000a874, 0x0000a877, 0x0000a8ce, 0x0000a8cf, - 0x0000a8f8, 0x0000a8fa, 0x0000a8fc, 0x0000a8fc, - 0x0000a92e, 0x0000a92f, 0x0000a95f, 0x0000a95f, - 0x0000a9c1, 0x0000a9cd, 0x0000a9de, 0x0000a9df, - 0x0000aa5c, 0x0000aa5f, 0x0000aade, 0x0000aadf, - 0x0000aaf0, 0x0000aaf1, 0x0000abeb, 0x0000abeb, - 0x0000fe10, 0x0000fe16, 0x0000fe19, 0x0000fe19, - 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, 0x0000ff65, - 0x00010100, 0x00010102, 0x0001039f, 0x0001039f, - 0x000103d0, 0x000103d0, 0x0001056f, 0x0001056f, - 0x00010857, 0x00010857, 0x0001091f, 0x0001091f, - 0x0001093f, 0x0001093f, 0x00010a50, 0x00010a58, - 0x00010a7f, 0x00010a7f, 0x00010af0, 0x00010af6, - 0x00010b39, 0x00010b3f, 0x00010b99, 0x00010b9c, - 0x00011047, 0x0001104d, 0x000110bb, 0x000110bc, - 0x000110be, 0x000110c1, 0x00011140, 0x00011143, - 0x00011174, 0x00011175, 0x000111c5, 0x000111c9, - 0x000111cd, 0x000111cd, 0x000111db, 0x000111db, - 0x000111dd, 0x000111df, 0x00011238, 0x0001123d, - 0x000112a9, 0x000112a9, 0x0001144b, 0x0001144f, - 0x0001145b, 0x0001145b, 0x0001145d, 0x0001145d, - 0x000114c6, 0x000114c6, 0x000115c1, 0x000115d7, - 0x00011641, 0x00011643, 0x00011660, 0x0001166c, - 0x0001173c, 0x0001173e, 0x00011a3f, 0x00011a46, - 0x00011a9a, 0x00011a9c, 0x00011a9e, 0x00011aa2, - 0x00011c41, 0x00011c45, 0x00011c70, 0x00011c71, - 0x00012470, 0x00012474, 0x00016a6e, 0x00016a6f, - 0x00016af5, 0x00016af5, 0x00016b37, 0x00016b3b, - 0x00016b44, 0x00016b44, 0x0001bc9f, 0x0001bc9f, - 0x0001da87, 0x0001da8b, 0x0001e95e, 0x0001e95f, - 0x0000002b, 0x0000002b, 0x0000003c, 0x0000003e, - 0x0000007c, 0x0000007c, 0x0000007e, 0x0000007e, - 0x000000ac, 0x000000ac, 0x000000b1, 0x000000b1, - 0x000000d7, 0x000000d7, 0x000000f7, 0x000000f7, - 0x000003f6, 0x000003f6, 0x00000606, 0x00000608, - 0x00002044, 0x00002044, 0x00002052, 0x00002052, - 0x0000207a, 0x0000207c, 0x0000208a, 0x0000208c, - 0x00002118, 0x00002118, 0x00002140, 0x00002144, - 0x0000214b, 0x0000214b, 0x00002190, 0x00002194, - 0x0000219a, 0x0000219b, 0x000021a0, 0x000021a0, - 0x000021a3, 0x000021a3, 0x000021a6, 0x000021a6, - 0x000021ae, 0x000021ae, 0x000021ce, 0x000021cf, - 0x000021d2, 0x000021d2, 0x000021d4, 0x000021d4, - 0x000021f4, 0x000022ff, 0x00002320, 0x00002321, - 0x0000237c, 0x0000237c, 0x0000239b, 0x000023b3, - 0x000023dc, 0x000023e1, 0x000025b7, 0x000025b7, - 0x000025c1, 0x000025c1, 0x000025f8, 0x000025ff, - 0x0000266f, 0x0000266f, 0x000027c0, 0x000027c4, - 0x000027c7, 0x000027e5, 0x000027f0, 0x000027ff, - 0x00002900, 0x00002982, 0x00002999, 0x000029d7, - 0x000029dc, 0x000029fb, 0x000029fe, 0x00002aff, - 0x00002b30, 0x00002b44, 0x00002b47, 0x00002b4c, - 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, 0x0001eef0, 0x0001eef1, - 0x00000024, 0x00000024, 0x000000a2, 0x000000a5, - 0x0000058f, 0x0000058f, 0x0000060b, 0x0000060b, - 0x000009f2, 0x000009f3, 0x000009fb, 0x000009fb, - 0x00000af1, 0x00000af1, 0x00000bf9, 0x00000bf9, - 0x00000e3f, 0x00000e3f, 0x000017db, 0x000017db, - 0x000020a0, 0x000020bf, 0x0000a838, 0x0000a838, - 0x0000fdfc, 0x0000fdfc, 0x0000fe69, 0x0000fe69, - 0x0000ff04, 0x0000ff04, 0x0000ffe0, 0x0000ffe1, - 0x0000ffe5, 0x0000ffe6, 0x0000005e, 0x0000005e, - 0x00000060, 0x00000060, 0x000000a8, 0x000000a8, - 0x000000af, 0x000000af, 0x000000b4, 0x000000b4, - 0x000000b8, 0x000000b8, 0x000002c2, 0x000002c5, - 0x000002d2, 0x000002df, 0x000002e5, 0x000002eb, - 0x000002ed, 0x000002ed, 0x000002ef, 0x000002ff, - 0x00000375, 0x00000375, 0x00000384, 0x00000385, - 0x00001fbd, 0x00001fbd, 0x00001fbf, 0x00001fc1, - 0x00001fcd, 0x00001fcf, 0x00001fdd, 0x00001fdf, - 0x00001fed, 0x00001fef, 0x00001ffd, 0x00001ffe, - 0x0000309b, 0x0000309c, 0x0000a700, 0x0000a716, - 0x0000a720, 0x0000a721, 0x0000a789, 0x0000a78a, - 0x0000ab5b, 0x0000ab5b, 0x0000fbb2, 0x0000fbc1, - 0x0000ff3e, 0x0000ff3e, 0x0000ff40, 0x0000ff40, - 0x0000ffe3, 0x0000ffe3, 0x0001f3fb, 0x0001f3ff, - 0x000000a6, 0x000000a6, 0x000000a9, 0x000000a9, - 0x000000ae, 0x000000ae, 0x000000b0, 0x000000b0, - 0x00000482, 0x00000482, 0x0000058d, 0x0000058e, - 0x0000060e, 0x0000060f, 0x000006de, 0x000006de, - 0x000006e9, 0x000006e9, 0x000006fd, 0x000006fe, - 0x000007f6, 0x000007f6, 0x000009fa, 0x000009fa, - 0x00000b70, 0x00000b70, 0x00000bf3, 0x00000bf8, - 0x00000bfa, 0x00000bfa, 0x00000c7f, 0x00000c7f, - 0x00000d4f, 0x00000d4f, 0x00000d79, 0x00000d79, - 0x00000f01, 0x00000f03, 0x00000f13, 0x00000f13, - 0x00000f15, 0x00000f17, 0x00000f1a, 0x00000f1f, - 0x00000f34, 0x00000f34, 0x00000f36, 0x00000f36, - 0x00000f38, 0x00000f38, 0x00000fbe, 0x00000fc5, - 0x00000fc7, 0x00000fcc, 0x00000fce, 0x00000fcf, - 0x00000fd5, 0x00000fd8, 0x0000109e, 0x0000109f, - 0x00001390, 0x00001399, 0x00001940, 0x00001940, - 0x000019de, 0x000019ff, 0x00001b61, 0x00001b6a, - 0x00001b74, 0x00001b7c, 0x00002100, 0x00002101, - 0x00002103, 0x00002106, 0x00002108, 0x00002109, - 0x00002114, 0x00002114, 0x00002116, 0x00002117, - 0x0000211e, 0x00002123, 0x00002125, 0x00002125, - 0x00002127, 0x00002127, 0x00002129, 0x00002129, - 0x0000212e, 0x0000212e, 0x0000213a, 0x0000213b, - 0x0000214a, 0x0000214a, 0x0000214c, 0x0000214d, - 0x0000214f, 0x0000214f, 0x0000218a, 0x0000218b, - 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, - 0x000023b4, 0x000023db, 0x000023e2, 0x00002426, - 0x00002440, 0x0000244a, 0x0000249c, 0x000024e9, - 0x00002500, 0x000025b6, 0x000025b8, 0x000025c0, - 0x000025c2, 0x000025f7, 0x00002600, 0x0000266e, - 0x00002670, 0x00002767, 0x00002794, 0x000027bf, - 0x00002800, 0x000028ff, 0x00002b00, 0x00002b2f, - 0x00002b45, 0x00002b46, 0x00002b4d, 0x00002b73, - 0x00002b76, 0x00002b95, 0x00002b98, 0x00002bb9, - 0x00002bbd, 0x00002bc8, 0x00002bca, 0x00002bd2, - 0x00002bec, 0x00002bef, 0x00002ce5, 0x00002cea, - 0x00002e80, 0x00002e99, 0x00002e9b, 0x00002ef3, - 0x00002f00, 0x00002fd5, 0x00002ff0, 0x00002ffb, - 0x00003004, 0x00003004, 0x00003012, 0x00003013, - 0x00003020, 0x00003020, 0x00003036, 0x00003037, - 0x0000303e, 0x0000303f, 0x00003190, 0x00003191, - 0x00003196, 0x0000319f, 0x000031c0, 0x000031e3, - 0x00003200, 0x0000321e, 0x0000322a, 0x00003247, - 0x00003250, 0x00003250, 0x00003260, 0x0000327f, - 0x0000328a, 0x000032b0, 0x000032c0, 0x000032fe, - 0x00003300, 0x000033ff, 0x00004dc0, 0x00004dff, - 0x0000a490, 0x0000a4c6, 0x0000a828, 0x0000a82b, - 0x0000a836, 0x0000a837, 0x0000a839, 0x0000a839, - 0x0000aa77, 0x0000aa79, 0x0000fdfd, 0x0000fdfd, - 0x0000ffe4, 0x0000ffe4, 0x0000ffe8, 0x0000ffe8, - 0x0000ffed, 0x0000ffee, 0x0000fffc, 0x0000fffd, - 0x00010137, 0x0001013f, 0x00010179, 0x00010189, - 0x0001018c, 0x0001018e, 0x00010190, 0x0001019b, - 0x000101a0, 0x000101a0, 0x000101d0, 0x000101fc, - 0x00010877, 0x00010878, 0x00010ac8, 0x00010ac8, - 0x0001173f, 0x0001173f, 0x00016b3c, 0x00016b3f, - 0x00016b45, 0x00016b45, 0x0001bc9c, 0x0001bc9c, - 0x0001d000, 0x0001d0f5, 0x0001d100, 0x0001d126, - 0x0001d129, 0x0001d164, 0x0001d16a, 0x0001d16c, - 0x0001d183, 0x0001d184, 0x0001d18c, 0x0001d1a9, - 0x0001d1ae, 0x0001d1e8, 0x0001d200, 0x0001d241, - 0x0001d245, 0x0001d245, 0x0001d300, 0x0001d356, - 0x0001d800, 0x0001d9ff, 0x0001da37, 0x0001da3a, - 0x0001da6d, 0x0001da74, 0x0001da76, 0x0001da83, - 0x0001da85, 0x0001da86, 0x0001f000, 0x0001f02b, - 0x0001f030, 0x0001f093, 0x0001f0a0, 0x0001f0ae, - 0x0001f0b1, 0x0001f0bf, 0x0001f0c1, 0x0001f0cf, - 0x0001f0d1, 0x0001f0f5, 0x0001f110, 0x0001f12e, - 0x0001f130, 0x0001f16b, 0x0001f170, 0x0001f1ac, - 0x0001f1e6, 0x0001f202, 0x0001f210, 0x0001f23b, - 0x0001f240, 0x0001f248, 0x0001f250, 0x0001f251, - 0x0001f260, 0x0001f265, 0x0001f300, 0x0001f3fa, - 0x0001f400, 0x0001f6d4, 0x0001f6e0, 0x0001f6ec, - 0x0001f6f0, 0x0001f6f8, 0x0001f700, 0x0001f773, - 0x0001f780, 0x0001f7d4, 0x0001f800, 0x0001f80b, - 0x0001f810, 0x0001f847, 0x0001f850, 0x0001f859, - 0x0001f860, 0x0001f887, 0x0001f890, 0x0001f8ad, - 0x0001f900, 0x0001f90b, 0x0001f910, 0x0001f93e, - 0x0001f940, 0x0001f94c, 0x0001f950, 0x0001f96b, - 0x0001f980, 0x0001f997, 0x0001f9c0, 0x0001f9c0, - 0x0001f9d0, 0x0001f9e6, 0x00000041, 0x0000005a, - 0x00000061, 0x0000007a, 0x000000aa, 0x000000aa, - 0x000000b5, 0x000000b5, 0x000000ba, 0x000000ba, - 0x000000c0, 0x000000d6, 0x000000d8, 0x000000f6, - 0x000000f8, 0x000002b8, 0x000002bb, 0x000002c1, - 0x000002d0, 0x000002d1, 0x000002e0, 0x000002e4, - 0x000002ee, 0x000002ee, 0x00000370, 0x00000373, - 0x00000376, 0x00000377, 0x0000037a, 0x0000037d, - 0x0000037f, 0x0000037f, 0x00000386, 0x00000386, - 0x00000388, 0x0000038a, 0x0000038c, 0x0000038c, - 0x0000038e, 0x000003a1, 0x000003a3, 0x000003f5, - 0x000003f7, 0x00000482, 0x0000048a, 0x0000052f, - 0x00000531, 0x00000556, 0x00000559, 0x0000055f, - 0x00000561, 0x00000587, 0x00000589, 0x00000589, - 0x00000903, 0x00000939, 0x0000093b, 0x0000093b, - 0x0000093d, 0x00000940, 0x00000949, 0x0000094c, - 0x0000094e, 0x00000950, 0x00000958, 0x00000961, - 0x00000964, 0x00000980, 0x00000982, 0x00000983, - 0x00000985, 0x0000098c, 0x0000098f, 0x00000990, - 0x00000993, 0x000009a8, 0x000009aa, 0x000009b0, - 0x000009b2, 0x000009b2, 0x000009b6, 0x000009b9, - 0x000009bd, 0x000009c0, 0x000009c7, 0x000009c8, - 0x000009cb, 0x000009cc, 0x000009ce, 0x000009ce, - 0x000009d7, 0x000009d7, 0x000009dc, 0x000009dd, - 0x000009df, 0x000009e1, 0x000009e6, 0x000009f1, - 0x000009f4, 0x000009fa, 0x000009fc, 0x000009fd, - 0x00000a03, 0x00000a03, 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, 0x00000a8d, 0x00000a8f, 0x00000a91, - 0x00000a93, 0x00000aa8, 0x00000aaa, 0x00000ab0, - 0x00000ab2, 0x00000ab3, 0x00000ab5, 0x00000ab9, - 0x00000abd, 0x00000ac0, 0x00000ac9, 0x00000ac9, - 0x00000acb, 0x00000acc, 0x00000ad0, 0x00000ad0, - 0x00000ae0, 0x00000ae1, 0x00000ae6, 0x00000af0, - 0x00000af9, 0x00000af9, 0x00000b02, 0x00000b03, - 0x00000b05, 0x00000b0c, 0x00000b0f, 0x00000b10, - 0x00000b13, 0x00000b28, 0x00000b2a, 0x00000b30, - 0x00000b32, 0x00000b33, 0x00000b35, 0x00000b39, - 0x00000b3d, 0x00000b3e, 0x00000b40, 0x00000b40, - 0x00000b47, 0x00000b48, 0x00000b4b, 0x00000b4c, - 0x00000b57, 0x00000b57, 0x00000b5c, 0x00000b5d, - 0x00000b5f, 0x00000b61, 0x00000b66, 0x00000b77, - 0x00000b83, 0x00000b83, 0x00000b85, 0x00000b8a, - 0x00000b8e, 0x00000b90, 0x00000b92, 0x00000b95, - 0x00000b99, 0x00000b9a, 0x00000b9c, 0x00000b9c, - 0x00000b9e, 0x00000b9f, 0x00000ba3, 0x00000ba4, - 0x00000ba8, 0x00000baa, 0x00000bae, 0x00000bb9, - 0x00000bbe, 0x00000bbf, 0x00000bc1, 0x00000bc2, - 0x00000bc6, 0x00000bc8, 0x00000bca, 0x00000bcc, - 0x00000bd0, 0x00000bd0, 0x00000bd7, 0x00000bd7, - 0x00000be6, 0x00000bf2, 0x00000c01, 0x00000c03, - 0x00000c05, 0x00000c0c, 0x00000c0e, 0x00000c10, - 0x00000c12, 0x00000c28, 0x00000c2a, 0x00000c39, - 0x00000c3d, 0x00000c3d, 0x00000c41, 0x00000c44, - 0x00000c58, 0x00000c5a, 0x00000c60, 0x00000c61, - 0x00000c66, 0x00000c6f, 0x00000c7f, 0x00000c80, - 0x00000c82, 0x00000c83, 0x00000c85, 0x00000c8c, - 0x00000c8e, 0x00000c90, 0x00000c92, 0x00000ca8, - 0x00000caa, 0x00000cb3, 0x00000cb5, 0x00000cb9, - 0x00000cbd, 0x00000cc4, 0x00000cc6, 0x00000cc8, - 0x00000cca, 0x00000ccb, 0x00000cd5, 0x00000cd6, - 0x00000cde, 0x00000cde, 0x00000ce0, 0x00000ce1, - 0x00000ce6, 0x00000cef, 0x00000cf1, 0x00000cf2, - 0x00000d02, 0x00000d03, 0x00000d05, 0x00000d0c, - 0x00000d0e, 0x00000d10, 0x00000d12, 0x00000d3a, - 0x00000d3d, 0x00000d40, 0x00000d46, 0x00000d48, - 0x00000d4a, 0x00000d4c, 0x00000d4e, 0x00000d4f, - 0x00000d54, 0x00000d61, 0x00000d66, 0x00000d7f, - 0x00000d82, 0x00000d83, 0x00000d85, 0x00000d96, - 0x00000d9a, 0x00000db1, 0x00000db3, 0x00000dbb, - 0x00000dbd, 0x00000dbd, 0x00000dc0, 0x00000dc6, - 0x00000dcf, 0x00000dd1, 0x00000dd8, 0x00000ddf, - 0x00000de6, 0x00000def, 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, 0x00000edf, - 0x00000f00, 0x00000f17, 0x00000f1a, 0x00000f34, - 0x00000f36, 0x00000f36, 0x00000f38, 0x00000f38, - 0x00000f3e, 0x00000f47, 0x00000f49, 0x00000f6c, - 0x00000f7f, 0x00000f7f, 0x00000f85, 0x00000f85, - 0x00000f88, 0x00000f8c, 0x00000fbe, 0x00000fc5, - 0x00000fc7, 0x00000fcc, 0x00000fce, 0x00000fda, - 0x00001000, 0x0000102c, 0x00001031, 0x00001031, - 0x00001038, 0x00001038, 0x0000103b, 0x0000103c, - 0x0000103f, 0x00001057, 0x0000105a, 0x0000105d, - 0x00001061, 0x00001070, 0x00001075, 0x00001081, - 0x00001083, 0x00001084, 0x00001087, 0x0000108c, - 0x0000108e, 0x0000109c, 0x0000109e, 0x000010c5, - 0x000010c7, 0x000010c7, 0x000010cd, 0x000010cd, - 0x000010d0, 0x00001248, 0x0000124a, 0x0000124d, - 0x00001250, 0x00001256, 0x00001258, 0x00001258, - 0x0000125a, 0x0000125d, 0x00001260, 0x00001288, - 0x0000128a, 0x0000128d, 0x00001290, 0x000012b0, - 0x000012b2, 0x000012b5, 0x000012b8, 0x000012be, - 0x000012c0, 0x000012c0, 0x000012c2, 0x000012c5, - 0x000012c8, 0x000012d6, 0x000012d8, 0x00001310, - 0x00001312, 0x00001315, 0x00001318, 0x0000135a, - 0x00001360, 0x0000137c, 0x00001380, 0x0000138f, - 0x000013a0, 0x000013f5, 0x000013f8, 0x000013fd, - 0x00001401, 0x0000167f, 0x00001681, 0x0000169a, - 0x000016a0, 0x000016f8, 0x00001700, 0x0000170c, - 0x0000170e, 0x00001711, 0x00001720, 0x00001731, - 0x00001735, 0x00001736, 0x00001740, 0x00001751, - 0x00001760, 0x0000176c, 0x0000176e, 0x00001770, - 0x00001780, 0x000017b3, 0x000017b6, 0x000017b6, - 0x000017be, 0x000017c5, 0x000017c7, 0x000017c8, - 0x000017d4, 0x000017da, 0x000017dc, 0x000017dc, - 0x000017e0, 0x000017e9, 0x00001810, 0x00001819, - 0x00001820, 0x00001877, 0x00001880, 0x00001884, - 0x00001887, 0x000018a8, 0x000018aa, 0x000018aa, - 0x000018b0, 0x000018f5, 0x00001900, 0x0000191e, - 0x00001923, 0x00001926, 0x00001929, 0x0000192b, - 0x00001930, 0x00001931, 0x00001933, 0x00001938, - 0x00001946, 0x0000196d, 0x00001970, 0x00001974, - 0x00001980, 0x000019ab, 0x000019b0, 0x000019c9, - 0x000019d0, 0x000019da, 0x00001a00, 0x00001a16, - 0x00001a19, 0x00001a1a, 0x00001a1e, 0x00001a55, - 0x00001a57, 0x00001a57, 0x00001a61, 0x00001a61, - 0x00001a63, 0x00001a64, 0x00001a6d, 0x00001a72, - 0x00001a80, 0x00001a89, 0x00001a90, 0x00001a99, - 0x00001aa0, 0x00001aad, 0x00001b04, 0x00001b33, - 0x00001b35, 0x00001b35, 0x00001b3b, 0x00001b3b, - 0x00001b3d, 0x00001b41, 0x00001b43, 0x00001b4b, - 0x00001b50, 0x00001b6a, 0x00001b74, 0x00001b7c, - 0x00001b82, 0x00001ba1, 0x00001ba6, 0x00001ba7, - 0x00001baa, 0x00001baa, 0x00001bae, 0x00001be5, - 0x00001be7, 0x00001be7, 0x00001bea, 0x00001bec, - 0x00001bee, 0x00001bee, 0x00001bf2, 0x00001bf3, - 0x00001bfc, 0x00001c2b, 0x00001c34, 0x00001c35, - 0x00001c3b, 0x00001c49, 0x00001c4d, 0x00001c88, + 0x00017000, 0x000187ec, 0x00018800, 0x00018af2, + 0x0001b000, 0x0001b11e, 0x0001b170, 0x0001b2fb, + 0x0001bc00, 0x0001bc6a, 0x0001bc70, 0x0001bc7c, + 0x0001bc80, 0x0001bc88, 0x0001bc90, 0x0001bc99, + 0x0001e800, 0x0001e8c4, 0x0001ee00, 0x0001ee03, + 0x0001ee05, 0x0001ee1f, 0x0001ee21, 0x0001ee22, + 0x0001ee24, 0x0001ee24, 0x0001ee27, 0x0001ee27, + 0x0001ee29, 0x0001ee32, 0x0001ee34, 0x0001ee37, + 0x0001ee39, 0x0001ee39, 0x0001ee3b, 0x0001ee3b, + 0x0001ee42, 0x0001ee42, 0x0001ee47, 0x0001ee47, + 0x0001ee49, 0x0001ee49, 0x0001ee4b, 0x0001ee4b, + 0x0001ee4d, 0x0001ee4f, 0x0001ee51, 0x0001ee52, + 0x0001ee54, 0x0001ee54, 0x0001ee57, 0x0001ee57, + 0x0001ee59, 0x0001ee59, 0x0001ee5b, 0x0001ee5b, + 0x0001ee5d, 0x0001ee5d, 0x0001ee5f, 0x0001ee5f, + 0x0001ee61, 0x0001ee62, 0x0001ee64, 0x0001ee64, + 0x0001ee67, 0x0001ee6a, 0x0001ee6c, 0x0001ee72, + 0x0001ee74, 0x0001ee77, 0x0001ee79, 0x0001ee7c, + 0x0001ee7e, 0x0001ee7e, 0x0001ee80, 0x0001ee89, + 0x0001ee8b, 0x0001ee9b, 0x0001eea1, 0x0001eea3, + 0x0001eea5, 0x0001eea9, 0x0001eeab, 0x0001eebb, + 0x00020000, 0x0002a6d6, 0x0002a700, 0x0002b734, + 0x0002b740, 0x0002b81d, 0x0002b820, 0x0002cea1, + 0x0002ceb0, 0x0002ebe0, 0x0002f800, 0x0002fa1d, + 0x0000005f, 0x0000005f, 0x0000203f, 0x00002040, + 0x00002054, 0x00002054, 0x0000fe33, 0x0000fe34, + 0x0000fe4d, 0x0000fe4f, 0x0000ff3f, 0x0000ff3f, + 0x0000002d, 0x0000002d, 0x0000058a, 0x0000058a, + 0x000005be, 0x000005be, 0x00001400, 0x00001400, + 0x00001806, 0x00001806, 0x00002010, 0x00002015, + 0x00002e17, 0x00002e17, 0x00002e1a, 0x00002e1a, + 0x00002e3a, 0x00002e3b, 0x00002e40, 0x00002e40, + 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, + 0x00002308, 0x00002308, 0x0000230a, 0x0000230a, + 0x00002329, 0x00002329, 0x00002768, 0x00002768, + 0x0000276a, 0x0000276a, 0x0000276c, 0x0000276c, + 0x0000276e, 0x0000276e, 0x00002770, 0x00002770, + 0x00002772, 0x00002772, 0x00002774, 0x00002774, + 0x000027c5, 0x000027c5, 0x000027e6, 0x000027e6, + 0x000027e8, 0x000027e8, 0x000027ea, 0x000027ea, + 0x000027ec, 0x000027ec, 0x000027ee, 0x000027ee, + 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, + 0x00002e22, 0x00002e22, 0x00002e24, 0x00002e24, + 0x00002e26, 0x00002e26, 0x00002e28, 0x00002e28, + 0x00002e42, 0x00002e42, 0x00003008, 0x00003008, + 0x0000300a, 0x0000300a, 0x0000300c, 0x0000300c, + 0x0000300e, 0x0000300e, 0x00003010, 0x00003010, + 0x00003014, 0x00003014, 0x00003016, 0x00003016, + 0x00003018, 0x00003018, 0x0000301a, 0x0000301a, + 0x0000301d, 0x0000301d, 0x0000fd3f, 0x0000fd3f, + 0x0000fe17, 0x0000fe17, 0x0000fe35, 0x0000fe35, + 0x0000fe37, 0x0000fe37, 0x0000fe39, 0x0000fe39, + 0x0000fe3b, 0x0000fe3b, 0x0000fe3d, 0x0000fe3d, + 0x0000fe3f, 0x0000fe3f, 0x0000fe41, 0x0000fe41, + 0x0000fe43, 0x0000fe43, 0x0000fe47, 0x0000fe47, + 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, 0x00002309, 0x00002309, + 0x0000230b, 0x0000230b, 0x0000232a, 0x0000232a, + 0x00002769, 0x00002769, 0x0000276b, 0x0000276b, + 0x0000276d, 0x0000276d, 0x0000276f, 0x0000276f, + 0x00002771, 0x00002771, 0x00002773, 0x00002773, + 0x00002775, 0x00002775, 0x000027c6, 0x000027c6, + 0x000027e7, 0x000027e7, 0x000027e9, 0x000027e9, + 0x000027eb, 0x000027eb, 0x000027ed, 0x000027ed, + 0x000027ef, 0x000027ef, 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, 0x00002e23, 0x00002e23, + 0x00002e25, 0x00002e25, 0x00002e27, 0x00002e27, + 0x00002e29, 0x00002e29, 0x00003009, 0x00003009, + 0x0000300b, 0x0000300b, 0x0000300d, 0x0000300d, + 0x0000300f, 0x0000300f, 0x00003011, 0x00003011, + 0x00003015, 0x00003015, 0x00003017, 0x00003017, + 0x00003019, 0x00003019, 0x0000301b, 0x0000301b, + 0x0000301e, 0x0000301f, 0x0000fd3e, 0x0000fd3e, + 0x0000fe18, 0x0000fe18, 0x0000fe36, 0x0000fe36, + 0x0000fe38, 0x0000fe38, 0x0000fe3a, 0x0000fe3a, + 0x0000fe3c, 0x0000fe3c, 0x0000fe3e, 0x0000fe3e, + 0x0000fe40, 0x0000fe40, 0x0000fe42, 0x0000fe42, + 0x0000fe44, 0x0000fe44, 0x0000fe48, 0x0000fe48, + 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, 0x000000a7, 0x000000a7, + 0x000000b6, 0x000000b7, 0x000000bf, 0x000000bf, + 0x0000037e, 0x0000037e, 0x00000387, 0x00000387, + 0x0000055a, 0x0000055f, 0x00000589, 0x00000589, + 0x000005c0, 0x000005c0, 0x000005c3, 0x000005c3, + 0x000005c6, 0x000005c6, 0x000005f3, 0x000005f4, + 0x00000609, 0x0000060a, 0x0000060c, 0x0000060d, + 0x0000061b, 0x0000061b, 0x0000061e, 0x0000061f, + 0x0000066a, 0x0000066d, 0x000006d4, 0x000006d4, + 0x00000700, 0x0000070d, 0x000007f7, 0x000007f9, + 0x00000830, 0x0000083e, 0x0000085e, 0x0000085e, + 0x00000964, 0x00000965, 0x00000970, 0x00000970, + 0x000009fd, 0x000009fd, 0x00000af0, 0x00000af0, + 0x00000df4, 0x00000df4, 0x00000e4f, 0x00000e4f, + 0x00000e5a, 0x00000e5b, 0x00000f04, 0x00000f12, + 0x00000f14, 0x00000f14, 0x00000f85, 0x00000f85, + 0x00000fd0, 0x00000fd4, 0x00000fd9, 0x00000fda, + 0x0000104a, 0x0000104f, 0x000010fb, 0x000010fb, + 0x00001360, 0x00001368, 0x0000166d, 0x0000166e, + 0x000016eb, 0x000016ed, 0x00001735, 0x00001736, + 0x000017d4, 0x000017d6, 0x000017d8, 0x000017da, + 0x00001800, 0x00001805, 0x00001807, 0x0000180a, + 0x00001944, 0x00001945, 0x00001a1e, 0x00001a1f, + 0x00001aa0, 0x00001aa6, 0x00001aa8, 0x00001aad, + 0x00001b5a, 0x00001b60, 0x00001bfc, 0x00001bff, + 0x00001c3b, 0x00001c3f, 0x00001c7e, 0x00001c7f, 0x00001cc0, 0x00001cc7, 0x00001cd3, 0x00001cd3, - 0x00001ce1, 0x00001ce1, 0x00001ce9, 0x00001cec, - 0x00001cee, 0x00001cf3, 0x00001cf5, 0x00001cf7, - 0x00001d00, 0x00001dbf, 0x00001e00, 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, 0x00002090, 0x0000209c, - 0x00002102, 0x00002102, 0x00002107, 0x00002107, - 0x0000210a, 0x00002113, 0x00002115, 0x00002115, - 0x00002119, 0x0000211d, 0x00002124, 0x00002124, - 0x00002126, 0x00002126, 0x00002128, 0x00002128, - 0x0000212a, 0x0000212d, 0x0000212f, 0x00002139, - 0x0000213c, 0x0000213f, 0x00002145, 0x00002149, - 0x0000214e, 0x0000214f, 0x00002160, 0x00002188, - 0x00002336, 0x0000237a, 0x00002395, 0x00002395, - 0x0000249c, 0x000024e9, 0x000026ac, 0x000026ac, - 0x00002800, 0x000028ff, 0x00002c00, 0x00002c2e, - 0x00002c30, 0x00002c5e, 0x00002c60, 0x00002ce4, - 0x00002ceb, 0x00002cee, 0x00002cf2, 0x00002cf3, - 0x00002d00, 0x00002d25, 0x00002d27, 0x00002d27, - 0x00002d2d, 0x00002d2d, 0x00002d30, 0x00002d67, - 0x00002d6f, 0x00002d70, 0x00002d80, 0x00002d96, - 0x00002da0, 0x00002da6, 0x00002da8, 0x00002dae, - 0x00002db0, 0x00002db6, 0x00002db8, 0x00002dbe, - 0x00002dc0, 0x00002dc6, 0x00002dc8, 0x00002dce, - 0x00002dd0, 0x00002dd6, 0x00002dd8, 0x00002dde, - 0x00003005, 0x00003007, 0x00003021, 0x00003029, - 0x0000302e, 0x0000302f, 0x00003031, 0x00003035, - 0x00003038, 0x0000303c, 0x00003041, 0x00003096, - 0x0000309d, 0x0000309f, 0x000030a1, 0x000030fa, - 0x000030fc, 0x000030ff, 0x00003105, 0x0000312e, - 0x00003131, 0x0000318e, 0x00003190, 0x000031ba, - 0x000031f0, 0x0000321c, 0x00003220, 0x0000324f, - 0x00003260, 0x0000327b, 0x0000327f, 0x000032b0, - 0x000032c0, 0x000032cb, 0x000032d0, 0x000032fe, - 0x00003300, 0x00003376, 0x0000337b, 0x000033dd, - 0x000033e0, 0x000033fe, 0x00003400, 0x00004db5, - 0x00004e00, 0x0000a48c, 0x0000a4d0, 0x0000a60c, + 0x00002016, 0x00002017, 0x00002020, 0x00002027, + 0x00002030, 0x00002038, 0x0000203b, 0x0000203e, + 0x00002041, 0x00002043, 0x00002047, 0x00002051, + 0x00002053, 0x00002053, 0x00002055, 0x0000205e, + 0x00002cf9, 0x00002cfc, 0x00002cfe, 0x00002cff, + 0x00002d70, 0x00002d70, 0x00002e00, 0x00002e01, + 0x00002e06, 0x00002e08, 0x00002e0b, 0x00002e0b, + 0x00002e0e, 0x00002e16, 0x00002e18, 0x00002e19, + 0x00002e1b, 0x00002e1b, 0x00002e1e, 0x00002e1f, + 0x00002e2a, 0x00002e2e, 0x00002e30, 0x00002e39, + 0x00002e3c, 0x00002e3f, 0x00002e41, 0x00002e41, + 0x00002e43, 0x00002e49, 0x00003001, 0x00003003, + 0x0000303d, 0x0000303d, 0x000030fb, 0x000030fb, + 0x0000a4fe, 0x0000a4ff, 0x0000a60d, 0x0000a60f, + 0x0000a673, 0x0000a673, 0x0000a67e, 0x0000a67e, + 0x0000a6f2, 0x0000a6f7, 0x0000a874, 0x0000a877, + 0x0000a8ce, 0x0000a8cf, 0x0000a8f8, 0x0000a8fa, + 0x0000a8fc, 0x0000a8fc, 0x0000a92e, 0x0000a92f, + 0x0000a95f, 0x0000a95f, 0x0000a9c1, 0x0000a9cd, + 0x0000a9de, 0x0000a9df, 0x0000aa5c, 0x0000aa5f, + 0x0000aade, 0x0000aadf, 0x0000aaf0, 0x0000aaf1, + 0x0000abeb, 0x0000abeb, 0x0000fe10, 0x0000fe16, + 0x0000fe19, 0x0000fe19, 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, 0x0000ff65, 0x00010100, 0x00010102, + 0x0001039f, 0x0001039f, 0x000103d0, 0x000103d0, + 0x0001056f, 0x0001056f, 0x00010857, 0x00010857, + 0x0001091f, 0x0001091f, 0x0001093f, 0x0001093f, + 0x00010a50, 0x00010a58, 0x00010a7f, 0x00010a7f, + 0x00010af0, 0x00010af6, 0x00010b39, 0x00010b3f, + 0x00010b99, 0x00010b9c, 0x00011047, 0x0001104d, + 0x000110bb, 0x000110bc, 0x000110be, 0x000110c1, + 0x00011140, 0x00011143, 0x00011174, 0x00011175, + 0x000111c5, 0x000111c9, 0x000111cd, 0x000111cd, + 0x000111db, 0x000111db, 0x000111dd, 0x000111df, + 0x00011238, 0x0001123d, 0x000112a9, 0x000112a9, + 0x0001144b, 0x0001144f, 0x0001145b, 0x0001145b, + 0x0001145d, 0x0001145d, 0x000114c6, 0x000114c6, + 0x000115c1, 0x000115d7, 0x00011641, 0x00011643, + 0x00011660, 0x0001166c, 0x0001173c, 0x0001173e, + 0x00011a3f, 0x00011a46, 0x00011a9a, 0x00011a9c, + 0x00011a9e, 0x00011aa2, 0x00011c41, 0x00011c45, + 0x00011c70, 0x00011c71, 0x00012470, 0x00012474, + 0x00016a6e, 0x00016a6f, 0x00016af5, 0x00016af5, + 0x00016b37, 0x00016b3b, 0x00016b44, 0x00016b44, + 0x0001bc9f, 0x0001bc9f, 0x0001da87, 0x0001da8b, + 0x0001e95e, 0x0001e95f, 0x0000002b, 0x0000002b, + 0x0000003c, 0x0000003e, 0x0000007c, 0x0000007c, + 0x0000007e, 0x0000007e, 0x000000ac, 0x000000ac, + 0x000000b1, 0x000000b1, 0x000000d7, 0x000000d7, + 0x000000f7, 0x000000f7, 0x000003f6, 0x000003f6, + 0x00000606, 0x00000608, 0x00002044, 0x00002044, + 0x00002052, 0x00002052, 0x0000207a, 0x0000207c, + 0x0000208a, 0x0000208c, 0x00002118, 0x00002118, + 0x00002140, 0x00002144, 0x0000214b, 0x0000214b, + 0x00002190, 0x00002194, 0x0000219a, 0x0000219b, + 0x000021a0, 0x000021a0, 0x000021a3, 0x000021a3, + 0x000021a6, 0x000021a6, 0x000021ae, 0x000021ae, + 0x000021ce, 0x000021cf, 0x000021d2, 0x000021d2, + 0x000021d4, 0x000021d4, 0x000021f4, 0x000022ff, + 0x00002320, 0x00002321, 0x0000237c, 0x0000237c, + 0x0000239b, 0x000023b3, 0x000023dc, 0x000023e1, + 0x000025b7, 0x000025b7, 0x000025c1, 0x000025c1, + 0x000025f8, 0x000025ff, 0x0000266f, 0x0000266f, + 0x000027c0, 0x000027c4, 0x000027c7, 0x000027e5, + 0x000027f0, 0x000027ff, 0x00002900, 0x00002982, + 0x00002999, 0x000029d7, 0x000029dc, 0x000029fb, + 0x000029fe, 0x00002aff, 0x00002b30, 0x00002b44, + 0x00002b47, 0x00002b4c, 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, + 0x0001eef0, 0x0001eef1, 0x00000024, 0x00000024, + 0x000000a2, 0x000000a5, 0x0000058f, 0x0000058f, + 0x0000060b, 0x0000060b, 0x000009f2, 0x000009f3, + 0x000009fb, 0x000009fb, 0x00000af1, 0x00000af1, + 0x00000bf9, 0x00000bf9, 0x00000e3f, 0x00000e3f, + 0x000017db, 0x000017db, 0x000020a0, 0x000020bf, + 0x0000a838, 0x0000a838, 0x0000fdfc, 0x0000fdfc, + 0x0000fe69, 0x0000fe69, 0x0000ff04, 0x0000ff04, + 0x0000ffe0, 0x0000ffe1, 0x0000ffe5, 0x0000ffe6, + 0x0000005e, 0x0000005e, 0x00000060, 0x00000060, + 0x000000a8, 0x000000a8, 0x000000af, 0x000000af, + 0x000000b4, 0x000000b4, 0x000000b8, 0x000000b8, + 0x000002c2, 0x000002c5, 0x000002d2, 0x000002df, + 0x000002e5, 0x000002eb, 0x000002ed, 0x000002ed, + 0x000002ef, 0x000002ff, 0x00000375, 0x00000375, + 0x00000384, 0x00000385, 0x00001fbd, 0x00001fbd, + 0x00001fbf, 0x00001fc1, 0x00001fcd, 0x00001fcf, + 0x00001fdd, 0x00001fdf, 0x00001fed, 0x00001fef, + 0x00001ffd, 0x00001ffe, 0x0000309b, 0x0000309c, + 0x0000a700, 0x0000a716, 0x0000a720, 0x0000a721, + 0x0000a789, 0x0000a78a, 0x0000ab5b, 0x0000ab5b, + 0x0000fbb2, 0x0000fbc1, 0x0000ff3e, 0x0000ff3e, + 0x0000ff40, 0x0000ff40, 0x0000ffe3, 0x0000ffe3, + 0x0001f3fb, 0x0001f3ff, 0x000000a6, 0x000000a6, + 0x000000a9, 0x000000a9, 0x000000ae, 0x000000ae, + 0x000000b0, 0x000000b0, 0x00000482, 0x00000482, + 0x0000058d, 0x0000058e, 0x0000060e, 0x0000060f, + 0x000006de, 0x000006de, 0x000006e9, 0x000006e9, + 0x000006fd, 0x000006fe, 0x000007f6, 0x000007f6, + 0x000009fa, 0x000009fa, 0x00000b70, 0x00000b70, + 0x00000bf3, 0x00000bf8, 0x00000bfa, 0x00000bfa, + 0x00000c7f, 0x00000c7f, 0x00000d4f, 0x00000d4f, + 0x00000d79, 0x00000d79, 0x00000f01, 0x00000f03, + 0x00000f13, 0x00000f13, 0x00000f15, 0x00000f17, + 0x00000f1a, 0x00000f1f, 0x00000f34, 0x00000f34, + 0x00000f36, 0x00000f36, 0x00000f38, 0x00000f38, + 0x00000fbe, 0x00000fc5, 0x00000fc7, 0x00000fcc, + 0x00000fce, 0x00000fcf, 0x00000fd5, 0x00000fd8, + 0x0000109e, 0x0000109f, 0x00001390, 0x00001399, + 0x00001940, 0x00001940, 0x000019de, 0x000019ff, + 0x00001b61, 0x00001b6a, 0x00001b74, 0x00001b7c, + 0x00002100, 0x00002101, 0x00002103, 0x00002106, + 0x00002108, 0x00002109, 0x00002114, 0x00002114, + 0x00002116, 0x00002117, 0x0000211e, 0x00002123, + 0x00002125, 0x00002125, 0x00002127, 0x00002127, + 0x00002129, 0x00002129, 0x0000212e, 0x0000212e, + 0x0000213a, 0x0000213b, 0x0000214a, 0x0000214a, + 0x0000214c, 0x0000214d, 0x0000214f, 0x0000214f, + 0x0000218a, 0x0000218b, 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, 0x000023b4, 0x000023db, + 0x000023e2, 0x00002426, 0x00002440, 0x0000244a, + 0x0000249c, 0x000024e9, 0x00002500, 0x000025b6, + 0x000025b8, 0x000025c0, 0x000025c2, 0x000025f7, + 0x00002600, 0x0000266e, 0x00002670, 0x00002767, + 0x00002794, 0x000027bf, 0x00002800, 0x000028ff, + 0x00002b00, 0x00002b2f, 0x00002b45, 0x00002b46, + 0x00002b4d, 0x00002b73, 0x00002b76, 0x00002b95, + 0x00002b98, 0x00002bb9, 0x00002bbd, 0x00002bc8, + 0x00002bca, 0x00002bd2, 0x00002bec, 0x00002bef, + 0x00002ce5, 0x00002cea, 0x00002e80, 0x00002e99, + 0x00002e9b, 0x00002ef3, 0x00002f00, 0x00002fd5, + 0x00002ff0, 0x00002ffb, 0x00003004, 0x00003004, + 0x00003012, 0x00003013, 0x00003020, 0x00003020, + 0x00003036, 0x00003037, 0x0000303e, 0x0000303f, + 0x00003190, 0x00003191, 0x00003196, 0x0000319f, + 0x000031c0, 0x000031e3, 0x00003200, 0x0000321e, + 0x0000322a, 0x00003247, 0x00003250, 0x00003250, + 0x00003260, 0x0000327f, 0x0000328a, 0x000032b0, + 0x000032c0, 0x000032fe, 0x00003300, 0x000033ff, + 0x00004dc0, 0x00004dff, 0x0000a490, 0x0000a4c6, + 0x0000a828, 0x0000a82b, 0x0000a836, 0x0000a837, + 0x0000a839, 0x0000a839, 0x0000aa77, 0x0000aa79, + 0x0000fdfd, 0x0000fdfd, 0x0000ffe4, 0x0000ffe4, + 0x0000ffe8, 0x0000ffe8, 0x0000ffed, 0x0000ffee, + 0x0000fffc, 0x0000fffd, 0x00010137, 0x0001013f, + 0x00010179, 0x00010189, 0x0001018c, 0x0001018e, + 0x00010190, 0x0001019b, 0x000101a0, 0x000101a0, + 0x000101d0, 0x000101fc, 0x00010877, 0x00010878, + 0x00010ac8, 0x00010ac8, 0x0001173f, 0x0001173f, + 0x00016b3c, 0x00016b3f, 0x00016b45, 0x00016b45, + 0x0001bc9c, 0x0001bc9c, 0x0001d000, 0x0001d0f5, + 0x0001d100, 0x0001d126, 0x0001d129, 0x0001d164, + 0x0001d16a, 0x0001d16c, 0x0001d183, 0x0001d184, + 0x0001d18c, 0x0001d1a9, 0x0001d1ae, 0x0001d1e8, + 0x0001d200, 0x0001d241, 0x0001d245, 0x0001d245, + 0x0001d300, 0x0001d356, 0x0001d800, 0x0001d9ff, + 0x0001da37, 0x0001da3a, 0x0001da6d, 0x0001da74, + 0x0001da76, 0x0001da83, 0x0001da85, 0x0001da86, + 0x0001f000, 0x0001f02b, 0x0001f030, 0x0001f093, + 0x0001f0a0, 0x0001f0ae, 0x0001f0b1, 0x0001f0bf, + 0x0001f0c1, 0x0001f0cf, 0x0001f0d1, 0x0001f0f5, + 0x0001f110, 0x0001f12e, 0x0001f130, 0x0001f16b, + 0x0001f170, 0x0001f1ac, 0x0001f1e6, 0x0001f202, + 0x0001f210, 0x0001f23b, 0x0001f240, 0x0001f248, + 0x0001f250, 0x0001f251, 0x0001f260, 0x0001f265, + 0x0001f300, 0x0001f3fa, 0x0001f400, 0x0001f6d4, + 0x0001f6e0, 0x0001f6ec, 0x0001f6f0, 0x0001f6f8, + 0x0001f700, 0x0001f773, 0x0001f780, 0x0001f7d4, + 0x0001f800, 0x0001f80b, 0x0001f810, 0x0001f847, + 0x0001f850, 0x0001f859, 0x0001f860, 0x0001f887, + 0x0001f890, 0x0001f8ad, 0x0001f900, 0x0001f90b, + 0x0001f910, 0x0001f93e, 0x0001f940, 0x0001f94c, + 0x0001f950, 0x0001f96b, 0x0001f980, 0x0001f997, + 0x0001f9c0, 0x0001f9c0, 0x0001f9d0, 0x0001f9e6, + 0x00000041, 0x0000005a, 0x00000061, 0x0000007a, + 0x000000aa, 0x000000aa, 0x000000b5, 0x000000b5, + 0x000000ba, 0x000000ba, 0x000000c0, 0x000000d6, + 0x000000d8, 0x000000f6, 0x000000f8, 0x000002b8, + 0x000002bb, 0x000002c1, 0x000002d0, 0x000002d1, + 0x000002e0, 0x000002e4, 0x000002ee, 0x000002ee, + 0x00000370, 0x00000373, 0x00000376, 0x00000377, + 0x0000037a, 0x0000037d, 0x0000037f, 0x0000037f, + 0x00000386, 0x00000386, 0x00000388, 0x0000038a, + 0x0000038c, 0x0000038c, 0x0000038e, 0x000003a1, + 0x000003a3, 0x000003f5, 0x000003f7, 0x00000482, + 0x0000048a, 0x0000052f, 0x00000531, 0x00000556, + 0x00000559, 0x0000055f, 0x00000561, 0x00000587, + 0x00000589, 0x00000589, 0x00000903, 0x00000939, + 0x0000093b, 0x0000093b, 0x0000093d, 0x00000940, + 0x00000949, 0x0000094c, 0x0000094e, 0x00000950, + 0x00000958, 0x00000961, 0x00000964, 0x00000980, + 0x00000982, 0x00000983, 0x00000985, 0x0000098c, + 0x0000098f, 0x00000990, 0x00000993, 0x000009a8, + 0x000009aa, 0x000009b0, 0x000009b2, 0x000009b2, + 0x000009b6, 0x000009b9, 0x000009bd, 0x000009c0, + 0x000009c7, 0x000009c8, 0x000009cb, 0x000009cc, + 0x000009ce, 0x000009ce, 0x000009d7, 0x000009d7, + 0x000009dc, 0x000009dd, 0x000009df, 0x000009e1, + 0x000009e6, 0x000009f1, 0x000009f4, 0x000009fa, + 0x000009fc, 0x000009fd, 0x00000a03, 0x00000a03, + 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, 0x00000a8d, + 0x00000a8f, 0x00000a91, 0x00000a93, 0x00000aa8, + 0x00000aaa, 0x00000ab0, 0x00000ab2, 0x00000ab3, + 0x00000ab5, 0x00000ab9, 0x00000abd, 0x00000ac0, + 0x00000ac9, 0x00000ac9, 0x00000acb, 0x00000acc, + 0x00000ad0, 0x00000ad0, 0x00000ae0, 0x00000ae1, + 0x00000ae6, 0x00000af0, 0x00000af9, 0x00000af9, + 0x00000b02, 0x00000b03, 0x00000b05, 0x00000b0c, + 0x00000b0f, 0x00000b10, 0x00000b13, 0x00000b28, + 0x00000b2a, 0x00000b30, 0x00000b32, 0x00000b33, + 0x00000b35, 0x00000b39, 0x00000b3d, 0x00000b3e, + 0x00000b40, 0x00000b40, 0x00000b47, 0x00000b48, + 0x00000b4b, 0x00000b4c, 0x00000b57, 0x00000b57, + 0x00000b5c, 0x00000b5d, 0x00000b5f, 0x00000b61, + 0x00000b66, 0x00000b77, 0x00000b83, 0x00000b83, + 0x00000b85, 0x00000b8a, 0x00000b8e, 0x00000b90, + 0x00000b92, 0x00000b95, 0x00000b99, 0x00000b9a, + 0x00000b9c, 0x00000b9c, 0x00000b9e, 0x00000b9f, + 0x00000ba3, 0x00000ba4, 0x00000ba8, 0x00000baa, + 0x00000bae, 0x00000bb9, 0x00000bbe, 0x00000bbf, + 0x00000bc1, 0x00000bc2, 0x00000bc6, 0x00000bc8, + 0x00000bca, 0x00000bcc, 0x00000bd0, 0x00000bd0, + 0x00000bd7, 0x00000bd7, 0x00000be6, 0x00000bf2, + 0x00000c01, 0x00000c03, 0x00000c05, 0x00000c0c, + 0x00000c0e, 0x00000c10, 0x00000c12, 0x00000c28, + 0x00000c2a, 0x00000c39, 0x00000c3d, 0x00000c3d, + 0x00000c41, 0x00000c44, 0x00000c58, 0x00000c5a, + 0x00000c60, 0x00000c61, 0x00000c66, 0x00000c6f, + 0x00000c7f, 0x00000c80, 0x00000c82, 0x00000c83, + 0x00000c85, 0x00000c8c, 0x00000c8e, 0x00000c90, + 0x00000c92, 0x00000ca8, 0x00000caa, 0x00000cb3, + 0x00000cb5, 0x00000cb9, 0x00000cbd, 0x00000cc4, + 0x00000cc6, 0x00000cc8, 0x00000cca, 0x00000ccb, + 0x00000cd5, 0x00000cd6, 0x00000cde, 0x00000cde, + 0x00000ce0, 0x00000ce1, 0x00000ce6, 0x00000cef, + 0x00000cf1, 0x00000cf2, 0x00000d02, 0x00000d03, + 0x00000d05, 0x00000d0c, 0x00000d0e, 0x00000d10, + 0x00000d12, 0x00000d3a, 0x00000d3d, 0x00000d40, + 0x00000d46, 0x00000d48, 0x00000d4a, 0x00000d4c, + 0x00000d4e, 0x00000d4f, 0x00000d54, 0x00000d61, + 0x00000d66, 0x00000d7f, 0x00000d82, 0x00000d83, + 0x00000d85, 0x00000d96, 0x00000d9a, 0x00000db1, + 0x00000db3, 0x00000dbb, 0x00000dbd, 0x00000dbd, + 0x00000dc0, 0x00000dc6, 0x00000dcf, 0x00000dd1, + 0x00000dd8, 0x00000ddf, 0x00000de6, 0x00000def, + 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, 0x00000edf, 0x00000f00, 0x00000f17, + 0x00000f1a, 0x00000f34, 0x00000f36, 0x00000f36, + 0x00000f38, 0x00000f38, 0x00000f3e, 0x00000f47, + 0x00000f49, 0x00000f6c, 0x00000f7f, 0x00000f7f, + 0x00000f85, 0x00000f85, 0x00000f88, 0x00000f8c, + 0x00000fbe, 0x00000fc5, 0x00000fc7, 0x00000fcc, + 0x00000fce, 0x00000fda, 0x00001000, 0x0000102c, + 0x00001031, 0x00001031, 0x00001038, 0x00001038, + 0x0000103b, 0x0000103c, 0x0000103f, 0x00001057, + 0x0000105a, 0x0000105d, 0x00001061, 0x00001070, + 0x00001075, 0x00001081, 0x00001083, 0x00001084, + 0x00001087, 0x0000108c, 0x0000108e, 0x0000109c, + 0x0000109e, 0x000010c5, 0x000010c7, 0x000010c7, + 0x000010cd, 0x000010cd, 0x000010d0, 0x00001248, + 0x0000124a, 0x0000124d, 0x00001250, 0x00001256, + 0x00001258, 0x00001258, 0x0000125a, 0x0000125d, + 0x00001260, 0x00001288, 0x0000128a, 0x0000128d, + 0x00001290, 0x000012b0, 0x000012b2, 0x000012b5, + 0x000012b8, 0x000012be, 0x000012c0, 0x000012c0, + 0x000012c2, 0x000012c5, 0x000012c8, 0x000012d6, + 0x000012d8, 0x00001310, 0x00001312, 0x00001315, + 0x00001318, 0x0000135a, 0x00001360, 0x0000137c, + 0x00001380, 0x0000138f, 0x000013a0, 0x000013f5, + 0x000013f8, 0x000013fd, 0x00001401, 0x0000167f, + 0x00001681, 0x0000169a, 0x000016a0, 0x000016f8, + 0x00001700, 0x0000170c, 0x0000170e, 0x00001711, + 0x00001720, 0x00001731, 0x00001735, 0x00001736, + 0x00001740, 0x00001751, 0x00001760, 0x0000176c, + 0x0000176e, 0x00001770, 0x00001780, 0x000017b3, + 0x000017b6, 0x000017b6, 0x000017be, 0x000017c5, + 0x000017c7, 0x000017c8, 0x000017d4, 0x000017da, + 0x000017dc, 0x000017dc, 0x000017e0, 0x000017e9, + 0x00001810, 0x00001819, 0x00001820, 0x00001877, + 0x00001880, 0x00001884, 0x00001887, 0x000018a8, + 0x000018aa, 0x000018aa, 0x000018b0, 0x000018f5, + 0x00001900, 0x0000191e, 0x00001923, 0x00001926, + 0x00001929, 0x0000192b, 0x00001930, 0x00001931, + 0x00001933, 0x00001938, 0x00001946, 0x0000196d, + 0x00001970, 0x00001974, 0x00001980, 0x000019ab, + 0x000019b0, 0x000019c9, 0x000019d0, 0x000019da, + 0x00001a00, 0x00001a16, 0x00001a19, 0x00001a1a, + 0x00001a1e, 0x00001a55, 0x00001a57, 0x00001a57, + 0x00001a61, 0x00001a61, 0x00001a63, 0x00001a64, + 0x00001a6d, 0x00001a72, 0x00001a80, 0x00001a89, + 0x00001a90, 0x00001a99, 0x00001aa0, 0x00001aad, + 0x00001b04, 0x00001b33, 0x00001b35, 0x00001b35, + 0x00001b3b, 0x00001b3b, 0x00001b3d, 0x00001b41, + 0x00001b43, 0x00001b4b, 0x00001b50, 0x00001b6a, + 0x00001b74, 0x00001b7c, 0x00001b82, 0x00001ba1, + 0x00001ba6, 0x00001ba7, 0x00001baa, 0x00001baa, + 0x00001bae, 0x00001be5, 0x00001be7, 0x00001be7, + 0x00001bea, 0x00001bec, 0x00001bee, 0x00001bee, + 0x00001bf2, 0x00001bf3, 0x00001bfc, 0x00001c2b, + 0x00001c34, 0x00001c35, 0x00001c3b, 0x00001c49, + 0x00001c4d, 0x00001c88, 0x00001cc0, 0x00001cc7, + 0x00001cd3, 0x00001cd3, 0x00001ce1, 0x00001ce1, + 0x00001ce9, 0x00001cec, 0x00001cee, 0x00001cf3, + 0x00001cf5, 0x00001cf7, 0x00001d00, 0x00001dbf, + 0x00001e00, 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, + 0x00002090, 0x0000209c, 0x00002102, 0x00002102, + 0x00002107, 0x00002107, 0x0000210a, 0x00002113, + 0x00002115, 0x00002115, 0x00002119, 0x0000211d, + 0x00002124, 0x00002124, 0x00002126, 0x00002126, + 0x00002128, 0x00002128, 0x0000212a, 0x0000212d, + 0x0000212f, 0x00002139, 0x0000213c, 0x0000213f, + 0x00002145, 0x00002149, 0x0000214e, 0x0000214f, + 0x00002160, 0x00002188, 0x00002336, 0x0000237a, + 0x00002395, 0x00002395, 0x0000249c, 0x000024e9, + 0x000026ac, 0x000026ac, 0x00002800, 0x000028ff, + 0x00002c00, 0x00002c2e, 0x00002c30, 0x00002c5e, + 0x00002c60, 0x00002ce4, 0x00002ceb, 0x00002cee, + 0x00002cf2, 0x00002cf3, 0x00002d00, 0x00002d25, + 0x00002d27, 0x00002d27, 0x00002d2d, 0x00002d2d, + 0x00002d30, 0x00002d67, 0x00002d6f, 0x00002d70, + 0x00002d80, 0x00002d96, 0x00002da0, 0x00002da6, + 0x00002da8, 0x00002dae, 0x00002db0, 0x00002db6, + 0x00002db8, 0x00002dbe, 0x00002dc0, 0x00002dc6, + 0x00002dc8, 0x00002dce, 0x00002dd0, 0x00002dd6, + 0x00002dd8, 0x00002dde, 0x00003005, 0x00003007, + 0x00003021, 0x00003029, 0x0000302e, 0x0000302f, + 0x00003031, 0x00003035, 0x00003038, 0x0000303c, + 0x00003041, 0x00003096, 0x0000309d, 0x0000309f, + 0x000030a1, 0x000030fa, 0x000030fc, 0x000030ff, + 0x00003105, 0x0000312e, 0x00003131, 0x0000318e, + 0x00003190, 0x000031ba, 0x000031f0, 0x0000321c, + 0x00003220, 0x0000324f, 0x00003260, 0x0000327b, + 0x0000327f, 0x000032b0, 0x000032c0, 0x000032cb, + 0x000032d0, 0x000032fe, 0x00003300, 0x00003376, + 0x0000337b, 0x000033dd, 0x000033e0, 0x000033fe, + 0x00003400, 0x00004db5, 0x00004e00, 0x00009fea, + 0x0000a000, 0x0000a48c, 0x0000a4d0, 0x0000a60c, 0x0000a610, 0x0000a62b, 0x0000a640, 0x0000a66e, 0x0000a680, 0x0000a69d, 0x0000a6a0, 0x0000a6ef, 0x0000a6f2, 0x0000a6f7, 0x0000a722, 0x0000a787, @@ -1759,15 +1757,120 @@ static const unsigned int _ucprop_ranges[] = { 0x0000abe6, 0x0000abe7, 0x0000abe9, 0x0000abec, 0x0000abf0, 0x0000abf9, 0x0000ac00, 0x0000d7a3, 0x0000d7b0, 0x0000d7c6, 0x0000d7cb, 0x0000d7fb, - 0x0000e000, 0x0000fb06, 0x0000fb13, 0x0000fb17, + 0x0000d800, 0x0000fa6d, 0x0000fa70, 0x0000fad9, + 0x0000fb00, 0x0000fb06, 0x0000fb13, 0x0000fb17, 0x0000ff21, 0x0000ff3a, 0x0000ff41, 0x0000ff5a, 0x0000ff66, 0x0000ffbe, 0x0000ffc2, 0x0000ffc7, 0x0000ffca, 0x0000ffcf, 0x0000ffd2, 0x0000ffd7, - 0x0000ffda, 0x0000ffdc, 0x00010000, 0x0002a6d6, - 0x0002a700, 0x0002a700, 0x0002b734, 0x0002b734, - 0x0002b740, 0x0002b740, 0x0002b81d, 0x0002b81d, - 0x0002b820, 0x0002b820, 0x0002cea1, 0x0002cea1, - 0x0002ceb0, 0x0002ceb0, 0x0002ebe0, 0x0002ebe0, + 0x0000ffda, 0x0000ffdc, 0x00010000, 0x0001000b, + 0x0001000d, 0x00010026, 0x00010028, 0x0001003a, + 0x0001003c, 0x0001003d, 0x0001003f, 0x0001004d, + 0x00010050, 0x0001005d, 0x00010080, 0x000100fa, + 0x00010100, 0x00010100, 0x00010102, 0x00010102, + 0x00010107, 0x00010133, 0x00010137, 0x0001013f, + 0x0001018d, 0x0001018e, 0x000101d0, 0x000101fc, + 0x00010280, 0x0001029c, 0x000102a0, 0x000102d0, + 0x00010300, 0x00010323, 0x0001032d, 0x0001034a, + 0x00010350, 0x00010375, 0x00010380, 0x0001039d, + 0x0001039f, 0x000103c3, 0x000103c8, 0x000103d5, + 0x00010400, 0x0001049d, 0x000104a0, 0x000104a9, + 0x000104b0, 0x000104d3, 0x000104d8, 0x000104fb, + 0x00010500, 0x00010527, 0x00010530, 0x00010563, + 0x0001056f, 0x0001056f, 0x00010600, 0x00010736, + 0x00010740, 0x00010755, 0x00010760, 0x00010767, + 0x00011000, 0x00011000, 0x00011002, 0x00011037, + 0x00011047, 0x0001104d, 0x00011066, 0x0001106f, + 0x00011082, 0x000110b2, 0x000110b7, 0x000110b8, + 0x000110bb, 0x000110c1, 0x000110d0, 0x000110e8, + 0x000110f0, 0x000110f9, 0x00011103, 0x00011126, + 0x0001112c, 0x0001112c, 0x00011136, 0x00011143, + 0x00011150, 0x00011172, 0x00011174, 0x00011176, + 0x00011182, 0x000111b5, 0x000111bf, 0x000111c9, + 0x000111cd, 0x000111cd, 0x000111d0, 0x000111df, + 0x000111e1, 0x000111f4, 0x00011200, 0x00011211, + 0x00011213, 0x0001122e, 0x00011232, 0x00011233, + 0x00011235, 0x00011235, 0x00011238, 0x0001123d, + 0x00011280, 0x00011286, 0x00011288, 0x00011288, + 0x0001128a, 0x0001128d, 0x0001128f, 0x0001129d, + 0x0001129f, 0x000112a9, 0x000112b0, 0x000112de, + 0x000112e0, 0x000112e2, 0x000112f0, 0x000112f9, + 0x00011302, 0x00011303, 0x00011305, 0x0001130c, + 0x0001130f, 0x00011310, 0x00011313, 0x00011328, + 0x0001132a, 0x00011330, 0x00011332, 0x00011333, + 0x00011335, 0x00011339, 0x0001133d, 0x0001133f, + 0x00011341, 0x00011344, 0x00011347, 0x00011348, + 0x0001134b, 0x0001134d, 0x00011350, 0x00011350, + 0x00011357, 0x00011357, 0x0001135d, 0x00011363, + 0x00011400, 0x00011437, 0x00011440, 0x00011441, + 0x00011445, 0x00011445, 0x00011447, 0x00011459, + 0x0001145b, 0x0001145b, 0x0001145d, 0x0001145d, + 0x00011480, 0x000114b2, 0x000114b9, 0x000114b9, + 0x000114bb, 0x000114be, 0x000114c1, 0x000114c1, + 0x000114c4, 0x000114c7, 0x000114d0, 0x000114d9, + 0x00011580, 0x000115b1, 0x000115b8, 0x000115bb, + 0x000115be, 0x000115be, 0x000115c1, 0x000115db, + 0x00011600, 0x00011632, 0x0001163b, 0x0001163c, + 0x0001163e, 0x0001163e, 0x00011641, 0x00011644, + 0x00011650, 0x00011659, 0x00011680, 0x000116aa, + 0x000116ac, 0x000116ac, 0x000116ae, 0x000116af, + 0x000116b6, 0x000116b6, 0x000116c0, 0x000116c9, + 0x00011700, 0x00011719, 0x00011720, 0x00011721, + 0x00011726, 0x00011726, 0x00011730, 0x0001173f, + 0x000118a0, 0x000118f2, 0x000118ff, 0x000118ff, + 0x00011a00, 0x00011a00, 0x00011a07, 0x00011a08, + 0x00011a0b, 0x00011a32, 0x00011a39, 0x00011a3a, + 0x00011a3f, 0x00011a46, 0x00011a50, 0x00011a50, + 0x00011a57, 0x00011a58, 0x00011a5c, 0x00011a83, + 0x00011a86, 0x00011a89, 0x00011a97, 0x00011a97, + 0x00011a9a, 0x00011a9c, 0x00011a9e, 0x00011aa2, + 0x00011ac0, 0x00011af8, 0x00011c00, 0x00011c08, + 0x00011c0a, 0x00011c2f, 0x00011c3e, 0x00011c45, + 0x00011c50, 0x00011c6c, 0x00011c70, 0x00011c8f, + 0x00011ca9, 0x00011ca9, 0x00011cb1, 0x00011cb1, + 0x00011cb4, 0x00011cb4, 0x00011d00, 0x00011d06, + 0x00011d08, 0x00011d09, 0x00011d0b, 0x00011d30, + 0x00011d46, 0x00011d46, 0x00011d50, 0x00011d59, + 0x00012000, 0x00012399, 0x00012400, 0x0001246e, + 0x00012470, 0x00012474, 0x00012480, 0x00012543, + 0x00013000, 0x0001342e, 0x00014400, 0x00014646, + 0x00016800, 0x00016a38, 0x00016a40, 0x00016a5e, + 0x00016a60, 0x00016a69, 0x00016a6e, 0x00016a6f, + 0x00016ad0, 0x00016aed, 0x00016af5, 0x00016af5, + 0x00016b00, 0x00016b2f, 0x00016b37, 0x00016b45, + 0x00016b50, 0x00016b59, 0x00016b5b, 0x00016b61, + 0x00016b63, 0x00016b77, 0x00016b7d, 0x00016b8f, + 0x00016f00, 0x00016f44, 0x00016f50, 0x00016f7e, + 0x00016f93, 0x00016f9f, 0x00016fe0, 0x00016fe1, + 0x00017000, 0x000187ec, 0x00018800, 0x00018af2, + 0x0001b000, 0x0001b11e, 0x0001b170, 0x0001b2fb, + 0x0001bc00, 0x0001bc6a, 0x0001bc70, 0x0001bc7c, + 0x0001bc80, 0x0001bc88, 0x0001bc90, 0x0001bc99, + 0x0001bc9c, 0x0001bc9c, 0x0001bc9f, 0x0001bc9f, + 0x0001d000, 0x0001d0f5, 0x0001d100, 0x0001d126, + 0x0001d129, 0x0001d166, 0x0001d16a, 0x0001d172, + 0x0001d183, 0x0001d184, 0x0001d18c, 0x0001d1a9, + 0x0001d1ae, 0x0001d1e8, 0x0001d360, 0x0001d371, + 0x0001d400, 0x0001d454, 0x0001d456, 0x0001d49c, + 0x0001d49e, 0x0001d49f, 0x0001d4a2, 0x0001d4a2, + 0x0001d4a5, 0x0001d4a6, 0x0001d4a9, 0x0001d4ac, + 0x0001d4ae, 0x0001d4b9, 0x0001d4bb, 0x0001d4bb, + 0x0001d4bd, 0x0001d4c3, 0x0001d4c5, 0x0001d505, + 0x0001d507, 0x0001d50a, 0x0001d50d, 0x0001d514, + 0x0001d516, 0x0001d51c, 0x0001d51e, 0x0001d539, + 0x0001d53b, 0x0001d53e, 0x0001d540, 0x0001d544, + 0x0001d546, 0x0001d546, 0x0001d54a, 0x0001d550, + 0x0001d552, 0x0001d6a5, 0x0001d6a8, 0x0001d6da, + 0x0001d6dc, 0x0001d714, 0x0001d716, 0x0001d74e, + 0x0001d750, 0x0001d788, 0x0001d78a, 0x0001d7c2, + 0x0001d7c4, 0x0001d7cb, 0x0001d800, 0x0001d9ff, + 0x0001da37, 0x0001da3a, 0x0001da6d, 0x0001da74, + 0x0001da76, 0x0001da83, 0x0001da85, 0x0001da8b, + 0x0001f110, 0x0001f12e, 0x0001f130, 0x0001f169, + 0x0001f170, 0x0001f1ac, 0x0001f1e6, 0x0001f202, + 0x0001f210, 0x0001f23b, 0x0001f240, 0x0001f248, + 0x0001f250, 0x0001f251, 0x00020000, 0x0002a6d6, + 0x0002a700, 0x0002b734, 0x0002b740, 0x0002b81d, + 0x0002b820, 0x0002cea1, 0x0002ceb0, 0x0002ebe0, 0x0002f800, 0x0002fa1d, 0x000f0000, 0x000ffffd, 0x00100000, 0x0010fffd, 0x000005be, 0x000005be, 0x000005c0, 0x000005c0, 0x000005c3, 0x000005c3, @@ -2073,447 +2176,6 @@ static const unsigned int _ucprop_ranges[] = { 0x0001f950, 0x0001f96b, 0x0001f980, 0x0001f997, 0x0001f9c0, 0x0001f9c0, 0x0001f9d0, 0x0001f9e6, 0x000e0001, 0x000e0001, 0x000e0020, 0x000e007f, - 0x000e0100, 0x000e01ef, 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, 0x00001b06, 0x00001b06, - 0x00001b08, 0x00001b08, 0x00001b0a, 0x00001b0a, - 0x00001b0c, 0x00001b0c, 0x00001b0e, 0x00001b0e, - 0x00001b12, 0x00001b12, 0x00001b3b, 0x00001b3b, - 0x00001b3d, 0x00001b3d, 0x00001b40, 0x00001b41, - 0x00001b43, 0x00001b43, 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, 0x0000fa6d, 0x0000fa70, 0x0000fad9, - 0x0000fb1d, 0x0000fb1d, 0x0000fb1f, 0x0000fb1f, - 0x0000fb2a, 0x0000fb36, 0x0000fb38, 0x0000fb3c, - 0x0000fb3e, 0x0000fb3e, 0x0000fb40, 0x0000fb41, - 0x0000fb43, 0x0000fb44, 0x0000fb46, 0x0000fb4e, - 0x0001109a, 0x0001109a, 0x0001109c, 0x0001109c, - 0x000110ab, 0x000110ab, 0x0001112e, 0x0001112f, - 0x0001134b, 0x0001134c, 0x000114bb, 0x000114bc, - 0x000114be, 0x000114be, 0x000115ba, 0x000115bb, - 0x0001d15e, 0x0001d164, 0x0001d1bb, 0x0001d1c0, - 0x0002f800, 0x0002fa1d, 0x00000000, 0x00000377, - 0x0000037a, 0x0000037f, 0x00000384, 0x0000038a, - 0x0000038c, 0x0000038c, 0x0000038e, 0x000003a1, - 0x000003a3, 0x0000052f, 0x00000531, 0x00000556, - 0x00000559, 0x0000055f, 0x00000561, 0x00000587, - 0x00000589, 0x0000058a, 0x0000058d, 0x0000058f, - 0x00000591, 0x000005c7, 0x000005d0, 0x000005ea, - 0x000005f0, 0x000005f4, 0x00000600, 0x0000061c, - 0x0000061e, 0x0000070d, 0x0000070f, 0x0000074a, - 0x0000074d, 0x000007b1, 0x000007c0, 0x000007fa, - 0x00000800, 0x0000082d, 0x00000830, 0x0000083e, - 0x00000840, 0x0000085b, 0x0000085e, 0x0000085e, - 0x00000860, 0x0000086a, 0x000008a0, 0x000008b4, - 0x000008b6, 0x000008bd, 0x000008d4, 0x00000983, - 0x00000985, 0x0000098c, 0x0000098f, 0x00000990, - 0x00000993, 0x000009a8, 0x000009aa, 0x000009b0, - 0x000009b2, 0x000009b2, 0x000009b6, 0x000009b9, - 0x000009bc, 0x000009c4, 0x000009c7, 0x000009c8, - 0x000009cb, 0x000009ce, 0x000009d7, 0x000009d7, - 0x000009dc, 0x000009dd, 0x000009df, 0x000009e3, - 0x000009e6, 0x000009fd, 0x00000a01, 0x00000a03, - 0x00000a05, 0x00000a0a, 0x00000a0f, 0x00000a10, - 0x00000a13, 0x00000a28, 0x00000a2a, 0x00000a30, - 0x00000a32, 0x00000a33, 0x00000a35, 0x00000a36, - 0x00000a38, 0x00000a39, 0x00000a3c, 0x00000a3c, - 0x00000a3e, 0x00000a42, 0x00000a47, 0x00000a48, - 0x00000a4b, 0x00000a4d, 0x00000a51, 0x00000a51, - 0x00000a59, 0x00000a5c, 0x00000a5e, 0x00000a5e, - 0x00000a66, 0x00000a75, 0x00000a81, 0x00000a83, - 0x00000a85, 0x00000a8d, 0x00000a8f, 0x00000a91, - 0x00000a93, 0x00000aa8, 0x00000aaa, 0x00000ab0, - 0x00000ab2, 0x00000ab3, 0x00000ab5, 0x00000ab9, - 0x00000abc, 0x00000ac5, 0x00000ac7, 0x00000ac9, - 0x00000acb, 0x00000acd, 0x00000ad0, 0x00000ad0, - 0x00000ae0, 0x00000ae3, 0x00000ae6, 0x00000af1, - 0x00000af9, 0x00000aff, 0x00000b01, 0x00000b03, - 0x00000b05, 0x00000b0c, 0x00000b0f, 0x00000b10, - 0x00000b13, 0x00000b28, 0x00000b2a, 0x00000b30, - 0x00000b32, 0x00000b33, 0x00000b35, 0x00000b39, - 0x00000b3c, 0x00000b44, 0x00000b47, 0x00000b48, - 0x00000b4b, 0x00000b4d, 0x00000b56, 0x00000b57, - 0x00000b5c, 0x00000b5d, 0x00000b5f, 0x00000b63, - 0x00000b66, 0x00000b77, 0x00000b82, 0x00000b83, - 0x00000b85, 0x00000b8a, 0x00000b8e, 0x00000b90, - 0x00000b92, 0x00000b95, 0x00000b99, 0x00000b9a, - 0x00000b9c, 0x00000b9c, 0x00000b9e, 0x00000b9f, - 0x00000ba3, 0x00000ba4, 0x00000ba8, 0x00000baa, - 0x00000bae, 0x00000bb9, 0x00000bbe, 0x00000bc2, - 0x00000bc6, 0x00000bc8, 0x00000bca, 0x00000bcd, - 0x00000bd0, 0x00000bd0, 0x00000bd7, 0x00000bd7, - 0x00000be6, 0x00000bfa, 0x00000c00, 0x00000c03, - 0x00000c05, 0x00000c0c, 0x00000c0e, 0x00000c10, - 0x00000c12, 0x00000c28, 0x00000c2a, 0x00000c39, - 0x00000c3d, 0x00000c44, 0x00000c46, 0x00000c48, - 0x00000c4a, 0x00000c4d, 0x00000c55, 0x00000c56, - 0x00000c58, 0x00000c5a, 0x00000c60, 0x00000c63, - 0x00000c66, 0x00000c6f, 0x00000c78, 0x00000c83, - 0x00000c85, 0x00000c8c, 0x00000c8e, 0x00000c90, - 0x00000c92, 0x00000ca8, 0x00000caa, 0x00000cb3, - 0x00000cb5, 0x00000cb9, 0x00000cbc, 0x00000cc4, - 0x00000cc6, 0x00000cc8, 0x00000cca, 0x00000ccd, - 0x00000cd5, 0x00000cd6, 0x00000cde, 0x00000cde, - 0x00000ce0, 0x00000ce3, 0x00000ce6, 0x00000cef, - 0x00000cf1, 0x00000cf2, 0x00000d00, 0x00000d03, - 0x00000d05, 0x00000d0c, 0x00000d0e, 0x00000d10, - 0x00000d12, 0x00000d44, 0x00000d46, 0x00000d48, - 0x00000d4a, 0x00000d4f, 0x00000d54, 0x00000d63, - 0x00000d66, 0x00000d7f, 0x00000d82, 0x00000d83, - 0x00000d85, 0x00000d96, 0x00000d9a, 0x00000db1, - 0x00000db3, 0x00000dbb, 0x00000dbd, 0x00000dbd, - 0x00000dc0, 0x00000dc6, 0x00000dca, 0x00000dca, - 0x00000dcf, 0x00000dd4, 0x00000dd6, 0x00000dd6, - 0x00000dd8, 0x00000ddf, 0x00000de6, 0x00000def, - 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, 0x00000edf, 0x00000f00, 0x00000f47, - 0x00000f49, 0x00000f6c, 0x00000f71, 0x00000f97, - 0x00000f99, 0x00000fbc, 0x00000fbe, 0x00000fcc, - 0x00000fce, 0x00000fda, 0x00001000, 0x000010c5, - 0x000010c7, 0x000010c7, 0x000010cd, 0x000010cd, - 0x000010d0, 0x00001248, 0x0000124a, 0x0000124d, - 0x00001250, 0x00001256, 0x00001258, 0x00001258, - 0x0000125a, 0x0000125d, 0x00001260, 0x00001288, - 0x0000128a, 0x0000128d, 0x00001290, 0x000012b0, - 0x000012b2, 0x000012b5, 0x000012b8, 0x000012be, - 0x000012c0, 0x000012c0, 0x000012c2, 0x000012c5, - 0x000012c8, 0x000012d6, 0x000012d8, 0x00001310, - 0x00001312, 0x00001315, 0x00001318, 0x0000135a, - 0x0000135d, 0x0000137c, 0x00001380, 0x00001399, - 0x000013a0, 0x000013f5, 0x000013f8, 0x000013fd, - 0x00001400, 0x0000169c, 0x000016a0, 0x000016f8, - 0x00001700, 0x0000170c, 0x0000170e, 0x00001714, - 0x00001720, 0x00001736, 0x00001740, 0x00001753, - 0x00001760, 0x0000176c, 0x0000176e, 0x00001770, - 0x00001772, 0x00001773, 0x00001780, 0x000017dd, - 0x000017e0, 0x000017e9, 0x000017f0, 0x000017f9, - 0x00001800, 0x0000180e, 0x00001810, 0x00001819, - 0x00001820, 0x00001877, 0x00001880, 0x000018aa, - 0x000018b0, 0x000018f5, 0x00001900, 0x0000191e, - 0x00001920, 0x0000192b, 0x00001930, 0x0000193b, - 0x00001940, 0x00001940, 0x00001944, 0x0000196d, - 0x00001970, 0x00001974, 0x00001980, 0x000019ab, - 0x000019b0, 0x000019c9, 0x000019d0, 0x000019da, - 0x000019de, 0x00001a1b, 0x00001a1e, 0x00001a5e, - 0x00001a60, 0x00001a7c, 0x00001a7f, 0x00001a89, - 0x00001a90, 0x00001a99, 0x00001aa0, 0x00001aad, - 0x00001ab0, 0x00001abe, 0x00001b00, 0x00001b4b, - 0x00001b50, 0x00001b7c, 0x00001b80, 0x00001bf3, - 0x00001bfc, 0x00001c37, 0x00001c3b, 0x00001c49, - 0x00001c4d, 0x00001c88, 0x00001cc0, 0x00001cc7, - 0x00001cd0, 0x00001cf9, 0x00001d00, 0x00001df9, - 0x00001dfb, 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, 0x00002064, 0x00002066, 0x00002071, - 0x00002074, 0x0000208e, 0x00002090, 0x0000209c, - 0x000020a0, 0x000020bf, 0x000020d0, 0x000020f0, - 0x00002100, 0x0000218b, 0x00002190, 0x00002426, - 0x00002440, 0x0000244a, 0x00002460, 0x00002b73, - 0x00002b76, 0x00002b95, 0x00002b98, 0x00002bb9, - 0x00002bbd, 0x00002bc8, 0x00002bca, 0x00002bd2, - 0x00002bec, 0x00002bef, 0x00002c00, 0x00002c2e, - 0x00002c30, 0x00002c5e, 0x00002c60, 0x00002cf3, - 0x00002cf9, 0x00002d25, 0x00002d27, 0x00002d27, - 0x00002d2d, 0x00002d2d, 0x00002d30, 0x00002d67, - 0x00002d6f, 0x00002d70, 0x00002d7f, 0x00002d96, - 0x00002da0, 0x00002da6, 0x00002da8, 0x00002dae, - 0x00002db0, 0x00002db6, 0x00002db8, 0x00002dbe, - 0x00002dc0, 0x00002dc6, 0x00002dc8, 0x00002dce, - 0x00002dd0, 0x00002dd6, 0x00002dd8, 0x00002dde, - 0x00002de0, 0x00002e49, 0x00002e80, 0x00002e99, - 0x00002e9b, 0x00002ef3, 0x00002f00, 0x00002fd5, - 0x00002ff0, 0x00002ffb, 0x00003000, 0x0000303f, - 0x00003041, 0x00003096, 0x00003099, 0x000030ff, - 0x00003105, 0x0000312e, 0x00003131, 0x0000318e, - 0x00003190, 0x000031ba, 0x000031c0, 0x000031e3, - 0x000031f0, 0x0000321e, 0x00003220, 0x000032fe, - 0x00003300, 0x000033ff, 0x00003400, 0x00004db5, - 0x00004dc0, 0x00004dff, 0x00004e00, 0x00009fa5, - 0x0000a000, 0x0000a48c, 0x0000a490, 0x0000a4c6, - 0x0000a4d0, 0x0000a62b, 0x0000a640, 0x0000a6f7, - 0x0000a700, 0x0000a7ae, 0x0000a7b0, 0x0000a7b7, - 0x0000a7f7, 0x0000a82b, 0x0000a830, 0x0000a839, - 0x0000a840, 0x0000a877, 0x0000a880, 0x0000a8c5, - 0x0000a8ce, 0x0000a8d9, 0x0000a8e0, 0x0000a8fd, - 0x0000a900, 0x0000a953, 0x0000a95f, 0x0000a97c, - 0x0000a980, 0x0000a9cd, 0x0000a9cf, 0x0000a9d9, - 0x0000a9de, 0x0000a9fe, 0x0000aa00, 0x0000aa36, - 0x0000aa40, 0x0000aa4d, 0x0000aa50, 0x0000aa59, - 0x0000aa5c, 0x0000aac2, 0x0000aadb, 0x0000aaf6, - 0x0000ab01, 0x0000ab06, 0x0000ab09, 0x0000ab0e, - 0x0000ab11, 0x0000ab16, 0x0000ab20, 0x0000ab26, - 0x0000ab28, 0x0000ab2e, 0x0000ab30, 0x0000ab65, - 0x0000ab70, 0x0000abed, 0x0000abf0, 0x0000abf9, - 0x0000ac00, 0x0000d7a3, 0x0000d7b0, 0x0000d7c6, - 0x0000d7cb, 0x0000d7fb, 0x0000f900, 0x0000fb06, - 0x0000fb13, 0x0000fb17, 0x0000fb1d, 0x0000fb36, - 0x0000fb38, 0x0000fb3c, 0x0000fb3e, 0x0000fb3e, - 0x0000fb40, 0x0000fb41, 0x0000fb43, 0x0000fb44, - 0x0000fb46, 0x0000fbc1, 0x0000fbd3, 0x0000fd3f, - 0x0000fd50, 0x0000fd8f, 0x0000fd92, 0x0000fdc7, - 0x0000fdf0, 0x0000fdfd, 0x0000fe00, 0x0000fe19, - 0x0000fe20, 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, - 0x00010000, 0x0001000b, 0x0001000d, 0x00010026, - 0x00010028, 0x0001003a, 0x0001003c, 0x0001003d, - 0x0001003f, 0x0001004d, 0x00010050, 0x0001005d, - 0x00010080, 0x000100fa, 0x00010100, 0x00010102, - 0x00010107, 0x00010133, 0x00010137, 0x0001018e, - 0x00010190, 0x0001019b, 0x000101a0, 0x000101a0, - 0x000101d0, 0x000101fd, 0x00010280, 0x0001029c, - 0x000102a0, 0x000102d0, 0x000102e0, 0x000102fb, - 0x00010300, 0x00010323, 0x0001032d, 0x0001034a, - 0x00010350, 0x0001037a, 0x00010380, 0x0001039d, - 0x0001039f, 0x000103c3, 0x000103c8, 0x000103d5, - 0x00010400, 0x0001049d, 0x000104a0, 0x000104a9, - 0x000104b0, 0x000104d3, 0x000104d8, 0x000104fb, - 0x00010500, 0x00010527, 0x00010530, 0x00010563, - 0x0001056f, 0x0001056f, 0x00010600, 0x00010736, - 0x00010740, 0x00010755, 0x00010760, 0x00010767, - 0x00010800, 0x00010805, 0x00010808, 0x00010808, - 0x0001080a, 0x00010835, 0x00010837, 0x00010838, - 0x0001083c, 0x0001083c, 0x0001083f, 0x00010855, - 0x00010857, 0x0001089e, 0x000108a7, 0x000108af, - 0x000108e0, 0x000108f2, 0x000108f4, 0x000108f5, - 0x000108fb, 0x0001091b, 0x0001091f, 0x00010939, - 0x0001093f, 0x0001093f, 0x00010980, 0x000109b7, - 0x000109bc, 0x000109cf, 0x000109d2, 0x00010a03, - 0x00010a05, 0x00010a06, 0x00010a0c, 0x00010a13, - 0x00010a15, 0x00010a17, 0x00010a19, 0x00010a33, - 0x00010a38, 0x00010a3a, 0x00010a3f, 0x00010a47, - 0x00010a50, 0x00010a58, 0x00010a60, 0x00010a9f, - 0x00010ac0, 0x00010ae6, 0x00010aeb, 0x00010af6, - 0x00010b00, 0x00010b35, 0x00010b39, 0x00010b55, - 0x00010b58, 0x00010b72, 0x00010b78, 0x00010b91, - 0x00010b99, 0x00010b9c, 0x00010ba9, 0x00010baf, - 0x00010c00, 0x00010c48, 0x00010c80, 0x00010cb2, - 0x00010cc0, 0x00010cf2, 0x00010cfa, 0x00010cff, - 0x00010e60, 0x00010e7e, 0x00011000, 0x0001104d, - 0x00011052, 0x0001106f, 0x0001107f, 0x000110c1, - 0x000110d0, 0x000110e8, 0x000110f0, 0x000110f9, - 0x00011100, 0x00011134, 0x00011136, 0x00011143, - 0x00011150, 0x00011176, 0x00011180, 0x000111cd, - 0x000111d0, 0x000111df, 0x000111e1, 0x000111f4, - 0x00011200, 0x00011211, 0x00011213, 0x0001123e, - 0x00011280, 0x00011286, 0x00011288, 0x00011288, - 0x0001128a, 0x0001128d, 0x0001128f, 0x0001129d, - 0x0001129f, 0x000112a9, 0x000112b0, 0x000112ea, - 0x000112f0, 0x000112f9, 0x00011300, 0x00011303, - 0x00011305, 0x0001130c, 0x0001130f, 0x00011310, - 0x00011313, 0x00011328, 0x0001132a, 0x00011330, - 0x00011332, 0x00011333, 0x00011335, 0x00011339, - 0x0001133c, 0x00011344, 0x00011347, 0x00011348, - 0x0001134b, 0x0001134d, 0x00011350, 0x00011350, - 0x00011357, 0x00011357, 0x0001135d, 0x00011363, - 0x00011366, 0x0001136c, 0x00011370, 0x00011374, - 0x00011400, 0x00011459, 0x0001145b, 0x0001145b, - 0x0001145d, 0x0001145d, 0x00011480, 0x000114c7, - 0x000114d0, 0x000114d9, 0x00011580, 0x000115b5, - 0x000115b8, 0x000115dd, 0x00011600, 0x00011644, - 0x00011650, 0x00011659, 0x00011660, 0x0001166c, - 0x00011680, 0x000116b7, 0x000116c0, 0x000116c9, - 0x00011700, 0x00011719, 0x0001171d, 0x0001172b, - 0x00011730, 0x0001173f, 0x000118a0, 0x000118f2, - 0x000118ff, 0x000118ff, 0x00011a00, 0x00011a47, - 0x00011a50, 0x00011a83, 0x00011a86, 0x00011a9c, - 0x00011a9e, 0x00011aa2, 0x00011ac0, 0x00011af8, - 0x00011c00, 0x00011c08, 0x00011c0a, 0x00011c36, - 0x00011c38, 0x00011c45, 0x00011c50, 0x00011c6c, - 0x00011c70, 0x00011c8f, 0x00011c92, 0x00011ca7, - 0x00011ca9, 0x00011cb6, 0x00011d00, 0x00011d06, - 0x00011d08, 0x00011d09, 0x00011d0b, 0x00011d36, - 0x00011d3a, 0x00011d3a, 0x00011d3c, 0x00011d3d, - 0x00011d3f, 0x00011d47, 0x00011d50, 0x00011d59, - 0x00012000, 0x00012399, 0x00012400, 0x0001246e, - 0x00012470, 0x00012474, 0x00012480, 0x00012543, - 0x00013000, 0x0001342e, 0x00014400, 0x00014646, - 0x00016800, 0x00016a38, 0x00016a40, 0x00016a5e, - 0x00016a60, 0x00016a69, 0x00016a6e, 0x00016a6f, - 0x00016ad0, 0x00016aed, 0x00016af0, 0x00016af5, - 0x00016b00, 0x00016b45, 0x00016b50, 0x00016b59, - 0x00016b5b, 0x00016b61, 0x00016b63, 0x00016b77, - 0x00016b7d, 0x00016b8f, 0x00016f00, 0x00016f44, - 0x00016f50, 0x00016f7e, 0x00016f8f, 0x00016f9f, - 0x00016fe0, 0x00016fe1, 0x00017000, 0x00017000, - 0x000187ec, 0x000187ec, 0x00018800, 0x00018af2, - 0x0001b000, 0x0001b11e, 0x0001b170, 0x0001b2fb, - 0x0001bc00, 0x0001bc6a, 0x0001bc70, 0x0001bc7c, - 0x0001bc80, 0x0001bc88, 0x0001bc90, 0x0001bc99, - 0x0001bc9c, 0x0001bca3, 0x0001d000, 0x0001d0f5, - 0x0001d100, 0x0001d126, 0x0001d129, 0x0001d1e8, - 0x0001d200, 0x0001d245, 0x0001d300, 0x0001d356, - 0x0001d360, 0x0001d371, 0x0001d400, 0x0001d454, - 0x0001d456, 0x0001d49c, 0x0001d49e, 0x0001d49f, - 0x0001d4a2, 0x0001d4a2, 0x0001d4a5, 0x0001d4a6, - 0x0001d4a9, 0x0001d4ac, 0x0001d4ae, 0x0001d4b9, - 0x0001d4bb, 0x0001d4bb, 0x0001d4bd, 0x0001d4c3, - 0x0001d4c5, 0x0001d505, 0x0001d507, 0x0001d50a, - 0x0001d50d, 0x0001d514, 0x0001d516, 0x0001d51c, - 0x0001d51e, 0x0001d539, 0x0001d53b, 0x0001d53e, - 0x0001d540, 0x0001d544, 0x0001d546, 0x0001d546, - 0x0001d54a, 0x0001d550, 0x0001d552, 0x0001d6a5, - 0x0001d6a8, 0x0001d7cb, 0x0001d7ce, 0x0001da8b, - 0x0001da9b, 0x0001da9f, 0x0001daa1, 0x0001daaf, - 0x0001e000, 0x0001e006, 0x0001e008, 0x0001e018, - 0x0001e01b, 0x0001e021, 0x0001e023, 0x0001e024, - 0x0001e026, 0x0001e02a, 0x0001e800, 0x0001e8c4, - 0x0001e8c7, 0x0001e8d6, 0x0001e900, 0x0001e94a, - 0x0001e950, 0x0001e959, 0x0001e95e, 0x0001e95f, - 0x0001ee00, 0x0001ee03, 0x0001ee05, 0x0001ee1f, - 0x0001ee21, 0x0001ee22, 0x0001ee24, 0x0001ee24, - 0x0001ee27, 0x0001ee27, 0x0001ee29, 0x0001ee32, - 0x0001ee34, 0x0001ee37, 0x0001ee39, 0x0001ee39, - 0x0001ee3b, 0x0001ee3b, 0x0001ee42, 0x0001ee42, - 0x0001ee47, 0x0001ee47, 0x0001ee49, 0x0001ee49, - 0x0001ee4b, 0x0001ee4b, 0x0001ee4d, 0x0001ee4f, - 0x0001ee51, 0x0001ee52, 0x0001ee54, 0x0001ee54, - 0x0001ee57, 0x0001ee57, 0x0001ee59, 0x0001ee59, - 0x0001ee5b, 0x0001ee5b, 0x0001ee5d, 0x0001ee5d, - 0x0001ee5f, 0x0001ee5f, 0x0001ee61, 0x0001ee62, - 0x0001ee64, 0x0001ee64, 0x0001ee67, 0x0001ee6a, - 0x0001ee6c, 0x0001ee72, 0x0001ee74, 0x0001ee77, - 0x0001ee79, 0x0001ee7c, 0x0001ee7e, 0x0001ee7e, - 0x0001ee80, 0x0001ee89, 0x0001ee8b, 0x0001ee9b, - 0x0001eea1, 0x0001eea3, 0x0001eea5, 0x0001eea9, - 0x0001eeab, 0x0001eebb, 0x0001eef0, 0x0001eef1, - 0x0001f000, 0x0001f02b, 0x0001f030, 0x0001f093, - 0x0001f0a0, 0x0001f0ae, 0x0001f0b1, 0x0001f0bf, - 0x0001f0c1, 0x0001f0cf, 0x0001f0d1, 0x0001f0f5, - 0x0001f100, 0x0001f10c, 0x0001f110, 0x0001f12e, - 0x0001f130, 0x0001f16b, 0x0001f170, 0x0001f1ac, - 0x0001f1e6, 0x0001f202, 0x0001f210, 0x0001f23b, - 0x0001f240, 0x0001f248, 0x0001f250, 0x0001f251, - 0x0001f260, 0x0001f265, 0x0001f300, 0x0001f6d4, - 0x0001f6e0, 0x0001f6ec, 0x0001f6f0, 0x0001f6f8, - 0x0001f700, 0x0001f773, 0x0001f780, 0x0001f7d4, - 0x0001f800, 0x0001f80b, 0x0001f810, 0x0001f847, - 0x0001f850, 0x0001f859, 0x0001f860, 0x0001f887, - 0x0001f890, 0x0001f8ad, 0x0001f900, 0x0001f90b, - 0x0001f910, 0x0001f93e, 0x0001f940, 0x0001f94c, - 0x0001f950, 0x0001f96b, 0x0001f980, 0x0001f997, - 0x0001f9c0, 0x0001f9c0, 0x0001f9d0, 0x0001f9e6, - 0x00020000, 0x0002a6d6, 0x0002a700, 0x0002a700, - 0x0002b734, 0x0002b734, 0x0002b740, 0x0002b740, - 0x0002b81d, 0x0002b81d, 0x0002b820, 0x0002b820, - 0x0002cea1, 0x0002cea1, 0x0002ceb0, 0x0002ceb0, - 0x0002ebe0, 0x0002ebe0, 0x0002f800, 0x0002fa1d, - 0x000e0001, 0x000e0001, 0x000e0020, 0x000e007f, 0x000e0100, 0x000e01ef, 0x000000ab, 0x000000ab, 0x00002018, 0x00002018, 0x0000201b, 0x0000201c, 0x0000201f, 0x0000201f, 0x00002039, 0x00002039, @@ -2553,2639 +2215,2674 @@ static const unsigned int _ucprop_ranges[] = { 0x0001ee79, 0x0001ee7c, 0x0001ee7e, 0x0001ee7e, 0x0001ee80, 0x0001ee89, 0x0001ee8b, 0x0001ee9b, 0x0001eea1, 0x0001eea3, 0x0001eea5, 0x0001eea9, - 0x0001eeab, 0x0001eebb + 0x0001eeab, 0x0001eebb, 0x00000041, 0x0000005a, + 0x00000061, 0x0000007a, 0x000000aa, 0x000000aa, + 0x000000b5, 0x000000b5, 0x000000ba, 0x000000ba, + 0x000000c0, 0x000000d6, 0x000000d8, 0x000000f6, + 0x000000f8, 0x000001ba, 0x000001bc, 0x000001bf, + 0x000001c4, 0x00000293, 0x00000295, 0x000002b8, + 0x000002c0, 0x000002c1, 0x000002e0, 0x000002e4, + 0x00000345, 0x00000345, 0x00000370, 0x00000373, + 0x00000376, 0x00000377, 0x0000037a, 0x0000037d, + 0x0000037f, 0x0000037f, 0x00000386, 0x00000386, + 0x00000388, 0x0000038a, 0x0000038c, 0x0000038c, + 0x0000038e, 0x000003a1, 0x000003a3, 0x000003f5, + 0x000003f7, 0x00000481, 0x0000048a, 0x0000052f, + 0x00000531, 0x00000556, 0x00000561, 0x00000587, + 0x000010a0, 0x000010c5, 0x000010c7, 0x000010c7, + 0x000010cd, 0x000010cd, 0x000013a0, 0x000013f5, + 0x000013f8, 0x000013fd, 0x00001c80, 0x00001c88, + 0x00001d00, 0x00001dbf, 0x00001e00, 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, + 0x00002071, 0x00002071, 0x0000207f, 0x0000207f, + 0x00002090, 0x0000209c, 0x00002102, 0x00002102, + 0x00002107, 0x00002107, 0x0000210a, 0x00002113, + 0x00002115, 0x00002115, 0x00002119, 0x0000211d, + 0x00002124, 0x00002124, 0x00002126, 0x00002126, + 0x00002128, 0x00002128, 0x0000212a, 0x0000212d, + 0x0000212f, 0x00002134, 0x00002139, 0x00002139, + 0x0000213c, 0x0000213f, 0x00002145, 0x00002149, + 0x0000214e, 0x0000214e, 0x00002160, 0x0000217f, + 0x00002183, 0x00002184, 0x000024b6, 0x000024e9, + 0x00002c00, 0x00002c2e, 0x00002c30, 0x00002c5e, + 0x00002c60, 0x00002ce4, 0x00002ceb, 0x00002cee, + 0x00002cf2, 0x00002cf3, 0x00002d00, 0x00002d25, + 0x00002d27, 0x00002d27, 0x00002d2d, 0x00002d2d, + 0x0000a640, 0x0000a66d, 0x0000a680, 0x0000a69d, + 0x0000a722, 0x0000a787, 0x0000a78b, 0x0000a78e, + 0x0000a790, 0x0000a7ae, 0x0000a7b0, 0x0000a7b7, + 0x0000a7f8, 0x0000a7fa, 0x0000ab30, 0x0000ab5a, + 0x0000ab5c, 0x0000ab65, 0x0000ab70, 0x0000abbf, + 0x0000fb00, 0x0000fb06, 0x0000fb13, 0x0000fb17, + 0x0000ff21, 0x0000ff3a, 0x0000ff41, 0x0000ff5a, + 0x00010400, 0x0001044f, 0x000104b0, 0x000104d3, + 0x000104d8, 0x000104fb, 0x00010c80, 0x00010cb2, + 0x00010cc0, 0x00010cf2, 0x000118a0, 0x000118df, + 0x0001d400, 0x0001d454, 0x0001d456, 0x0001d49c, + 0x0001d49e, 0x0001d49f, 0x0001d4a2, 0x0001d4a2, + 0x0001d4a5, 0x0001d4a6, 0x0001d4a9, 0x0001d4ac, + 0x0001d4ae, 0x0001d4b9, 0x0001d4bb, 0x0001d4bb, + 0x0001d4bd, 0x0001d4c3, 0x0001d4c5, 0x0001d505, + 0x0001d507, 0x0001d50a, 0x0001d50d, 0x0001d514, + 0x0001d516, 0x0001d51c, 0x0001d51e, 0x0001d539, + 0x0001d53b, 0x0001d53e, 0x0001d540, 0x0001d544, + 0x0001d546, 0x0001d546, 0x0001d54a, 0x0001d550, + 0x0001d552, 0x0001d6a5, 0x0001d6a8, 0x0001d6c0, + 0x0001d6c2, 0x0001d6da, 0x0001d6dc, 0x0001d6fa, + 0x0001d6fc, 0x0001d714, 0x0001d716, 0x0001d734, + 0x0001d736, 0x0001d74e, 0x0001d750, 0x0001d76e, + 0x0001d770, 0x0001d788, 0x0001d78a, 0x0001d7a8, + 0x0001d7aa, 0x0001d7c2, 0x0001d7c4, 0x0001d7cb, + 0x0001e900, 0x0001e943, 0x0001f130, 0x0001f149, + 0x0001f150, 0x0001f169, 0x0001f170, 0x0001f189, + 0x00000027, 0x00000027, 0x0000002e, 0x0000002e, + 0x0000003a, 0x0000003a, 0x0000005e, 0x0000005e, + 0x00000060, 0x00000060, 0x000000a8, 0x000000a8, + 0x000000ad, 0x000000ad, 0x000000af, 0x000000af, + 0x000000b4, 0x000000b4, 0x000000b7, 0x000000b8, + 0x000002b0, 0x0000036f, 0x00000374, 0x00000375, + 0x0000037a, 0x0000037a, 0x00000384, 0x00000385, + 0x00000387, 0x00000387, 0x00000483, 0x00000489, + 0x00000559, 0x00000559, 0x00000591, 0x000005bd, + 0x000005bf, 0x000005bf, 0x000005c1, 0x000005c2, + 0x000005c4, 0x000005c5, 0x000005c7, 0x000005c7, + 0x000005f4, 0x000005f4, 0x00000600, 0x00000605, + 0x00000610, 0x0000061a, 0x0000061c, 0x0000061c, + 0x00000640, 0x00000640, 0x0000064b, 0x0000065f, + 0x00000670, 0x00000670, 0x000006d6, 0x000006dd, + 0x000006df, 0x000006e8, 0x000006ea, 0x000006ed, + 0x0000070f, 0x0000070f, 0x00000711, 0x00000711, + 0x00000730, 0x0000074a, 0x000007a6, 0x000007b0, + 0x000007eb, 0x000007f5, 0x000007fa, 0x000007fa, + 0x00000816, 0x0000082d, 0x00000859, 0x0000085b, + 0x000008d4, 0x00000902, 0x0000093a, 0x0000093a, + 0x0000093c, 0x0000093c, 0x00000941, 0x00000948, + 0x0000094d, 0x0000094d, 0x00000951, 0x00000957, + 0x00000962, 0x00000963, 0x00000971, 0x00000971, + 0x00000981, 0x00000981, 0x000009bc, 0x000009bc, + 0x000009c1, 0x000009c4, 0x000009cd, 0x000009cd, + 0x000009e2, 0x000009e3, 0x00000a01, 0x00000a02, + 0x00000a3c, 0x00000a3c, 0x00000a41, 0x00000a42, + 0x00000a47, 0x00000a48, 0x00000a4b, 0x00000a4d, + 0x00000a51, 0x00000a51, 0x00000a70, 0x00000a71, + 0x00000a75, 0x00000a75, 0x00000a81, 0x00000a82, + 0x00000abc, 0x00000abc, 0x00000ac1, 0x00000ac5, + 0x00000ac7, 0x00000ac8, 0x00000acd, 0x00000acd, + 0x00000ae2, 0x00000ae3, 0x00000afa, 0x00000aff, + 0x00000b01, 0x00000b01, 0x00000b3c, 0x00000b3c, + 0x00000b3f, 0x00000b3f, 0x00000b41, 0x00000b44, + 0x00000b4d, 0x00000b4d, 0x00000b56, 0x00000b56, + 0x00000b62, 0x00000b63, 0x00000b82, 0x00000b82, + 0x00000bc0, 0x00000bc0, 0x00000bcd, 0x00000bcd, + 0x00000c00, 0x00000c00, 0x00000c3e, 0x00000c40, + 0x00000c46, 0x00000c48, 0x00000c4a, 0x00000c4d, + 0x00000c55, 0x00000c56, 0x00000c62, 0x00000c63, + 0x00000c81, 0x00000c81, 0x00000cbc, 0x00000cbc, + 0x00000cbf, 0x00000cbf, 0x00000cc6, 0x00000cc6, + 0x00000ccc, 0x00000ccd, 0x00000ce2, 0x00000ce3, + 0x00000d00, 0x00000d01, 0x00000d3b, 0x00000d3c, + 0x00000d41, 0x00000d44, 0x00000d4d, 0x00000d4d, + 0x00000d62, 0x00000d63, 0x00000dca, 0x00000dca, + 0x00000dd2, 0x00000dd4, 0x00000dd6, 0x00000dd6, + 0x00000e31, 0x00000e31, 0x00000e34, 0x00000e3a, + 0x00000e46, 0x00000e4e, 0x00000eb1, 0x00000eb1, + 0x00000eb4, 0x00000eb9, 0x00000ebb, 0x00000ebc, + 0x00000ec6, 0x00000ec6, 0x00000ec8, 0x00000ecd, + 0x00000f18, 0x00000f19, 0x00000f35, 0x00000f35, + 0x00000f37, 0x00000f37, 0x00000f39, 0x00000f39, + 0x00000f71, 0x00000f7e, 0x00000f80, 0x00000f84, + 0x00000f86, 0x00000f87, 0x00000f8d, 0x00000f97, + 0x00000f99, 0x00000fbc, 0x00000fc6, 0x00000fc6, + 0x0000102d, 0x00001030, 0x00001032, 0x00001037, + 0x00001039, 0x0000103a, 0x0000103d, 0x0000103e, + 0x00001058, 0x00001059, 0x0000105e, 0x00001060, + 0x00001071, 0x00001074, 0x00001082, 0x00001082, + 0x00001085, 0x00001086, 0x0000108d, 0x0000108d, + 0x0000109d, 0x0000109d, 0x000010fc, 0x000010fc, + 0x0000135d, 0x0000135f, 0x00001712, 0x00001714, + 0x00001732, 0x00001734, 0x00001752, 0x00001753, + 0x00001772, 0x00001773, 0x000017b4, 0x000017b5, + 0x000017b7, 0x000017bd, 0x000017c6, 0x000017c6, + 0x000017c9, 0x000017d3, 0x000017d7, 0x000017d7, + 0x000017dd, 0x000017dd, 0x0000180b, 0x0000180e, + 0x00001843, 0x00001843, 0x00001885, 0x00001886, + 0x000018a9, 0x000018a9, 0x00001920, 0x00001922, + 0x00001927, 0x00001928, 0x00001932, 0x00001932, + 0x00001939, 0x0000193b, 0x00001a17, 0x00001a18, + 0x00001a1b, 0x00001a1b, 0x00001a56, 0x00001a56, + 0x00001a58, 0x00001a5e, 0x00001a60, 0x00001a60, + 0x00001a62, 0x00001a62, 0x00001a65, 0x00001a6c, + 0x00001a73, 0x00001a7c, 0x00001a7f, 0x00001a7f, + 0x00001aa7, 0x00001aa7, 0x00001ab0, 0x00001abe, + 0x00001b00, 0x00001b03, 0x00001b34, 0x00001b34, + 0x00001b36, 0x00001b3a, 0x00001b3c, 0x00001b3c, + 0x00001b42, 0x00001b42, 0x00001b6b, 0x00001b73, + 0x00001b80, 0x00001b81, 0x00001ba2, 0x00001ba5, + 0x00001ba8, 0x00001ba9, 0x00001bab, 0x00001bad, + 0x00001be6, 0x00001be6, 0x00001be8, 0x00001be9, + 0x00001bed, 0x00001bed, 0x00001bef, 0x00001bf1, + 0x00001c2c, 0x00001c33, 0x00001c36, 0x00001c37, + 0x00001c78, 0x00001c7d, 0x00001cd0, 0x00001cd2, + 0x00001cd4, 0x00001ce0, 0x00001ce2, 0x00001ce8, + 0x00001ced, 0x00001ced, 0x00001cf4, 0x00001cf4, + 0x00001cf8, 0x00001cf9, 0x00001d2c, 0x00001d6a, + 0x00001d78, 0x00001d78, 0x00001d9b, 0x00001df9, + 0x00001dfb, 0x00001dff, 0x00001fbd, 0x00001fbd, + 0x00001fbf, 0x00001fc1, 0x00001fcd, 0x00001fcf, + 0x00001fdd, 0x00001fdf, 0x00001fed, 0x00001fef, + 0x00001ffd, 0x00001ffe, 0x0000200b, 0x0000200f, + 0x00002018, 0x00002019, 0x00002024, 0x00002024, + 0x00002027, 0x00002027, 0x0000202a, 0x0000202e, + 0x00002060, 0x00002064, 0x00002066, 0x0000206f, + 0x00002071, 0x00002071, 0x0000207f, 0x0000207f, + 0x00002090, 0x0000209c, 0x000020d0, 0x000020f0, + 0x00002c7c, 0x00002c7d, 0x00002cef, 0x00002cf1, + 0x00002d6f, 0x00002d6f, 0x00002d7f, 0x00002d7f, + 0x00002de0, 0x00002dff, 0x00002e2f, 0x00002e2f, + 0x00003005, 0x00003005, 0x0000302a, 0x0000302d, + 0x00003031, 0x00003035, 0x0000303b, 0x0000303b, + 0x00003099, 0x0000309e, 0x000030fc, 0x000030fe, + 0x0000a015, 0x0000a015, 0x0000a4f8, 0x0000a4fd, + 0x0000a60c, 0x0000a60c, 0x0000a66f, 0x0000a672, + 0x0000a674, 0x0000a67d, 0x0000a67f, 0x0000a67f, + 0x0000a69c, 0x0000a69f, 0x0000a6f0, 0x0000a6f1, + 0x0000a700, 0x0000a721, 0x0000a770, 0x0000a770, + 0x0000a788, 0x0000a78a, 0x0000a7f8, 0x0000a7f9, + 0x0000a802, 0x0000a802, 0x0000a806, 0x0000a806, + 0x0000a80b, 0x0000a80b, 0x0000a825, 0x0000a826, + 0x0000a8c4, 0x0000a8c5, 0x0000a8e0, 0x0000a8f1, + 0x0000a926, 0x0000a92d, 0x0000a947, 0x0000a951, + 0x0000a980, 0x0000a982, 0x0000a9b3, 0x0000a9b3, + 0x0000a9b6, 0x0000a9b9, 0x0000a9bc, 0x0000a9bc, + 0x0000a9cf, 0x0000a9cf, 0x0000a9e5, 0x0000a9e6, + 0x0000aa29, 0x0000aa2e, 0x0000aa31, 0x0000aa32, + 0x0000aa35, 0x0000aa36, 0x0000aa43, 0x0000aa43, + 0x0000aa4c, 0x0000aa4c, 0x0000aa70, 0x0000aa70, + 0x0000aa7c, 0x0000aa7c, 0x0000aab0, 0x0000aab0, + 0x0000aab2, 0x0000aab4, 0x0000aab7, 0x0000aab8, + 0x0000aabe, 0x0000aabf, 0x0000aac1, 0x0000aac1, + 0x0000aadd, 0x0000aadd, 0x0000aaec, 0x0000aaed, + 0x0000aaf3, 0x0000aaf4, 0x0000aaf6, 0x0000aaf6, + 0x0000ab5b, 0x0000ab5f, 0x0000abe5, 0x0000abe5, + 0x0000abe8, 0x0000abe8, 0x0000abed, 0x0000abed, + 0x0000fb1e, 0x0000fb1e, 0x0000fbb2, 0x0000fbc1, + 0x0000fe00, 0x0000fe0f, 0x0000fe13, 0x0000fe13, + 0x0000fe20, 0x0000fe2f, 0x0000fe52, 0x0000fe52, + 0x0000fe55, 0x0000fe55, 0x0000feff, 0x0000feff, + 0x0000ff07, 0x0000ff07, 0x0000ff0e, 0x0000ff0e, + 0x0000ff1a, 0x0000ff1a, 0x0000ff3e, 0x0000ff3e, + 0x0000ff40, 0x0000ff40, 0x0000ff70, 0x0000ff70, + 0x0000ff9e, 0x0000ff9f, 0x0000ffe3, 0x0000ffe3, + 0x0000fff9, 0x0000fffb, 0x000101fd, 0x000101fd, + 0x000102e0, 0x000102e0, 0x00010376, 0x0001037a, + 0x00010a01, 0x00010a03, 0x00010a05, 0x00010a06, + 0x00010a0c, 0x00010a0f, 0x00010a38, 0x00010a3a, + 0x00010a3f, 0x00010a3f, 0x00010ae5, 0x00010ae6, + 0x00011001, 0x00011001, 0x00011038, 0x00011046, + 0x0001107f, 0x00011081, 0x000110b3, 0x000110b6, + 0x000110b9, 0x000110ba, 0x000110bd, 0x000110bd, + 0x00011100, 0x00011102, 0x00011127, 0x0001112b, + 0x0001112d, 0x00011134, 0x00011173, 0x00011173, + 0x00011180, 0x00011181, 0x000111b6, 0x000111be, + 0x000111ca, 0x000111cc, 0x0001122f, 0x00011231, + 0x00011234, 0x00011234, 0x00011236, 0x00011237, + 0x0001123e, 0x0001123e, 0x000112df, 0x000112df, + 0x000112e3, 0x000112ea, 0x00011300, 0x00011301, + 0x0001133c, 0x0001133c, 0x00011340, 0x00011340, + 0x00011366, 0x0001136c, 0x00011370, 0x00011374, + 0x00011438, 0x0001143f, 0x00011442, 0x00011444, + 0x00011446, 0x00011446, 0x000114b3, 0x000114b8, + 0x000114ba, 0x000114ba, 0x000114bf, 0x000114c0, + 0x000114c2, 0x000114c3, 0x000115b2, 0x000115b5, + 0x000115bc, 0x000115bd, 0x000115bf, 0x000115c0, + 0x000115dc, 0x000115dd, 0x00011633, 0x0001163a, + 0x0001163d, 0x0001163d, 0x0001163f, 0x00011640, + 0x000116ab, 0x000116ab, 0x000116ad, 0x000116ad, + 0x000116b0, 0x000116b5, 0x000116b7, 0x000116b7, + 0x0001171d, 0x0001171f, 0x00011722, 0x00011725, + 0x00011727, 0x0001172b, 0x00011a01, 0x00011a06, + 0x00011a09, 0x00011a0a, 0x00011a33, 0x00011a38, + 0x00011a3b, 0x00011a3e, 0x00011a47, 0x00011a47, + 0x00011a51, 0x00011a56, 0x00011a59, 0x00011a5b, + 0x00011a8a, 0x00011a96, 0x00011a98, 0x00011a99, + 0x00011c30, 0x00011c36, 0x00011c38, 0x00011c3d, + 0x00011c3f, 0x00011c3f, 0x00011c92, 0x00011ca7, + 0x00011caa, 0x00011cb0, 0x00011cb2, 0x00011cb3, + 0x00011cb5, 0x00011cb6, 0x00011d31, 0x00011d36, + 0x00011d3a, 0x00011d3a, 0x00011d3c, 0x00011d3d, + 0x00011d3f, 0x00011d45, 0x00011d47, 0x00011d47, + 0x00016af0, 0x00016af4, 0x00016b30, 0x00016b36, + 0x00016b40, 0x00016b43, 0x00016f8f, 0x00016f9f, + 0x00016fe0, 0x00016fe1, 0x0001bc9d, 0x0001bc9e, + 0x0001bca0, 0x0001bca3, 0x0001d167, 0x0001d169, + 0x0001d173, 0x0001d182, 0x0001d185, 0x0001d18b, + 0x0001d1aa, 0x0001d1ad, 0x0001d242, 0x0001d244, + 0x0001da00, 0x0001da36, 0x0001da3b, 0x0001da6c, + 0x0001da75, 0x0001da75, 0x0001da84, 0x0001da84, + 0x0001da9b, 0x0001da9f, 0x0001daa1, 0x0001daaf, + 0x0001e000, 0x0001e006, 0x0001e008, 0x0001e018, + 0x0001e01b, 0x0001e021, 0x0001e023, 0x0001e024, + 0x0001e026, 0x0001e02a, 0x0001e8d0, 0x0001e8d6, + 0x0001e944, 0x0001e94a, 0x0001f3fb, 0x0001f3ff, + 0x000e0001, 0x000e0001, 0x000e0020, 0x000e007f, + 0x000e0100, 0x000e01ef +}; + +static const unsigned _uccase_upper_g_size = 254; +static const short _uccase_upper_g[] = { + 4516, 492, 479, 343, 210, 2449, 70, 1, + 7103, 1, 186, 263, 29574, 9, 5070, 3, + 358, 4143, 4442, 1227, 520, 8, 1203, 36, + -299, 558, 42, 26, 101, 501, 384, 122, + 4012, 30, 601, 1241, 460, -631, 344, 1, + 786, 491, 1658, 10744, 803, 2, 935, 2, + 120, 1, 2269, 343, 576, 2, 440, 1155, + 479, 1223, 6447, 54, 831, 39, 16850, 1484, + 836, 2, 378, 24, 227, 1140, 441, 1, + 154, 137, 1095, 217, 3586, 515, 170, 534, + 1449, 3060, 307, 1, 908, 3, 1842, 125, + -1388, 1, 586, 1, 249, 4091, 692, 260, + 754, 65, 625, 368, -70, 326, 2255, 65, + 389, 1661, 1709, 1160, 2933, 1, 680, 96, + -961, 385, 40, 51, 1087, 3, 665, 1815, + 1265, 2, 79, 24, 3984, 1220, 32767, 612, + 691, 16, 175, 469, 1639, 268, 61, 27, + 1259, 624, -619, 3, 109, 1, 1238, 7737, + 1659, 6819, 2792, 1, 2326, 112, -1308, 516, + 533, 17, 1704, 441, 645, 10808, 1105, 2, + 129, 1, 902, 667, -467, 63, 170, 6, + 17, 1367, 580, 1048, 1020, 18, 1095, 30, + 148, -1081, 1559, 1, 185, 459, 1758, 499, + 335, 42, 202, 6, -1211, 2376, 1148, 4, + 1664, 98, 4484, 8432, 1243, 86, 2611, 62, + 185, 108, -463, 56, 353, 2, 150, -1176, + 2518, 766, 4997, 36, 425, 713, 183, 2662, + 489, 1, 41, 699, 99, 2769, 1415, 198, + 725, 2, 4, 1996, 645, 1, -948, 250, + 155, 1049, 883, 306, 4668, 34, 966, 57, + 10917, 1439, 136, 1, 56, 62, 288, 1174, + 5175, 35, 807, 207, 89, 2279 +}; + +static const unsigned _uccase_upper_table_size = 1396; +static const unsigned _uccase_upper_table[] = { + 0x00001e05, 0x00001e04, 0x0000056e, 0x0000053e, + 0x00002c4a, 0x00002c1a, 0x0000ab9e, 0x000013ce, + 0x00002c87, 0x00002c86, 0x000104de, 0x000104b6, + 0x00002cd7, 0x00002cd6, 0x0001e927, 0x0001e905, + 0x00000259, 0x0000018f, 0x0001043a, 0x00010412, + 0x0000ff46, 0x0000ff26, 0x00001edf, 0x00001ede, + 0x00000256, 0x00000189, 0x00001fa8, 0x02000103, + 0x000003b5, 0x00000395, 0x0000aba2, 0x000013d2, + 0x000004b1, 0x000004b0, 0x00000173, 0x00000172, + 0x000024e0, 0x000024c6, 0x00002c8b, 0x00002c8a, + 0x0000ab74, 0x000013a4, 0x0000019e, 0x00000220, + 0x0000045e, 0x0000040e, 0x00002d17, 0x000010b7, + 0x00001e41, 0x00001e40, 0x00002d0f, 0x000010af, + 0x00002c3f, 0x00002c0f, 0x0000a7a3, 0x0000a7a2, + 0x00001ff6, 0x020000d0, 0x00002d0a, 0x000010aa, + 0x000104f1, 0x000104c9, 0x0000ab9a, 0x000013ca, + 0x00001f91, 0x0200001b, 0x000024e7, 0x000024cd, + 0x00002c65, 0x0000023a, 0x0001044b, 0x00010423, + 0x0000ab71, 0x000013a1, 0x0001e92f, 0x0001e90d, + 0x0000048d, 0x0000048c, 0x0000ab7f, 0x000013af, + 0x0000a689, 0x0000a688, 0x000001d2, 0x000001d1, + 0x00002d0e, 0x000010ae, 0x00001ed7, 0x00001ed6, + 0x0000a72d, 0x0000a72c, 0x00001fc7, 0x0300013a, + 0x00000125, 0x00000124, 0x00002c32, 0x00002c02, + 0x00000195, 0x000001f6, 0x00000453, 0x00000403, + 0x000004c6, 0x000004c5, 0x00000167, 0x00000166, + 0x00010ce1, 0x00010ca1, 0x00002cbf, 0x00002cbe, + 0x00002c3a, 0x00002c0a, 0x0000a667, 0x0000a666, + 0x00010446, 0x0001041e, 0x0000ff52, 0x0000ff32, + 0x00001e27, 0x00001e26, 0x000003f2, 0x000003f9, + 0x00001ef9, 0x00001ef8, 0x000004d5, 0x000004d4, + 0x00001f53, 0x00001f5b, 0x000003e7, 0x000003e6, + 0x0000ab9b, 0x000013cb, 0x000004e1, 0x000004e0, + 0x0000ab9c, 0x000013cc, 0x0000056a, 0x0000053a, + 0x00002c4e, 0x00002c1e, 0x0001042a, 0x00010402, + 0x00010429, 0x00010401, 0x00001e83, 0x00001e82, + 0x00002c3e, 0x00002c0e, 0x00001e8d, 0x00001e8c, + 0x00001f92, 0x0200001e, 0x00001f42, 0x00001f4a, + 0x00000435, 0x00000415, 0x000104fb, 0x000104d3, + 0x00000121, 0x00000120, 0x00001e25, 0x00001e24, + 0x00000561, 0x00000531, 0x00002c56, 0x00002c26, + 0x00000573, 0x00000543, 0x00002c97, 0x00002c96, + 0x00000570, 0x00000540, 0x00000079, 0x00000059, + 0x0000ab7e, 0x000013ae, 0x00000491, 0x00000490, + 0x0000abb5, 0x000013e5, 0x0000a649, 0x0000a648, + 0x00001f03, 0x00001f0b, 0x000004b3, 0x000004b2, + 0x00001f15, 0x00001f1d, 0x000003b1, 0x00000391, + 0x00001eed, 0x00001eec, 0x000004bf, 0x000004be, + 0x0000028c, 0x00000245, 0x00010ce6, 0x00010ca6, + 0x00002c5c, 0x00002c2c, 0x0000052f, 0x0000052e, + 0x0000a685, 0x0000a684, 0x0000abb3, 0x000013e3, + 0x00002d23, 0x000010c3, 0x00002174, 0x00002164, + 0x00000254, 0x00000186, 0x00001e47, 0x00001e46, + 0x00001f63, 0x00001f6b, 0x00001f7b, 0x00001feb, + 0x00000511, 0x00000510, 0x00001f89, 0x020000d6, + 0x000001e9, 0x000001e8, 0x00002c47, 0x00002c17, + 0x000000e2, 0x000000c2, 0x0001e941, 0x0001e91f, + 0x0000ab87, 0x000013b7, 0x00000135, 0x00000134, + 0x0000056b, 0x0000053b, 0x000003ce, 0x0000038f, + 0x00001fe5, 0x00001fec, 0x0000020d, 0x0000020c, + 0x00001fa2, 0x02000036, 0x00000261, 0x0000a7ac, + 0x00001e97, 0x0200008e, 0x00000269, 0x00000196, + 0x00001ff3, 0x0200004e, 0x00000585, 0x00000555, + 0x00000576, 0x00000546, 0x00000142, 0x00000141, + 0x00000161, 0x00000160, 0x00001ef5, 0x00001ef4, + 0x00002cc9, 0x00002cc8, 0x0000abbf, 0x000013ef, + 0x0000a661, 0x0000a660, 0x00001e0d, 0x00001e0c, + 0x00002d24, 0x000010c4, 0x000118c5, 0x000118a5, + 0x000003b9, 0x00000399, 0x00001fa0, 0x02000030, + 0x0000ff55, 0x0000ff35, 0x0000fb15, 0x02000074, + 0x000004f5, 0x000004f4, 0x00001fa6, 0x02000042, + 0x000024e2, 0x000024c8, 0x00002d16, 0x000010b6, + 0x0000026c, 0x0000a7ad, 0x00002c39, 0x00002c09, + 0x0000028a, 0x000001b1, 0x00002d22, 0x000010c2, + 0x0001e92c, 0x0001e90a, 0x00002d1c, 0x000010bc, + 0x00001e85, 0x00001e84, 0x0000a781, 0x0000a780, + 0x00001e99, 0x02000094, 0x00000431, 0x00000411, + 0x00001eab, 0x00001eaa, 0x00000443, 0x00000423, + 0x0000a73d, 0x0000a73c, 0x0000043a, 0x0000041a, + 0x0000a64d, 0x0000a64c, 0x000118ca, 0x000118aa, + 0x00002c8f, 0x00002c8e, 0x00010cc5, 0x00010c85, + 0x0000024f, 0x0000024e, 0x000001c6, 0x000001c4, + 0x0000ab73, 0x000013a3, 0x00000288, 0x000001ae, + 0x0000037b, 0x000003fd, 0x00001ecb, 0x00001eca, + 0x000001c8, 0x000001c7, 0x00001f8e, 0x020000e5, + 0x00010434, 0x0001040c, 0x00001f30, 0x00001f38, + 0x000004a3, 0x000004a2, 0x0000026a, 0x0000a7ae, + 0x0000aba9, 0x000013d9, 0x00002ccf, 0x00002cce, + 0x000003b6, 0x00000396, 0x0000a76b, 0x0000a76a, + 0x0000a73b, 0x0000a73a, 0x000118d8, 0x000118b8, + 0x00001e49, 0x00001e48, 0x00002d08, 0x000010a8, + 0x00001e35, 0x00001e34, 0x000000fc, 0x000000dc, + 0x00001e6d, 0x00001e6c, 0x0000017f, 0x00000053, + 0x000104e2, 0x000104ba, 0x000024e5, 0x000024cb, + 0x00001f02, 0x00001f0a, 0x00000519, 0x00000518, + 0x00000123, 0x00000122, 0x00002176, 0x00002166, + 0x00002c83, 0x00002c82, 0x000104f9, 0x000104d1, + 0x00000223, 0x00000222, 0x000104dc, 0x000104b4, + 0x000024d2, 0x000024b8, 0x00001ebd, 0x00001ebc, + 0x0000a763, 0x0000a762, 0x00001fa9, 0x02000106, + 0x0000a735, 0x0000a734, 0x00001e81, 0x00001e80, + 0x00000583, 0x00000553, 0x00000225, 0x00000224, + 0x00000283, 0x000001a9, 0x00000113, 0x00000112, + 0x00001f22, 0x00001f2a, 0x00002cc7, 0x00002cc6, + 0x00010ce0, 0x00010ca0, 0x00002caf, 0x00002cae, + 0x0000ab84, 0x000013b4, 0x00000078, 0x00000058, + 0x00001fa4, 0x0200003c, 0x0000a785, 0x0000a784, + 0x00001ffc, 0x02000121, 0x0000ff53, 0x0000ff33, + 0x00001f82, 0x02000006, 0x000004dd, 0x000004dc, + 0x00002d20, 0x000010c0, 0x0000abbd, 0x000013ed, + 0x0000ab77, 0x000013a7, 0x00001f74, 0x00001fca, + 0x0000014b, 0x0000014a, 0x00000066, 0x00000046, + 0x000000e5, 0x000000c5, 0x00001f78, 0x00001ff8, + 0x000001dc, 0x000001db, 0x0001e929, 0x0001e907, + 0x00000219, 0x00000218, 0x000104f4, 0x000104cc, + 0x0000046b, 0x0000046a, 0x00001fab, 0x0200010c, + 0x0000043d, 0x0000041d, 0x0000022d, 0x0000022c, + 0x0000abb1, 0x000013e1, 0x00002c57, 0x00002c27, + 0x00000569, 0x00000539, 0x00002c9d, 0x00002c9c, + 0x00000109, 0x00000108, 0x0000a64b, 0x0000a64a, + 0x00002cb9, 0x00002cb8, 0x0000a729, 0x0000a728, + 0x00010442, 0x0001041a, 0x0000a643, 0x0000a642, + 0x00002c52, 0x00002c22, 0x00002c6c, 0x00002c6b, + 0x000104ef, 0x000104c7, 0x00000065, 0x00000045, + 0x000024e3, 0x000024c9, 0x0000048b, 0x0000048a, + 0x0000012d, 0x0000012c, 0x00001fc2, 0x0200012a, + 0x000104e7, 0x000104bf, 0x000000f0, 0x000000d0, + 0x0001043b, 0x00010413, 0x0000026f, 0x0000019c, + 0x0000a697, 0x0000a696, 0x00001e5d, 0x00001e5c, + 0x00000280, 0x000001a6, 0x00000111, 0x00000110, + 0x000003ad, 0x00000388, 0x00001e51, 0x00001e50, + 0x000003d6, 0x000003a0, 0x00001f83, 0x02000009, + 0x000003b0, 0x03000084, 0x00000117, 0x00000116, + 0x0000052b, 0x0000052a, 0x00002c51, 0x00002c21, + 0x00000503, 0x00000502, 0x0000abaf, 0x000013df, + 0x0000abaa, 0x000013da, 0x00002c5b, 0x00002c2b, + 0x00010436, 0x0001040e, 0x00002c58, 0x00002c28, + 0x00001ebb, 0x00001eba, 0x0000014d, 0x0000014c, + 0x00010438, 0x00010410, 0x0000a74d, 0x0000a74c, + 0x00001f7c, 0x00001ffa, 0x000024d8, 0x000024be, + 0x00001eaf, 0x00001eae, 0x00000107, 0x00000106, + 0x000001ce, 0x000001cd, 0x00000448, 0x00000428, + 0x00000061, 0x00000041, 0x00010cdc, 0x00010c9c, + 0x0000a655, 0x0000a654, 0x0000ab92, 0x000013c2, + 0x0000a669, 0x0000a668, 0x00001e15, 0x00001e14, + 0x0000a7a1, 0x0000a7a0, 0x00001f33, 0x00001f3b, + 0x0000015b, 0x0000015a, 0x00001e3d, 0x00001e3c, + 0x0000a7a7, 0x0000a7a6, 0x00002d02, 0x000010a2, + 0x00010cc7, 0x00010c87, 0x0000abba, 0x000013ea, + 0x000004ff, 0x000004fe, 0x00010cf1, 0x00010cb1, + 0x000118dc, 0x000118bc, 0x000001dd, 0x0000018e, + 0x00010cc0, 0x00010c80, 0x000001ed, 0x000001ec, + 0x0001e934, 0x0001e912, 0x00000073, 0x00000053, + 0x000104f2, 0x000104ca, 0x0000ff48, 0x0000ff28, + 0x00001ea1, 0x00001ea0, 0x000001b0, 0x000001af, + 0x00010440, 0x00010418, 0x0000abbc, 0x000013ec, + 0x0000ff45, 0x0000ff25, 0x000001f5, 0x000001f4, + 0x00000157, 0x00000156, 0x00000571, 0x00000541, + 0x000000e6, 0x000000c6, 0x00010cc2, 0x00010c82, + 0x00002ca7, 0x00002ca6, 0x0000048f, 0x0000048e, + 0x00000371, 0x00000370, 0x00001e09, 0x00001e08, + 0x000000e1, 0x000000c1, 0x00001e01, 0x00001e00, + 0x0000a769, 0x0000a768, 0x00001f75, 0x00001fcb, + 0x000004af, 0x000004ae, 0x000104ed, 0x000104c5, + 0x000004f3, 0x000004f2, 0x000000e4, 0x000000c4, + 0x00002178, 0x00002168, 0x00002cdd, 0x00002cdc, + 0x0000abad, 0x000013dd, 0x000001e5, 0x000001e4, + 0x0000ab8d, 0x000013bd, 0x0000a65b, 0x0000a65a, + 0x000118da, 0x000118ba, 0x0000a79f, 0x0000a79e, + 0x00001e63, 0x00001e62, 0x00000074, 0x00000054, + 0x00001f7d, 0x00001ffb, 0x000104f5, 0x000104cd, + 0x00001f8f, 0x020000e8, 0x00001fe6, 0x020000c9, + 0x000001cc, 0x000001ca, 0x00000515, 0x00000514, + 0x00000203, 0x00000202, 0x00001c83, 0x00000421, + 0x00000227, 0x00000226, 0x000003e3, 0x000003e2, + 0x0000012b, 0x0000012a, 0x00001ff4, 0x02000133, + 0x0000a64f, 0x0000a64e, 0x0000aba7, 0x000013d7, + 0x0000a72b, 0x0000a72a, 0x00001ec1, 0x00001ec0, + 0x00000471, 0x00000470, 0x00001ee9, 0x00001ee8, + 0x000000fe, 0x000000de, 0x0000006d, 0x0000004d, + 0x0000011f, 0x0000011e, 0x00002c42, 0x00002c12, + 0x00000068, 0x00000048, 0x00002c50, 0x00002c20, + 0x00010ce8, 0x00010ca8, 0x0000a665, 0x0000a664, + 0x00001e53, 0x00001e52, 0x000003c0, 0x000003a0, + 0x00001fa5, 0x0200003f, 0x0000a79d, 0x0000a79c, + 0x00001e37, 0x00001e36, 0x0000a797, 0x0000a796, + 0x00001f11, 0x00001f19, 0x00010435, 0x0001040d, + 0x00002c35, 0x00002c05, 0x00010cd9, 0x00010c99, + 0x0000044e, 0x0000042e, 0x0001e93c, 0x0001e91a, + 0x000000fa, 0x000000da, 0x00010ccd, 0x00010c8d, + 0x00010cd4, 0x00010c94, 0x0001e928, 0x0001e906, + 0x000003ac, 0x00000386, 0x00001e93, 0x00001e92, + 0x00000577, 0x00000547, 0x00001e8b, 0x00001e8a, + 0x00000433, 0x00000413, 0x00001ea9, 0x00001ea8, + 0x00001fc4, 0x0200012d, 0x00001fa7, 0x02000045, + 0x0000056d, 0x0000053d, 0x00000119, 0x00000118, + 0x00001c82, 0x0000041e, 0x00002cab, 0x00002caa, + 0x00010cd5, 0x00010c95, 0x00000446, 0x00000426, + 0x0001e93f, 0x0001e91d, 0x000118d5, 0x000118b5, + 0x000118d3, 0x000118b3, 0x0000a753, 0x0000a752, + 0x00000201, 0x00000200, 0x0000a761, 0x0000a760, + 0x00001f13, 0x00001f1b, 0x0000049f, 0x0000049e, + 0x00001f25, 0x00001f2d, 0x000004b9, 0x000004b8, + 0x000003c6, 0x000003a6, 0x00000493, 0x00000492, + 0x0000217f, 0x0000216f, 0x000118c8, 0x000118a8, + 0x000000f6, 0x000000d6, 0x0000ab93, 0x000013c3, + 0x00002c6a, 0x00002c69, 0x000104f8, 0x000104d0, + 0x0000a745, 0x0000a744, 0x000104ea, 0x000104c2, + 0x000003f5, 0x00000395, 0x00001e4d, 0x00001e4c, + 0x0000050d, 0x0000050c, 0x0000ab8e, 0x000013be, + 0x00010cdf, 0x00010c9f, 0x00010cf2, 0x00010cb2, + 0x000003b2, 0x00000392, 0x00002c59, 0x00002c29, + 0x0000aba1, 0x000013d1, 0x00002170, 0x00002160, + 0x0000ab80, 0x000013b0, 0x0000a725, 0x0000a724, + 0x00001ea3, 0x00001ea2, 0x00000144, 0x00000143, + 0x00001ec3, 0x00001ec2, 0x0000ff4a, 0x0000ff2a, + 0x00001ecf, 0x00001ece, 0x00000469, 0x00000468, + 0x00001ee7, 0x00001ee6, 0x00000467, 0x00000466, + 0x000001c5, 0x000001c4, 0x00000101, 0x00000100, + 0x0001e935, 0x0001e913, 0x00010cce, 0x00010c8e, + 0x00002c41, 0x00002c11, 0x00010cc6, 0x00010c86, + 0x0000a65d, 0x0000a65c, 0x00010448, 0x00010420, + 0x0000029d, 0x0000a7b2, 0x00001f23, 0x00001f2b, + 0x0000a683, 0x0000a682, 0x00001fb4, 0x02000127, + 0x000004d3, 0x000004d2, 0x00001f43, 0x00001f4b, + 0x000004ca, 0x000004c9, 0x00001f12, 0x00001f1a, + 0x00010cd2, 0x00010c92, 0x000024d6, 0x000024bc, + 0x0000051d, 0x0000051c, 0x00002172, 0x00002162, + 0x00001fe3, 0x030000c2, 0x00002c37, 0x00002c07, + 0x00001f98, 0x020000eb, 0x00000442, 0x00000422, + 0x000104e8, 0x000104c0, 0x00000271, 0x00002c6e, + 0x00001ea5, 0x00001ea4, 0x00010ced, 0x00010cad, + 0x00001fb3, 0x02000048, 0x0000057f, 0x0000054f, + 0x00000242, 0x00000241, 0x00010ceb, 0x00010cab, + 0x00002cb7, 0x00002cb6, 0x0000026b, 0x00002c62, + 0x00002cad, 0x00002cac, 0x00000436, 0x00000416, + 0x0000024d, 0x0000024c, 0x0001e937, 0x0001e915, + 0x0001e943, 0x0001e921, 0x00010cf0, 0x00010cb0, + 0x0000a645, 0x0000a644, 0x00001ec5, 0x00001ec4, + 0x00010cc9, 0x00010c89, 0x00010431, 0x00010409, + 0x000004e5, 0x000004e4, 0x0000abb0, 0x000013e0, + 0x000004b7, 0x000004b6, 0x00001f26, 0x00001f2e, + 0x0000ab79, 0x000013a9, 0x000000e3, 0x000000c3, + 0x00001e96, 0x0200008b, 0x00002d25, 0x000010c5, + 0x00001f60, 0x00001f68, 0x0000a695, 0x0000a694, + 0x00001e45, 0x00001e44, 0x0000a793, 0x0000a792, + 0x0000aba6, 0x000013d6, 0x000024d0, 0x000024b6, + 0x00001f71, 0x00001fbb, 0x000024db, 0x000024c1, + 0x00001f85, 0x0200000f, 0x00000439, 0x00000419, + 0x00001fae, 0x02000115, 0x00000513, 0x00000512, + 0x00002c4f, 0x00002c1f, 0x00000452, 0x00000402, + 0x00000192, 0x00000191, 0x0001e942, 0x0001e920, + 0x00001f62, 0x00001f6a, 0x000104e5, 0x000104bd, + 0x00000566, 0x00000536, 0x0001042c, 0x00010404, + 0x000024df, 0x000024c5, 0x000104ec, 0x000104c4, + 0x000000f8, 0x000000d8, 0x00001fd7, 0x030000ba, + 0x00000450, 0x00000400, 0x000118c9, 0x000118a9, + 0x000004a9, 0x000004a8, 0x00002179, 0x00002169, + 0x0000016f, 0x0000016e, 0x00000169, 0x00000168, + 0x00000171, 0x00000170, 0x0000a747, 0x0000a746, + 0x00001e0b, 0x00001e0a, 0x000001b4, 0x000001b3, + 0x00001f52, 0x0300009d, 0x0000a783, 0x0000a782, + 0x00001f35, 0x00001f3d, 0x0000ff57, 0x0000ff37, + 0x0000a7b7, 0x0000a7b6, 0x000004db, 0x000004da, + 0x00010437, 0x0001040f, 0x0001044e, 0x00010426, + 0x00002c76, 0x00002c75, 0x000004ed, 0x000004ec, + 0x00000266, 0x0000a7aa, 0x00010ccf, 0x00010c8f, + 0x00002cbb, 0x00002cba, 0x00001e39, 0x00001e38, + 0x00000067, 0x00000047, 0x00001f93, 0x02000021, + 0x0000fb05, 0x02000065, 0x000104f6, 0x000104ce, + 0x0000a73f, 0x0000a73e, 0x00010449, 0x00010421, + 0x0000ab88, 0x000013b8, 0x00010444, 0x0001041c, + 0x0000ff4e, 0x0000ff2e, 0x00002c61, 0x00002c60, + 0x0000ab89, 0x000013b9, 0x00002c95, 0x00002c94, + 0x00000579, 0x00000549, 0x00002d1e, 0x000010be, + 0x000000e8, 0x000000c8, 0x0000025b, 0x00000190, + 0x000104eb, 0x000104c3, 0x0000a757, 0x0000a756, + 0x00001ed5, 0x00001ed4, 0x0000a75b, 0x0000a75a, + 0x00001e03, 0x00001e02, 0x000003b3, 0x00000393, + 0x00010cee, 0x00010cae, 0x000003b7, 0x00000397, + 0x000104dd, 0x000104b5, 0x00000564, 0x00000534, + 0x0000044d, 0x0000042d, 0x0000019a, 0x0000023d, + 0x00002cdf, 0x00002cde, 0x0000abbb, 0x000013eb, + 0x0000a693, 0x0000a692, 0x00001e43, 0x00001e42, + 0x00002c68, 0x00002c67, 0x000000ec, 0x000000cc, + 0x000003eb, 0x000003ea, 0x00001e07, 0x00001e06, + 0x00010cc3, 0x00010c83, 0x0000037c, 0x000003fe, + 0x00000580, 0x00000550, 0x00000188, 0x00000187, + 0x00000529, 0x00000528, 0x000000ed, 0x000000cd, + 0x0000007a, 0x0000005a, 0x00000071, 0x00000051, + 0x00001c85, 0x00000422, 0x00002c55, 0x00002c25, + 0x000118c0, 0x000118a0, 0x000003db, 0x000003da, + 0x0000a7b5, 0x0000a7b4, 0x0000ff56, 0x0000ff36, + 0x00001f73, 0x00001fc9, 0x00000463, 0x00000462, + 0x00001edd, 0x00001edc, 0x000004b5, 0x000004b4, + 0x00001ff7, 0x0300013e, 0x000001f9, 0x000001f8, + 0x000104d9, 0x000104b1, 0x00000473, 0x00000472, + 0x0000015f, 0x0000015e, 0x00001f96, 0x0200002a, + 0x00002d12, 0x000010b2, 0x00001e19, 0x00001e18, + 0x00002ce3, 0x00002ce2, 0x00001e13, 0x00001e12, + 0x0000a79b, 0x0000a79a, 0x00001ee1, 0x00001ee0, + 0x0000023f, 0x00002c7e, 0x00010445, 0x0001041d, + 0x0000a7a5, 0x0000a7a4, 0x00001f36, 0x00001f3e, + 0x000004eb, 0x000004ea, 0x000104fa, 0x000104d2, + 0x00000586, 0x00000556, 0x000000e7, 0x000000c7, + 0x0000020f, 0x0000020e, 0x000001e7, 0x000001e6, + 0x000003f8, 0x000003f7, 0x0000fb04, 0x03000061, + 0x0001e930, 0x0001e90e, 0x000000ff, 0x00000178, + 0x00001ecd, 0x00001ecc, 0x00000459, 0x00000409, + 0x00001ef1, 0x00001ef0, 0x0001042b, 0x00010403, + 0x00001eb1, 0x00001eb0, 0x00000445, 0x00000425, + 0x00001f8b, 0x020000dc, 0x0000045b, 0x0000040b, + 0x00000129, 0x00000128, 0x000001fb, 0x000001fa, + 0x00002c93, 0x00002c92, 0x000003e1, 0x000003e0, + 0x00002ca5, 0x00002ca4, 0x000118cb, 0x000118ab, + 0x00002c34, 0x00002c04, 0x0000ab9d, 0x000013cd, + 0x0000a755, 0x0000a754, 0x00001f01, 0x00001f09, + 0x0000a767, 0x0000a766, 0x00001f05, 0x00001f0d, + 0x000004ad, 0x000004ac, 0x000003c8, 0x000003a8, + 0x00010cc8, 0x00010c88, 0x000001b6, 0x000001b5, + 0x00001c80, 0x00000412, 0x00000148, 0x00000147, + 0x000004f1, 0x000004f0, 0x00002d0b, 0x000010ab, + 0x00000440, 0x00000420, 0x00002d19, 0x000010b9, + 0x00001e55, 0x00001e54, 0x000001f0, 0x02000088, + 0x00001e61, 0x00001e60, 0x000003ed, 0x000003ec, + 0x00001f79, 0x00001ff9, 0x00000140, 0x0000013f, + 0x00001f8d, 0x020000e2, 0x000000df, 0x02000051, + 0x0000217c, 0x0000216c, 0x00001e7b, 0x00001e7a, + 0x00002cee, 0x00002ced, 0x0000ab72, 0x000013a2, + 0x0000021f, 0x0000021e, 0x00000076, 0x00000056, + 0x0000a727, 0x0000a726, 0x0000abac, 0x000013dc, + 0x00002d10, 0x000010b0, 0x00001eb5, 0x00001eb4, + 0x0000045d, 0x0000040d, 0x00001e98, 0x02000091, + 0x0000046f, 0x0000046e, 0x00001eeb, 0x00001eea, + 0x00000146, 0x00000145, 0x0000fb14, 0x02000071, + 0x00000438, 0x00000418, 0x00000163, 0x00000162, + 0x0000aba8, 0x000013d8, 0x00000075, 0x00000055, + 0x00010ce4, 0x00010ca4, 0x00002cbd, 0x00002cbc, + 0x000003d0, 0x00000392, 0x0000a663, 0x0000a662, + 0x00001e23, 0x00001e22, 0x0000a681, 0x0000a680, + 0x000104e4, 0x000104bc, 0x000003c9, 0x000003a9, + 0x0000a687, 0x0000a686, 0x000000fd, 0x000000dd, + 0x00001f61, 0x00001f69, 0x00001f88, 0x020000d3, + 0x0000006c, 0x0000004c, 0x0000050b, 0x0000050a, + 0x00002c89, 0x00002c88, 0x0001e938, 0x0001e916, + 0x000024d4, 0x000024ba, 0x0001e92e, 0x0001e90c, + 0x0000ff41, 0x0000ff21, 0x00001d7d, 0x00002c63, + 0x00001fc6, 0x020000ac, 0x00001efb, 0x00001efa, + 0x00002177, 0x00002167, 0x00001fb1, 0x00001fb9, + 0x0000ff47, 0x0000ff27, 0x0000006a, 0x0000004a, + 0x0000ab8b, 0x000013bb, 0x00000272, 0x0000019d, + 0x00010ce5, 0x00010ca5, 0x000024e9, 0x000024cf, + 0x0000abb6, 0x000013e6, 0x000001bd, 0x000001bc, + 0x0001043e, 0x00010416, 0x00002cb1, 0x00002cb0, + 0x0000022b, 0x0000022a, 0x0000057a, 0x0000054a, + 0x000104e3, 0x000104bb, 0x0000049d, 0x0000049c, + 0x000013fd, 0x000013f5, 0x00000499, 0x00000498, + 0x000024e1, 0x000024c7, 0x0000049b, 0x0000049a, + 0x0000044b, 0x0000042b, 0x0000aba3, 0x000013d3, + 0x00002c3d, 0x00002c0d, 0x000024d9, 0x000024bf, + 0x000001a5, 0x000001a4, 0x0000014f, 0x0000014e, + 0x0000a69b, 0x0000a69a, 0x000118ce, 0x000118ae, + 0x00002c33, 0x00002c03, 0x00001f41, 0x00001f49, + 0x000003f3, 0x0000037f, 0x00001e6f, 0x00001e6e, + 0x0000a799, 0x0000a798, 0x00001f81, 0x02000003, + 0x00000209, 0x00000208, 0x000118c7, 0x000118a7, + 0x00001fb6, 0x020000a9, 0x00002c4d, 0x00002c1d, + 0x0000057d, 0x0000054d, 0x00000229, 0x00000228, + 0x00001f97, 0x0200002d, 0x000000f2, 0x000000d2, + 0x0001044d, 0x00010425, 0x0000a78c, 0x0000a78b, + 0x0000abb2, 0x000013e2, 0x0000ff5a, 0x0000ff3a, + 0x000013f9, 0x000013f1, 0x00002d14, 0x000010b4, + 0x00002c66, 0x0000023e, 0x00000581, 0x00000551, + 0x0000ab86, 0x000013b6, 0x00000495, 0x00000494, + 0x00000153, 0x00000152, 0x00000574, 0x00000544, + 0x00001f80, 0x02000000, 0x00010ce2, 0x00010ca2, + 0x00000289, 0x00000244, 0x00000456, 0x00000406, + 0x000001ad, 0x000001ac, 0x0001e925, 0x0001e903, + 0x000003af, 0x0000038a, 0x00001f31, 0x00001f39, + 0x000003c7, 0x000003a7, 0x000118c2, 0x000118a2, + 0x000004a1, 0x000004a0, 0x00001fe2, 0x030000be, + 0x000004fb, 0x000004fa, 0x000001d8, 0x000001d7, + 0x0000aba4, 0x000013d4, 0x00002c43, 0x00002c13, + 0x00001f9f, 0x02000100, 0x00002c45, 0x00002c15, + 0x00001f9c, 0x020000f7, 0x000000fb, 0x000000db, + 0x000104e6, 0x000104be, 0x00002d00, 0x000010a0, + 0x00001fcc, 0x0200011e, 0x000004d1, 0x000004d0, + 0x00001faf, 0x02000118, 0x0000043f, 0x0000041f, + 0x00001c84, 0x00000422, 0x0000045f, 0x0000040f, + 0x00000215, 0x00000214, 0x00001f72, 0x00001fc8, + 0x00000454, 0x00000404, 0x00000449, 0x00000429, + 0x00002c9b, 0x00002c9a, 0x00002c5e, 0x00002c2e, + 0x00000155, 0x00000154, 0x000001d4, 0x000001d3, + 0x0000a749, 0x0000a748, 0x000003d9, 0x000003d8, + 0x0000a75d, 0x0000a75c, 0x000118cf, 0x000118af, + 0x00002c3b, 0x00002c0b, 0x00001f20, 0x00001f28, + 0x0000043c, 0x0000041c, 0x00001f90, 0x02000018, + 0x0000045c, 0x0000040c, 0x00002c54, 0x00002c24, + 0x000104df, 0x000104b7, 0x00002ce1, 0x00002ce0, + 0x00001fe4, 0x020000c6, 0x00002d13, 0x000010b3, + 0x0000fb16, 0x02000077, 0x0000a791, 0x0000a790, + 0x0000ab82, 0x000013b2, 0x000003ef, 0x000003ee, + 0x00001e69, 0x00001e68, 0x0000017a, 0x00000179, + 0x000104e0, 0x000104b8, 0x00000447, 0x00000427, + 0x00001f95, 0x02000027, 0x000004c2, 0x000004c1, + 0x00002c4b, 0x00002c1b, 0x00000505, 0x00000504, + 0x00010cd1, 0x00010c91, 0x0000ab8a, 0x000013ba, + 0x00010ce9, 0x00010ca9, 0x00010439, 0x00010411, + 0x00000233, 0x00000232, 0x00001eb9, 0x00001eb8, + 0x000003c2, 0x000003a3, 0x00010ccc, 0x00010c8c, + 0x00000465, 0x00000464, 0x00001f76, 0x00001fda, + 0x0000ab8c, 0x000013bc, 0x00001fd3, 0x030000b3, + 0x00000481, 0x00000480, 0x00002d06, 0x000010a6, + 0x0001e923, 0x0001e901, 0x00002cc3, 0x00002cc2, + 0x000000f4, 0x000000d4, 0x00002ccb, 0x00002cca, + 0x0000abab, 0x000013db, 0x00000253, 0x00000181, + 0x00001e2b, 0x00001e2a, 0x0000ff4b, 0x0000ff2b, + 0x00001fe1, 0x00001fe9, 0x0000ff4f, 0x0000ff2f, + 0x00001e2d, 0x00001e2c, 0x0000ab90, 0x000013c0, + 0x00001f57, 0x00001f5f, 0x00002175, 0x00002165, + 0x000000b5, 0x0000039c, 0x000001cb, 0x000001ca, + 0x0000044a, 0x0000042a, 0x0001e939, 0x0001e917, + 0x00002c31, 0x00002c01, 0x00001fd0, 0x00001fd8, + 0x000000eb, 0x000000cb, 0x00001e59, 0x00001e58, + 0x0000214e, 0x00002132, 0x000104f0, 0x000104c8, + 0x0000a74b, 0x0000a74a, 0x00001e67, 0x00001e66, + 0x0000aba0, 0x000013d0, 0x00001faa, 0x02000109, + 0x00000479, 0x00000478, 0x000001a8, 0x000001a7, + 0x00000565, 0x00000535, 0x000118c1, 0x000118a1, + 0x00000434, 0x00000414, 0x0000016b, 0x0000016a, + 0x0000ab8f, 0x000013bf, 0x00002c3c, 0x00002c0c, + 0x00000265, 0x0000a78d, 0x0000a75f, 0x0000a75e, + 0x00001ef7, 0x00001ef6, 0x00000251, 0x00002c6d, + 0x000118d7, 0x000118b7, 0x000003bf, 0x0000039f, + 0x00001ef3, 0x00001ef2, 0x000003ca, 0x000003aa, + 0x00000185, 0x00000184, 0x00000578, 0x00000548, + 0x00002cec, 0x00002ceb, 0x000003cc, 0x0000038c, + 0x000001a3, 0x000001a2, 0x0001e93b, 0x0001e919, + 0x00002d0d, 0x000010ad, 0x000118d2, 0x000118b2, + 0x00002d1f, 0x000010bf, 0x0001e936, 0x0001e914, + 0x00002c30, 0x00002c00, 0x00001fbc, 0x0200011b, + 0x000003fb, 0x000003fa, 0x00001e4b, 0x00001e4a, + 0x0000044c, 0x0000042c, 0x0000ab98, 0x000013c8, + 0x00000527, 0x00000526, 0x000000ef, 0x000000cf, + 0x0000217e, 0x0000216e, 0x00002c46, 0x00002c16, + 0x00001fa3, 0x02000039, 0x0000013a, 0x00000139, + 0x00001f94, 0x02000024, 0x00000127, 0x00000126, + 0x00001ea7, 0x00001ea6, 0x00002184, 0x00002183, + 0x00001fb2, 0x02000124, 0x00002c36, 0x00002c06, + 0x00001edb, 0x00001eda, 0x00000373, 0x00000372, + 0x000004c4, 0x000004c3, 0x000004a7, 0x000004a6, + 0x00002173, 0x00002163, 0x00000159, 0x00000158, + 0x00000165, 0x00000164, 0x0000abb7, 0x000013e7, + 0x00002c81, 0x00002c80, 0x00000064, 0x00000044, + 0x00002ca1, 0x00002ca0, 0x0000022f, 0x0000022e, + 0x0000ff54, 0x0000ff34, 0x00001e73, 0x00001e72, + 0x000003bd, 0x0000039d, 0x000104f7, 0x000104cf, + 0x000004d7, 0x000004d6, 0x0000fb17, 0x0200007a, + 0x000004e9, 0x000004e8, 0x00002171, 0x00002161, + 0x00000115, 0x00000114, 0x00000457, 0x00000407, + 0x0000006e, 0x0000004e, 0x00002d2d, 0x000010cd, + 0x00001f44, 0x00001f4c, 0x00002ca9, 0x00002ca8, + 0x00001e5b, 0x00001e5a, 0x000003c1, 0x000003a1, + 0x000104ee, 0x000104c6, 0x0000a733, 0x0000a732, + 0x00001f32, 0x00001f3a, 0x000024d3, 0x000024b9, + 0x00001fb7, 0x03000136, 0x00010cdb, 0x00010c9b, + 0x000001ff, 0x000001fe, 0x00010ce3, 0x00010ca3, + 0x00000063, 0x00000043, 0x00000105, 0x00000104, + 0x0000a743, 0x0000a742, 0x00010cda, 0x00010c9a, + 0x00002ca3, 0x00002ca2, 0x00000151, 0x00000150, + 0x00001f65, 0x00001f6d, 0x0000ab99, 0x000013c9, + 0x0000a751, 0x0000a750, 0x00001f07, 0x00001f0f, + 0x0000a765, 0x0000a764, 0x0000029e, 0x0000a7b0, + 0x0001042e, 0x00010406, 0x0000a653, 0x0000a652, + 0x000003b4, 0x00000394, 0x000000ee, 0x000000ce, + 0x00001f8a, 0x020000d9, 0x0000217d, 0x0000216d, + 0x00010cd0, 0x00010c90, 0x000000f1, 0x000000d1, + 0x00001e29, 0x00001e28, 0x000000f3, 0x000000d3, + 0x000118d0, 0x000118b0, 0x000003d7, 0x000003cf, + 0x00001e5f, 0x00001e5e, 0x000003e5, 0x000003e4, + 0x00001fd2, 0x030000af, 0x0000ab78, 0x000013a8, + 0x00001f9b, 0x020000f4, 0x00010cd3, 0x00010c93, + 0x00001f06, 0x00001f0e, 0x00010ce7, 0x00010ca7, + 0x00002c53, 0x00002c23, 0x0001e924, 0x0001e902, + 0x00000133, 0x00000132, 0x0001e926, 0x0001e904, + 0x0000a741, 0x0000a740, 0x000001c9, 0x000001c7, + 0x00000247, 0x00000246, 0x00001ed1, 0x00001ed0, + 0x0000024b, 0x0000024a, 0x0000aba5, 0x000013d5, + 0x0000046d, 0x0000046c, 0x00001ee5, 0x00001ee4, + 0x0000047f, 0x0000047e, 0x0001044f, 0x00010427, + 0x0000ab81, 0x000013b1, 0x0000ab96, 0x000013c6, + 0x000004fd, 0x000004fc, 0x00002cdb, 0x00002cda, + 0x0001e92b, 0x0001e909, 0x00002cd3, 0x00002cd2, + 0x00001e0f, 0x00001e0e, 0x0000a66b, 0x0000a66a, + 0x00001e21, 0x00001e20, 0x00000292, 0x000001b7, + 0x00001fac, 0x0200010f, 0x000003cb, 0x000003ab, + 0x0000ab85, 0x000013b5, 0x000024d7, 0x000024bd, + 0x00001fd6, 0x020000b7, 0x0001043d, 0x00010415, + 0x0000fb06, 0x02000068, 0x0000052d, 0x0000052c, + 0x000000e9, 0x000000c9, 0x00001f00, 0x00001f08, + 0x0000a77c, 0x0000a77b, 0x0001e932, 0x0001e910, + 0x000013fb, 0x000013f3, 0x00001e87, 0x00001e86, + 0x000003be, 0x0000039e, 0x00001e95, 0x00001e94, + 0x000024d5, 0x000024bb, 0x0000ab91, 0x000013c1, + 0x00000441, 0x00000421, 0x00001f8c, 0x020000df, + 0x0000051b, 0x0000051a, 0x00001fb0, 0x00001fb8, + 0x00000477, 0x00000476, 0x000001d0, 0x000001cf, + 0x0000056f, 0x0000053f, 0x00002c9f, 0x00002c9e, + 0x000118dd, 0x000118bd, 0x00002d18, 0x000010b8, + 0x00010428, 0x00010400, 0x0000a647, 0x0000a646, + 0x00001eff, 0x00001efe, 0x0000a759, 0x0000a758, + 0x000118d9, 0x000118b9, 0x0000ff49, 0x0000ff29, + 0x00001e77, 0x00001e76, 0x000004a5, 0x000004a4, + 0x0000217b, 0x0000216b, 0x000004d9, 0x000004d8, + 0x0000a76f, 0x0000a76e, 0x00000562, 0x00000532, + 0x00002d01, 0x000010a1, 0x00000275, 0x0000019f, + 0x00002d15, 0x000010b5, 0x00001e4f, 0x00001e4e, + 0x00000430, 0x00000410, 0x00001f84, 0x0200000c, + 0x00002c5a, 0x00002c2a, 0x00001f45, 0x00001f4d, + 0x00000250, 0x00002c6f, 0x0000fb02, 0x0200005a, + 0x0000043e, 0x0000041e, 0x00010443, 0x0001041b, + 0x000001fd, 0x000001fc, 0x00002c73, 0x00002c72, + 0x0001044a, 0x00010422, 0x00002d05, 0x000010a5, + 0x0001e931, 0x0001e90f, 0x0000a68d, 0x0000a68c, + 0x00001f10, 0x00001f18, 0x00002c85, 0x00002c84, + 0x00010447, 0x0001041f, 0x0000a739, 0x0000a738, + 0x00001fc3, 0x0200004b, 0x00000461, 0x00000460, + 0x00001ee3, 0x00001ee2, 0x0000047d, 0x0000047c, + 0x000104d8, 0x000104b0, 0x00000567, 0x00000537, + 0x0000006b, 0x0000004b, 0x00010cdd, 0x00010c9d, + 0x00002cc5, 0x00002cc4, 0x0000ab83, 0x000013b3, + 0x00000287, 0x0000a7b1, 0x00001f70, 0x00001fba, + 0x00000149, 0x0200007d, 0x00001e9a, 0x02000097, + 0x0000a787, 0x0000a786, 0x00001f37, 0x00001f3f, + 0x0000ff51, 0x0000ff31, 0x00001e75, 0x00001e74, + 0x000004df, 0x000004de, 0x00000205, 0x00000204, + 0x00000183, 0x00000182, 0x0000fb03, 0x0300005d, + 0x0000011b, 0x0000011a, 0x0000ab76, 0x000013a6, + 0x0001e92d, 0x0001e90b, 0x000001e1, 0x000001e0, + 0x000118db, 0x000118bb, 0x00002d21, 0x000010c1, + 0x00001d79, 0x0000a77d, 0x0000ab97, 0x000013c7, + 0x0000018c, 0x0000018b, 0x00000444, 0x00000424, + 0x00001ead, 0x00001eac, 0x00000252, 0x00002c70, + 0x0000ff58, 0x0000ff38, 0x0000ff42, 0x0000ff22, + 0x00001fd1, 0x00001fd9, 0x0000abbe, 0x000013ee, + 0x0000012f, 0x0000012e, 0x000118df, 0x000118bf, + 0x0000a77a, 0x0000a779, 0x00010cca, 0x00010c8a, + 0x000001da, 0x000001d9, 0x00001ff2, 0x02000130, + 0x0000a641, 0x0000a640, 0x00001ed3, 0x00001ed2, + 0x00001f9e, 0x020000fd, 0x00001e11, 0x00001e10, + 0x0000a76d, 0x0000a76c, 0x00000207, 0x00000206, + 0x00000582, 0x00000552, 0x00000175, 0x00000174, + 0x00010441, 0x00010419, 0x00002c44, 0x00002c14, + 0x000118de, 0x000118be, 0x000001a1, 0x000001a0, + 0x00010cea, 0x00010caa, 0x0000a691, 0x0000a690, + 0x000118c4, 0x000118a4, 0x000003d5, 0x000003a6, + 0x0001042d, 0x00010405, 0x000003e9, 0x000003e8, + 0x00001fa1, 0x02000033, 0x00000211, 0x00000210, + 0x0000ab7b, 0x000013ab, 0x0000050f, 0x0000050e, + 0x00001e79, 0x00001e78, 0x000004cf, 0x000004c0, + 0x0000fb00, 0x02000054, 0x00000525, 0x00000524, + 0x00001f50, 0x0200009a, 0x00001c87, 0x00000462, + 0x0000021d, 0x0000021c, 0x0000020b, 0x0000020a, + 0x00000377, 0x00000376, 0x0000ab53, 0x0000a7b3, + 0x00000268, 0x00000197, 0x0000017e, 0x0000017d, + 0x0000a72f, 0x0000a72e, 0x00001c86, 0x0000042a, + 0x00000475, 0x00000474, 0x000104e9, 0x000104c1, + 0x000001f2, 0x000001f1, 0x00002cb3, 0x00002cb2, + 0x00000263, 0x00000194, 0x0000016d, 0x0000016c, + 0x0000ab95, 0x000013c5, 0x00000103, 0x00000102, + 0x00001e3b, 0x00001e3a, 0x00002cd5, 0x00002cd4, + 0x00001e17, 0x00001e16, 0x00002d07, 0x000010a7, + 0x00001f21, 0x00001f29, 0x0000ff4d, 0x0000ff2d, + 0x00001e33, 0x00001e32, 0x0000ff4c, 0x0000ff2c, + 0x00001f55, 0x00001f5d, 0x0000023c, 0x0000023b, + 0x000004ce, 0x000004cd, 0x0000043b, 0x0000041b, + 0x00002c5d, 0x00002c2d, 0x0000057b, 0x0000054b, + 0x000001df, 0x000001de, 0x000104db, 0x000104b3, + 0x000003ba, 0x0000039a, 0x0001e93a, 0x0001e918, + 0x00002d1b, 0x000010bb, 0x00001e8f, 0x00001e8e, + 0x000024d1, 0x000024b7, 0x00001f9a, 0x020000f1, + 0x00000437, 0x00000417, 0x00001eb7, 0x00001eb6, + 0x000024dd, 0x000024c3, 0x0000013c, 0x0000013b, + 0x00000563, 0x00000533, 0x00000077, 0x00000057, + 0x00001fbe, 0x00000399, 0x00002c91, 0x00002c90, + 0x000118d1, 0x000118b1, 0x00000257, 0x0000018a, + 0x0001043c, 0x00010414, 0x0000a659, 0x0000a658, + 0x0001e922, 0x0001e900, 0x000024de, 0x000024c4, + 0x0000ab7d, 0x000013ad, 0x00010cc1, 0x00010c81, + 0x0000abb8, 0x000013e8, 0x000003df, 0x000003de, + 0x000024dc, 0x000024c2, 0x000004bd, 0x000004bc, + 0x0000ab75, 0x000013a5, 0x00000070, 0x00000050, + 0x00000507, 0x00000506, 0x00001f7a, 0x00001fea, + 0x00002d09, 0x000010a9, 0x00001e3f, 0x00001e3e, + 0x00002d1d, 0x000010bd, 0x00001e65, 0x00001e64, + 0x0000a651, 0x0000a650, 0x00001f40, 0x00001f48, + 0x0000057c, 0x0000054c, 0x00001e71, 0x00001e70, + 0x000024e6, 0x000024cc, 0x00001f77, 0x00001fdb, + 0x00010432, 0x0001040a, 0x000118d6, 0x000118b6, + 0x00010cd6, 0x00010c96, 0x0000ab94, 0x000013c4, + 0x00001c81, 0x00000414, 0x000003bc, 0x0000039c, + 0x0001e940, 0x0001e91e, 0x00000390, 0x03000080, + 0x00001f04, 0x00001f0c, 0x00010ccb, 0x00010c8b, + 0x0001e93e, 0x0001e91c, 0x00000131, 0x00000049, + 0x00001ed9, 0x00001ed8, 0x0000028b, 0x000001b2, + 0x000004c8, 0x000004c7, 0x0000ab7c, 0x000013ac, + 0x0000006f, 0x0000004f, 0x000024da, 0x000024c0, + 0x00002d03, 0x000010a3, 0x00001c88, 0x0000a64a, + 0x00002ccd, 0x00002ccc, 0x0001e933, 0x0001e911, + 0x00002c48, 0x00002c18, 0x000004cc, 0x000004cb, + 0x00002c40, 0x00002c10, 0x0000ab70, 0x000013a0, + 0x000003bb, 0x0000039b, 0x0001042f, 0x00010407, + 0x0000ff59, 0x0000ff39, 0x00001f51, 0x00001f59, + 0x000004e7, 0x000004e6, 0x0000fb13, 0x0200006e, + 0x000004f9, 0x000004f8, 0x000104da, 0x000104b2, + 0x000003d1, 0x00000398, 0x00002c4c, 0x00002c1c, + 0x00001eef, 0x00001eee, 0x000001ef, 0x000001ee, + 0x00001fe0, 0x00001fe8, 0x000000f9, 0x000000d9, + 0x00001e89, 0x00001e88, 0x0000a68b, 0x0000a68a, + 0x00001e9b, 0x00001e60, 0x0000057e, 0x0000054e, + 0x00001f67, 0x00001f6f, 0x0000044f, 0x0000042f, + 0x00001e7f, 0x00001e7e, 0x00000451, 0x00000401, + 0x00010cec, 0x00010cac, 0x00000177, 0x00000176, + 0x00002d0c, 0x000010ac, 0x000003ae, 0x00000389, + 0x0000010d, 0x0000010c, 0x000000e0, 0x000000c0, + 0x00010430, 0x00010408, 0x00001f56, 0x030000a5, + 0x0000037d, 0x000003ff, 0x000013f8, 0x000013f0, + 0x00000497, 0x00000496, 0x0001043f, 0x00010417, + 0x00000137, 0x00000136, 0x00010cef, 0x00010caf, + 0x000004bb, 0x000004ba, 0x00000062, 0x00000042, + 0x00010cc4, 0x00010c84, 0x00002cd1, 0x00002cd0, + 0x00001f54, 0x030000a1, 0x0000a68f, 0x0000a68e, + 0x000013fa, 0x000013f2, 0x00002d11, 0x000010b1, + 0x000118cc, 0x000118ac, 0x0000a74f, 0x0000a74e, + 0x00001e1d, 0x00001e1c, 0x00000072, 0x00000052, + 0x0001e93d, 0x0001e91b, 0x0000051f, 0x0000051e, + 0x000001bf, 0x000001f7, 0x00000517, 0x00000516, + 0x00010433, 0x0001040b, 0x000024e8, 0x000024ce, + 0x0000010b, 0x0000010a, 0x000000ea, 0x000000ca, + 0x00000213, 0x00000212, 0x00000501, 0x00000500, + 0x00000217, 0x00000216, 0x00002d04, 0x000010a4, + 0x00002d1a, 0x000010ba, 0x00001ec9, 0x00001ec8, + 0x00000249, 0x00000248, 0x00001eb3, 0x00001eb2, + 0x0000047b, 0x0000047a, 0x00001ec7, 0x00001ec6, + 0x00000587, 0x0200006b, 0x0001044c, 0x00010424, + 0x0000011d, 0x0000011c, 0x0000217a, 0x0000216a, + 0x00001f66, 0x00001f6e, 0x00002cc1, 0x00002cc0, + 0x0000abb9, 0x000013e9, 0x0000a65f, 0x0000a65e, + 0x00001fe7, 0x030000cc, 0x0000a66d, 0x0000a66c, + 0x00001e1f, 0x00001e1e, 0x0000a699, 0x0000a698, + 0x00001e31, 0x00001e30, 0x000003c5, 0x000003a5, + 0x000024e4, 0x000024ca, 0x000004e3, 0x000004e2, + 0x000104e1, 0x000104b9, 0x000004f7, 0x000004f6, + 0x0000fb01, 0x02000057, 0x00000521, 0x00000520, + 0x0000ab7a, 0x000013aa, 0x00000509, 0x00000508, + 0x0000a737, 0x0000a736, 0x0001e92a, 0x0001e908, + 0x000003b8, 0x00000398, 0x000003dd, 0x000003dc, + 0x0000a657, 0x0000a656, 0x00001f87, 0x02000015, + 0x00002cb5, 0x00002cb4, 0x00001fad, 0x02000112, + 0x000000f5, 0x000000d5, 0x00000069, 0x00000049, + 0x00001f64, 0x00001f6c, 0x00002c8d, 0x00002c8c, + 0x00000432, 0x00000412, 0x0000015d, 0x0000015c, + 0x00000575, 0x00000545, 0x00002c99, 0x00002c98, + 0x0000056c, 0x0000053c, 0x00002c38, 0x00002c08, + 0x000013fc, 0x000013f4, 0x00000231, 0x00000230, + 0x000118c6, 0x000118a6, 0x00000260, 0x00000193, + 0x00001f34, 0x00001f3c, 0x000003cd, 0x0000038e, + 0x00000458, 0x00000408, 0x000004ab, 0x000004aa, + 0x000003f0, 0x0000039a, 0x0000013e, 0x0000013d, + 0x000104f3, 0x000104cb, 0x00000584, 0x00000554, + 0x00002d27, 0x000010c7, 0x0000abb4, 0x000013e4, + 0x000001b9, 0x000001b8, 0x00001e57, 0x00001e56, + 0x0000ff50, 0x0000ff30, 0x0000abae, 0x000013de, + 0x000003c4, 0x000003a4, 0x00001e6b, 0x00001e6a, + 0x0000ff43, 0x0000ff23, 0x00001f9d, 0x020000fa, + 0x00000199, 0x00000198, 0x00001f14, 0x00001f1c, + 0x000001eb, 0x000001ea, 0x00002c49, 0x00002c19, + 0x00010cd7, 0x00010c97, 0x00001f24, 0x00001f2c, + 0x00000568, 0x00000538, 0x0000021b, 0x0000021a, + 0x0000ab9f, 0x000013cf, 0x0000025c, 0x0000a7ab, + 0x00001ebf, 0x00001ebe, 0x0000a77f, 0x0000a77e, + 0x0000010f, 0x0000010e, 0x0000a723, 0x0000a722, + 0x00001f27, 0x00001f2f, 0x00000345, 0x00000399, + 0x00002cf3, 0x00002cf2, 0x00010cd8, 0x00010c98, + 0x0000027d, 0x00002c64, 0x00000455, 0x00000405, + 0x00002cd9, 0x00002cd8, 0x00010cde, 0x00010c9e, + 0x000001d6, 0x000001d5, 0x00001efd, 0x00001efc, + 0x0000ff44, 0x0000ff24, 0x00001e1b, 0x00001e1a, + 0x000003f1, 0x000003a1, 0x00001e2f, 0x00001e2e, + 0x000003c3, 0x000003a3, 0x000118d4, 0x000118b4, + 0x0000a7a9, 0x0000a7a8, 0x000118cd, 0x000118ad, + 0x000004ef, 0x000004ee, 0x000118c3, 0x000118a3, + 0x00000523, 0x00000522, 0x00000572, 0x00000542, + 0x0000017c, 0x0000017b, 0x000001e3, 0x000001e2, + 0x00000180, 0x00000243, 0x0000045a, 0x0000040a, + 0x00001e7d, 0x00001e7c, 0x000001f3, 0x000001f1, + 0x00001e91, 0x00001e90, 0x00000240, 0x00002c7f, + 0x00001f99, 0x020000ee, 0x00001f86, 0x02000012 +}; + +static const unsigned _uccase_lower_g_size = 226; +static const short _uccase_lower_g[] = { + 174, 834, 830, 1261, 252, 997, 556, 843, + 6, 2109, 145, 1305, 273, 4287, 671, 70, + 526, 9368, 50, -207, 128, 7, 4804, 632, + 1, -720, 6, 1678, 16681, -937, 7, 4106, + 4, 703, 233, 4578, 424, 1988, 7, 1733, + 33, 438, 4640, 3438, 339, 1230, 6, 700, + 198, 5215, 378, 745, 2, 1705, 141, 11971, + 559, 1365, 19, 736, 152, 715, 64, 268, + 575, 34, 11061, 628, 1, -565, 50, 73, + 20631, 289, 2, 817, 382, 6033, 658, 2119, + 33, 397, 144, 32767, 389, 491, 2616, 1837, + 191, 666, 2, 384, 1, 2083, 416, 562, + 5, 3012, 406, 7369, 268, 6961, 100, 799, + 537, 233, 55, 1085, 563, 130, 19254, 555, + 1, -273, 37, 40, 2992, 420, 1, 2219, + 664, 4076, 676, 3672, 8, 1400, 1828, -466, + 1593, 760, 583, 78, 389, 850, 33, -8, + 53, 3681, 410, 1221, 1, 205, 45, 3222, + 7, 2248, 333, 2155, 24, 1832, 70, 522, + 618, 914, 451, 8903, 2, 1127, 447, 166, + 1974, 3319, 40, -289, 7, 862, 9799, 682, + 2, 2919, 44, -183, 296, 2003, 506, 1136, + 37, 6362, 87, -110, 186, 250, 1258, 116, + 29, -181, 3, 3900, 2633, 1724, 2, 58, + 731, 663, 1, 11545, 69, 253, 521, 913, + 14, -269, 139, 3, 5560, 13878, 1, -767, + 930, 257, 5047, 2220, 2, 1144, 2226, 1326, + 423, 4483, 608, 6795, 384, 2580, 42, -57, + 5403, 5444 }; -static const unsigned int _uccase_size = 2621; +static const unsigned _uccase_lower_table_size = 1304; +static const unsigned _uccase_lower_table[] = { + 0x00002c06, 0x00002c36, 0x000010aa, 0x00002d0a, + 0x000104b0, 0x000104d8, 0x00010411, 0x00010439, + 0x0000a766, 0x0000a767, 0x00001f59, 0x00001f51, + 0x000004f6, 0x000004f7, 0x00010402, 0x0001042a, + 0x000104c6, 0x000104ee, 0x000104b5, 0x000104dd, + 0x0001e90f, 0x0001e931, 0x00001e50, 0x00001e51, + 0x0000a666, 0x0000a667, 0x0000016a, 0x0000016b, + 0x00010c89, 0x00010cc9, 0x000001b7, 0x00000292, + 0x000024cf, 0x000024e9, 0x00001ed2, 0x00001ed3, + 0x00010c86, 0x00010cc6, 0x0000a7a8, 0x0000a7a9, + 0x000010b6, 0x00002d16, 0x0000a66c, 0x0000a66d, + 0x00001f8a, 0x00001f82, 0x000001d7, 0x000001d8, + 0x000013b2, 0x0000ab82, 0x00002c72, 0x00002c73, + 0x000013ed, 0x0000abbd, 0x00001e82, 0x00001e83, + 0x00002c22, 0x00002c52, 0x00010414, 0x0001043c, + 0x000013d3, 0x0000aba3, 0x0000053f, 0x0000056f, + 0x00000531, 0x00000561, 0x000104cc, 0x000104f4, + 0x00002c02, 0x00002c32, 0x00000134, 0x00000135, + 0x0000a79e, 0x0000a79f, 0x00000056, 0x00000076, + 0x00002c67, 0x00002c68, 0x0000216c, 0x0000217c, + 0x000104c7, 0x000104ef, 0x0000054b, 0x0000057b, + 0x00001e30, 0x00001e31, 0x0000018e, 0x000001dd, + 0x00000541, 0x00000571, 0x00002cd6, 0x00002cd7, + 0x000118b4, 0x000118d4, 0x000013c5, 0x0000ab95, + 0x00001faa, 0x00001fa2, 0x0000054a, 0x0000057a, + 0x00001eb2, 0x00001eb3, 0x000004a8, 0x000004a9, + 0x00000120, 0x00000121, 0x000003e4, 0x000003e5, + 0x00000048, 0x00000068, 0x000024ca, 0x000024e4, + 0x00002166, 0x00002176, 0x000104ca, 0x000104f2, + 0x00001ee6, 0x00001ee7, 0x00000468, 0x00000469, + 0x00002c1a, 0x00002c4a, 0x00001e8a, 0x00001e8b, + 0x0000ff34, 0x0000ff54, 0x000013d0, 0x0000aba0, + 0x00002c00, 0x00002c30, 0x00001fbc, 0x00001fb3, + 0x000010a0, 0x00002d00, 0x000003fe, 0x0000037c, + 0x000004b6, 0x000004b7, 0x000000d1, 0x000000f1, + 0x00010420, 0x00010448, 0x00001feb, 0x00001f7b, + 0x000024b9, 0x000024d3, 0x0000047e, 0x0000047f, + 0x000000ca, 0x000000ea, 0x0000013f, 0x00000140, + 0x000013c6, 0x0000ab96, 0x0000052e, 0x0000052f, + 0x00000196, 0x00000269, 0x0000ff2c, 0x0000ff4c, + 0x000000d2, 0x000000f2, 0x0000041f, 0x0000043f, + 0x000003e0, 0x000003e1, 0x000024c0, 0x000024da, + 0x0000041e, 0x0000043e, 0x0001041f, 0x00010447, + 0x00000419, 0x00000439, 0x00002cc2, 0x00002cc3, + 0x00000540, 0x00000570, 0x000003ab, 0x000003cb, + 0x00010ca9, 0x00010ce9, 0x00001f9b, 0x00001f93, + 0x00000472, 0x00000473, 0x00000244, 0x00000289, + 0x0000a664, 0x0000a665, 0x000003aa, 0x000003ca, + 0x00000403, 0x00000453, 0x000010a5, 0x00002d05, + 0x000013a7, 0x0000ab77, 0x00001ed6, 0x00001ed7, + 0x000118bd, 0x000118dd, 0x0000042d, 0x0000044d, + 0x000013a4, 0x0000ab74, 0x000003dc, 0x000003dd, + 0x0000a7b1, 0x00000287, 0x0000054f, 0x0000057f, + 0x00000154, 0x00000155, 0x00000406, 0x00000456, + 0x00002c21, 0x00002c51, 0x00001e7e, 0x00001e7f, + 0x000104c8, 0x000104f0, 0x000010b4, 0x00002d14, + 0x000003a0, 0x000003c0, 0x000013bc, 0x0000ab8c, + 0x0000216b, 0x0000217b, 0x000118a4, 0x000118c4, + 0x000001cd, 0x000001ce, 0x00001e2a, 0x00001e2b, + 0x0000216d, 0x0000217d, 0x00010403, 0x0001042b, + 0x00000512, 0x00000513, 0x000013ea, 0x0000abba, + 0x0000051c, 0x0000051d, 0x00001e56, 0x00001e57, + 0x0000a748, 0x0000a749, 0x0000a746, 0x0000a747, + 0x0000050c, 0x0000050d, 0x00001e66, 0x00001e67, + 0x00002161, 0x00002171, 0x00000182, 0x00000183, + 0x00002c11, 0x00002c41, 0x0000a648, 0x0000a649, + 0x00001e7c, 0x00001e7d, 0x000004aa, 0x000004ab, + 0x000004ac, 0x000004ad, 0x000118aa, 0x000118ca, + 0x0000005a, 0x0000007a, 0x00001e14, 0x00001e15, + 0x0000ff24, 0x0000ff44, 0x000013a1, 0x0000ab71, + 0x00001e20, 0x00001e21, 0x00002c14, 0x00002c44, + 0x000003a9, 0x000003c9, 0x00000554, 0x00000584, + 0x00000520, 0x00000521, 0x000118b3, 0x000118d3, + 0x000003f4, 0x000003b8, 0x00001f9a, 0x00001f92, + 0x000104c0, 0x000104e8, 0x00001e68, 0x00001e69, + 0x0000212a, 0x0000006b, 0x00001e84, 0x00001e85, + 0x000010b0, 0x00002d10, 0x0000023e, 0x00002c66, + 0x00002ca0, 0x00002ca1, 0x00000474, 0x00000475, + 0x000118ad, 0x000118cd, 0x00000396, 0x000003b6, + 0x00010c94, 0x00010cd4, 0x00001fea, 0x00001f7a, + 0x00001eaa, 0x00001eab, 0x00002ced, 0x00002cee, + 0x000118a5, 0x000118c5, 0x0000039b, 0x000003bb, + 0x00002c86, 0x00002c87, 0x000024ce, 0x000024e8, + 0x00001e64, 0x00001e65, 0x0001041b, 0x00010443, + 0x00001e48, 0x00001e49, 0x0000a640, 0x0000a641, + 0x00001fa8, 0x00001fa0, 0x000013a0, 0x0000ab70, + 0x000001e6, 0x000001e7, 0x00010c91, 0x00010cd1, + 0x00000388, 0x000003ad, 0x00002c6f, 0x00000250, + 0x00000502, 0x00000503, 0x00001e10, 0x00001e11, + 0x0000040a, 0x0000045a, 0x000000d4, 0x000000f4, + 0x0000039e, 0x000003be, 0x000104be, 0x000104e6, + 0x0000a690, 0x0000a691, 0x00000041, 0x00000061, + 0x00010409, 0x00010431, 0x00000055, 0x00000075, + 0x000013e0, 0x0000abb0, 0x0000038f, 0x000003ce, + 0x00010404, 0x0001042c, 0x00010caf, 0x00010cef, + 0x000013e7, 0x0000abb7, 0x00010400, 0x00010428, + 0x00001ef0, 0x00001ef1, 0x000024bb, 0x000024d5, + 0x00010ca6, 0x00010ce6, 0x000013b5, 0x0000ab85, + 0x0000014c, 0x0000014d, 0x00000498, 0x00000499, + 0x00000547, 0x00000577, 0x000104d3, 0x000104fb, + 0x00000412, 0x00000432, 0x000118b8, 0x000118d8, + 0x0000a7b0, 0x0000029e, 0x000013ad, 0x0000ab7d, + 0x000013d9, 0x0000aba9, 0x00001e1a, 0x00001e1b, + 0x000003fd, 0x0000037b, 0x00002c07, 0x00002c37, + 0x000104d2, 0x000104fa, 0x000013d5, 0x0000aba5, + 0x0000051e, 0x0000051f, 0x00002c1c, 0x00002c4c, + 0x0000a752, 0x0000a753, 0x0000039d, 0x000003bd, + 0x000013ce, 0x0000ab9e, 0x00000198, 0x00000199, + 0x00010cae, 0x00010cee, 0x0000a7aa, 0x00000266, + 0x00010405, 0x0001042d, 0x000010a6, 0x00002d06, + 0x00001fe9, 0x00001fe1, 0x0000041d, 0x0000043d, + 0x000001ca, 0x000001cc, 0x00000424, 0x00000444, + 0x000104bd, 0x000104e5, 0x0000a72a, 0x0000a72b, + 0x00001ffb, 0x00001f7d, 0x00001e00, 0x00001e01, + 0x000004f0, 0x000004f1, 0x000013c4, 0x0000ab94, + 0x000004da, 0x000004db, 0x00001e52, 0x00001e53, + 0x0000ff38, 0x0000ff58, 0x000001a4, 0x000001a5, + 0x0000a796, 0x0000a797, 0x00000058, 0x00000078, + 0x0000a75c, 0x0000a75d, 0x0000216a, 0x0000217a, + 0x0001e90d, 0x0001e92f, 0x00001efa, 0x00001efb, + 0x00010c9b, 0x00010cdb, 0x00000053, 0x00000073, + 0x000000cd, 0x000000ed, 0x0000049a, 0x0000049b, + 0x000118b7, 0x000118d7, 0x00002c2d, 0x00002c5d, + 0x00001f9e, 0x00001f96, 0x00000043, 0x00000063, + 0x00010c9a, 0x00010cda, 0x000024bd, 0x000024d7, + 0x000001a0, 0x000001a1, 0x000003ee, 0x000003ef, + 0x00000044, 0x00000064, 0x00001f2d, 0x00001f25, + 0x000001fc, 0x000001fd, 0x0001041a, 0x00010442, + 0x0000039a, 0x000003ba, 0x0000a7ae, 0x0000026a, + 0x00000539, 0x00000569, 0x00001eae, 0x00001eaf, + 0x00002cce, 0x00002ccf, 0x00001f19, 0x00001f11, + 0x00002c12, 0x00002c42, 0x000004bc, 0x000004bd, + 0x0000017b, 0x0000017c, 0x000001e2, 0x000001e3, + 0x0000040f, 0x0000045f, 0x000003da, 0x000003db, + 0x00001f3d, 0x00001f35, 0x00002c05, 0x00002c35, + 0x0000a652, 0x0000a653, 0x0000ff3a, 0x0000ff5a, + 0x00000122, 0x00000123, 0x00002c01, 0x00002c31, + 0x000118a0, 0x000118c0, 0x000024b7, 0x000024d1, + 0x00002c2c, 0x00002c5c, 0x0000ff2e, 0x0000ff4e, + 0x000013b3, 0x0000ab83, 0x0000a786, 0x0000a787, + 0x0000a77d, 0x00001d79, 0x0000a692, 0x0000a693, + 0x00001eb8, 0x00001eb9, 0x00010427, 0x0001044f, + 0x000003a1, 0x000003c1, 0x00010cb2, 0x00010cf2, + 0x00000544, 0x00000574, 0x000010bc, 0x00002d1c, + 0x0000ff2a, 0x0000ff4a, 0x000004cd, 0x000004ce, + 0x0000010c, 0x0000010d, 0x0000024e, 0x0000024f, + 0x00000526, 0x00000527, 0x00001e8c, 0x00001e8d, + 0x00002c7f, 0x00000240, 0x000000d8, 0x000000f8, + 0x0000a764, 0x0000a765, 0x00000102, 0x00000103, + 0x000004dc, 0x000004dd, 0x00000414, 0x00000434, + 0x0000048c, 0x0000048d, 0x00002c0d, 0x00002c3d, + 0x000104b7, 0x000104df, 0x00000552, 0x00000582, + 0x0000015a, 0x0000015b, 0x00002cae, 0x00002caf, + 0x0001e90a, 0x0001e92c, 0x000003fa, 0x000003fb, + 0x000013f2, 0x000013fa, 0x0000a650, 0x0000a651, + 0x000003a4, 0x000003c4, 0x000024cd, 0x000024e7, + 0x000003a7, 0x000003c7, 0x000013a8, 0x0000ab78, + 0x000000c9, 0x000000e9, 0x00001ed8, 0x00001ed9, + 0x00010c9c, 0x00010cdc, 0x00010407, 0x0001042f, + 0x00002c80, 0x00002c81, 0x00002c64, 0x0000027d, + 0x000104b8, 0x000104e0, 0x000104cf, 0x000104f7, + 0x0000a64e, 0x0000a64f, 0x00001eb4, 0x00001eb5, + 0x0001e91c, 0x0001e93e, 0x000013ee, 0x0000abbe, + 0x000013c3, 0x0000ab93, 0x00002c24, 0x00002c54, + 0x0000a760, 0x0000a761, 0x00002c08, 0x00002c38, + 0x00001ecc, 0x00001ecd, 0x00000506, 0x00000507, + 0x000118ac, 0x000118cc, 0x0000012c, 0x0000012d, + 0x00001fc8, 0x00001f72, 0x0000a758, 0x0000a759, + 0x00001f0c, 0x00001f04, 0x0001e90b, 0x0001e92d, + 0x000001ae, 0x00000288, 0x000013bd, 0x0000ab8d, + 0x00000106, 0x00000107, 0x0000053d, 0x0000056d, + 0x00001f18, 0x00001f10, 0x000118b5, 0x000118d5, + 0x00000372, 0x00000373, 0x00000553, 0x00000583, + 0x000104c5, 0x000104ed, 0x00001e78, 0x00001e79, + 0x000010bf, 0x00002d1f, 0x00001e36, 0x00001e37, + 0x00001f8d, 0x00001f85, 0x0000004a, 0x0000006a, + 0x000004c9, 0x000004ca, 0x000001f2, 0x000001f3, + 0x000013b4, 0x0000ab84, 0x00000398, 0x000003b8, + 0x0000a7b2, 0x0000029d, 0x000004ba, 0x000004bb, + 0x00001f5d, 0x00001f55, 0x0000047c, 0x0000047d, + 0x000118a1, 0x000118c1, 0x00000393, 0x000003b3, + 0x00010c96, 0x00010cd6, 0x00010406, 0x0001042e, + 0x00001f2c, 0x00001f24, 0x00010c82, 0x00010cc2, + 0x00001e4c, 0x00001e4d, 0x00000187, 0x00000188, + 0x000000c2, 0x000000e2, 0x00000508, 0x00000509, + 0x000004e0, 0x000004e1, 0x00002c2b, 0x00002c5b, + 0x00002c15, 0x00002c45, 0x000010be, 0x00002d1e, + 0x0000053c, 0x0000056c, 0x00001eca, 0x00001ecb, + 0x0000ff32, 0x0000ff52, 0x00001faf, 0x00001fa7, + 0x00000047, 0x00000067, 0x000001a7, 0x000001a8, + 0x00010418, 0x00010440, 0x00001ebe, 0x00001ebf, + 0x000004d6, 0x000004d7, 0x0001041c, 0x00010444, + 0x000013ef, 0x0000abbf, 0x00000522, 0x00000523, + 0x000000cf, 0x000000ef, 0x00000404, 0x00000454, + 0x00000132, 0x00000133, 0x000010a3, 0x00002d03, + 0x00001fbb, 0x00001f71, 0x00000510, 0x00000511, + 0x00010425, 0x0001044d, 0x00002cb0, 0x00002cb1, + 0x000001b8, 0x000001b9, 0x0000a7b3, 0x0000ab53, + 0x00000194, 0x00000263, 0x000024b6, 0x000024d0, + 0x00001eb0, 0x00001eb1, 0x00001f6d, 0x00001f65, + 0x00002c63, 0x00001d7d, 0x000013da, 0x0000abaa, + 0x00000248, 0x00000249, 0x00000178, 0x000000ff, + 0x00010ca7, 0x00010ce7, 0x000104ba, 0x000104e2, + 0x000000db, 0x000000fb, 0x0000ff2b, 0x0000ff4b, + 0x000024c8, 0x000024e2, 0x00002c8c, 0x00002c8d, + 0x00010ca3, 0x00010ce3, 0x0000019d, 0x00000272, + 0x00000139, 0x0000013a, 0x0000a754, 0x0000a755, + 0x000010a8, 0x00002d08, 0x00000418, 0x00000438, + 0x00001f99, 0x00001f91, 0x000010af, 0x00002d0f, + 0x0001e912, 0x0001e934, 0x000000c1, 0x000000e1, + 0x0000004d, 0x0000006d, 0x00000426, 0x00000446, + 0x00001e60, 0x00001e61, 0x000010b2, 0x00002d12, + 0x0001e902, 0x0001e924, 0x000001b1, 0x0000028a, + 0x00002c88, 0x00002c89, 0x00000230, 0x00000231, + 0x0000a694, 0x0000a695, 0x000013ba, 0x0000ab8a, + 0x0000016c, 0x0000016d, 0x0000011a, 0x0000011b, + 0x00001e62, 0x00001e63, 0x00001f1b, 0x00001f13, + 0x0000a646, 0x0000a647, 0x000013dc, 0x0000abac, + 0x00000551, 0x00000581, 0x000003a6, 0x000003c6, + 0x000104b6, 0x000104de, 0x00001f4b, 0x00001f43, + 0x000104d1, 0x000104f9, 0x00002cda, 0x00002cdb, + 0x000118b9, 0x000118d9, 0x0000ff25, 0x0000ff45, + 0x000000c5, 0x000000e5, 0x00002c17, 0x00002c47, + 0x00001e18, 0x00001e19, 0x0000042f, 0x0000044f, + 0x00002cc0, 0x00002cc1, 0x000013a9, 0x0000ab79, + 0x0000004c, 0x0000006c, 0x00010c9f, 0x00010cdf, + 0x000001f7, 0x000001bf, 0x000118ae, 0x000118ce, + 0x0000012a, 0x0000012b, 0x00010c90, 0x00010cd0, + 0x0000a688, 0x0000a689, 0x000010c1, 0x00002d21, + 0x000004ee, 0x000004ef, 0x0000023a, 0x00002c65, + 0x0000ff29, 0x0000ff49, 0x0000019f, 0x00000275, + 0x00000548, 0x00000578, 0x000013b0, 0x0000ab80, + 0x00002cd8, 0x00002cd9, 0x00001e86, 0x00001e87, + 0x0000037f, 0x000003f3, 0x00001e0e, 0x00001e0f, + 0x000024c6, 0x000024e0, 0x00001ece, 0x00001ecf, + 0x00000222, 0x00000223, 0x0000038a, 0x000003af, + 0x00001f9c, 0x00001f94, 0x00000532, 0x00000562, + 0x000013aa, 0x0000ab7a, 0x0000ff30, 0x0000ff50, + 0x0000024c, 0x0000024d, 0x00002ceb, 0x00002cec, + 0x0000a750, 0x0000a751, 0x0000a732, 0x0000a733, + 0x000001f1, 0x000001f3, 0x0001040a, 0x00010432, + 0x00002c13, 0x00002c43, 0x00010c97, 0x00010cd7, + 0x0000ff39, 0x0000ff59, 0x00001e38, 0x00001e39, + 0x00002c28, 0x00002c58, 0x000004c7, 0x000004c8, + 0x000004cb, 0x000004cc, 0x000013d7, 0x0000aba7, + 0x0000048e, 0x0000048f, 0x00001ff8, 0x00001f78, + 0x0000a736, 0x0000a737, 0x00000407, 0x00000457, + 0x00001e02, 0x00001e03, 0x00010423, 0x0001044b, + 0x0000a68a, 0x0000a68b, 0x000001ac, 0x000001ad, + 0x00010410, 0x00010438, 0x00002c10, 0x00002c40, + 0x00001f08, 0x00001f00, 0x0000ff35, 0x0000ff55, + 0x00000152, 0x00000153, 0x0000a734, 0x0000a735, + 0x00000118, 0x00000119, 0x000013eb, 0x0000abbb, + 0x000013c1, 0x0000ab91, 0x0000053b, 0x0000056b, + 0x000000da, 0x000000fa, 0x0000021e, 0x0000021f, + 0x00000186, 0x00000254, 0x0000a73c, 0x0000a73d, + 0x00001ef2, 0x00001ef3, 0x00001e2e, 0x00001e2f, + 0x000001b2, 0x0000028b, 0x0000ff27, 0x0000ff47, + 0x0000a74c, 0x0000a74d, 0x00000411, 0x00000431, + 0x00002cac, 0x00002cad, 0x00001fab, 0x00001fa3, + 0x0001e91a, 0x0001e93c, 0x000000c0, 0x000000e0, + 0x00010ca4, 0x00010ce4, 0x00002183, 0x00002184, + 0x0000053e, 0x0000056e, 0x00001e70, 0x00001e71, + 0x00001f8f, 0x00001f87, 0x0000004b, 0x0000006b, + 0x000118a8, 0x000118c8, 0x00002c8e, 0x00002c8f, + 0x00001e24, 0x00001e25, 0x0000a7a0, 0x0000a7a1, + 0x000010b8, 0x00002d18, 0x000010a9, 0x00002d09, + 0x000013e8, 0x0000abb8, 0x000118b6, 0x000118d6, + 0x00000190, 0x0000025b, 0x000104bb, 0x000104e3, + 0x00001e6e, 0x00001e6f, 0x000013f3, 0x000013fb, + 0x00002c20, 0x00002c50, 0x000104b4, 0x000104dc, + 0x00000160, 0x00000161, 0x00001f9f, 0x00001f97, + 0x0000048a, 0x0000048b, 0x00001efe, 0x00001eff, + 0x00002c75, 0x00002c76, 0x000104b1, 0x000104d9, + 0x000003e8, 0x000003e9, 0x0000004e, 0x0000006e, + 0x00000224, 0x00000225, 0x000001f4, 0x000001f5, + 0x000118bb, 0x000118db, 0x00000116, 0x00000117, + 0x0000a7b4, 0x0000a7b5, 0x0000040c, 0x0000045c, + 0x000010ba, 0x00002d1a, 0x00000220, 0x0000019e, + 0x000118a9, 0x000118c9, 0x000001c5, 0x000001c6, + 0x00001fd9, 0x00001fd1, 0x000004e6, 0x000004e7, + 0x0001e910, 0x0001e932, 0x00010412, 0x0001043a, + 0x00002c98, 0x00002c99, 0x00000193, 0x00000260, + 0x000001a9, 0x00000283, 0x000013be, 0x0000ab8e, + 0x0000a779, 0x0000a77a, 0x00001f5b, 0x00001f53, + 0x0000038c, 0x000003cc, 0x00001f49, 0x00001f41, + 0x00000537, 0x00000567, 0x0001e915, 0x0001e937, + 0x0000046a, 0x0000046b, 0x000104cb, 0x000104f3, + 0x00002cba, 0x00002cbb, 0x00001f6a, 0x00001f62, + 0x000024c1, 0x000024db, 0x000004c1, 0x000004c2, + 0x00010417, 0x0001043f, 0x000013a3, 0x0000ab73, + 0x0000011e, 0x0000011f, 0x00000543, 0x00000573, + 0x00001f0e, 0x00001f06, 0x00002c94, 0x00002c95, + 0x000001db, 0x000001dc, 0x00001f69, 0x00001f61, + 0x00001f6b, 0x00001f63, 0x0000a660, 0x0000a661, + 0x00001e12, 0x00001e13, 0x00002c90, 0x00002c91, + 0x000000d5, 0x000000f5, 0x00001f0b, 0x00001f03, + 0x0000019c, 0x0000026f, 0x0000a68e, 0x0000a68f, + 0x00001eb6, 0x00001eb7, 0x000104c2, 0x000104ea, + 0x0000212b, 0x000000e5, 0x000013d8, 0x0000aba8, + 0x0000049c, 0x0000049d, 0x000013e1, 0x0000abb1, + 0x00000409, 0x00000459, 0x00002c27, 0x00002c57, + 0x000004d0, 0x000004d1, 0x0000a72e, 0x0000a72f, + 0x000024cc, 0x000024e6, 0x00010416, 0x0001043e, + 0x00002163, 0x00002173, 0x000013cb, 0x0000ab9b, + 0x0000a784, 0x0000a785, 0x0000054c, 0x0000057c, + 0x00001e32, 0x00001e33, 0x00002c23, 0x00002c53, + 0x00001fb9, 0x00001fb1, 0x00000370, 0x00000371, + 0x000013d2, 0x0000aba2, 0x000004ec, 0x000004ed, + 0x00001e90, 0x00001e91, 0x00000428, 0x00000448, + 0x00001ed4, 0x00001ed5, 0x0000a738, 0x0000a739, + 0x000013f0, 0x000013f8, 0x0000a668, 0x0000a669, + 0x00000391, 0x000003b1, 0x00001ee4, 0x00001ee5, + 0x00000184, 0x00000185, 0x00001ec8, 0x00001ec9, + 0x0000047a, 0x0000047b, 0x000104b9, 0x000104e1, + 0x000004fa, 0x000004fb, 0x00001fcc, 0x00001fc3, + 0x00000210, 0x00000211, 0x000104b3, 0x000104db, + 0x000004f2, 0x000004f3, 0x00001e6c, 0x00001e6d, + 0x00010c8b, 0x00010ccb, 0x00001e6a, 0x00001e6b, + 0x0000a728, 0x0000a729, 0x00002cdc, 0x00002cdd, + 0x00000417, 0x00000437, 0x00000166, 0x00000167, + 0x00002c2e, 0x00002c5e, 0x0001e91d, 0x0001e93f, + 0x00001e7a, 0x00001e7b, 0x00002c25, 0x00002c55, + 0x0000040b, 0x0000045b, 0x0000022e, 0x0000022f, + 0x00000189, 0x00000256, 0x00000535, 0x00000565, + 0x00002164, 0x00002174, 0x000118bf, 0x000118df, + 0x00002165, 0x00002175, 0x0000a782, 0x0000a783, + 0x0000a680, 0x0000a681, 0x000104c4, 0x000104ec, + 0x0000a662, 0x0000a663, 0x000118ab, 0x000118cb, + 0x000001de, 0x000001df, 0x000104d0, 0x000104f8, + 0x0001e909, 0x0001e92b, 0x00001f68, 0x00001f60, + 0x000004a0, 0x000004a1, 0x00001e1e, 0x00001e1f, + 0x00010c92, 0x00010cd2, 0x00000110, 0x00000111, + 0x000004f8, 0x000004f9, 0x0000ff33, 0x0000ff53, + 0x000024c9, 0x000024e3, 0x0000038e, 0x000003cd, + 0x00000464, 0x00000465, 0x00000534, 0x00000564, + 0x00001ea8, 0x00001ea9, 0x000010c7, 0x00002d27, + 0x000000d0, 0x000000f0, 0x0000a75e, 0x0000a75f, + 0x00002c03, 0x00002c33, 0x0000a696, 0x0000a697, + 0x00001ec4, 0x00001ec5, 0x000001d5, 0x000001d6, + 0x0001041e, 0x00010446, 0x00010c99, 0x00010cd9, + 0x00000500, 0x00000501, 0x00010ca5, 0x00010ce5, + 0x0000ff36, 0x0000ff56, 0x000010b7, 0x00002d17, + 0x00002ca2, 0x00002ca3, 0x00001ed0, 0x00001ed1, + 0x00001e74, 0x00001e75, 0x00001e92, 0x00001e93, + 0x00002c9a, 0x00002c9b, 0x00000128, 0x00000129, + 0x00010c95, 0x00010cd5, 0x000010ae, 0x00002d0e, + 0x0001e913, 0x0001e935, 0x00000112, 0x00000113, + 0x000118bc, 0x000118dc, 0x000003de, 0x000003df, + 0x00001e5c, 0x00001e5d, 0x00000181, 0x00000253, + 0x00000176, 0x00000177, 0x00002c16, 0x00002c46, + 0x000013d1, 0x0000aba1, 0x00002c1f, 0x00002c4f, + 0x00000200, 0x00000201, 0x00000533, 0x00000563, + 0x00001ffc, 0x00001ff3, 0x0000004f, 0x0000006f, + 0x00000218, 0x00000219, 0x000013ae, 0x0000ab7e, + 0x0000a658, 0x0000a659, 0x000010a4, 0x00002d04, + 0x0000010e, 0x0000010f, 0x0001040b, 0x00010433, + 0x000013ab, 0x0000ab7b, 0x00001f38, 0x00001f30, + 0x00000405, 0x00000455, 0x0000013b, 0x0000013c, + 0x00000429, 0x00000449, 0x00001f8c, 0x00001f84, + 0x00000191, 0x00000192, 0x00002132, 0x0000214e, + 0x0000a742, 0x0000a743, 0x00000150, 0x00000151, + 0x00002ca6, 0x00002ca7, 0x00010ca8, 0x00010ce8, + 0x000010bd, 0x00002d1d, 0x00002c19, 0x00002c49, + 0x00000124, 0x00000125, 0x00002c29, 0x00002c59, + 0x00000059, 0x00000079, 0x00002167, 0x00002177, + 0x00001ea4, 0x00001ea5, 0x0001e90c, 0x0001e92e, + 0x00001e44, 0x00001e45, 0x00001f6f, 0x00001f67, + 0x00001fd8, 0x00001fd0, 0x00000545, 0x00000575, + 0x00002cbe, 0x00002cbf, 0x00001ede, 0x00001edf, + 0x00000162, 0x00000163, 0x000013e3, 0x0000abb3, + 0x0000a644, 0x0000a645, 0x00001ec0, 0x00001ec1, + 0x0000a790, 0x0000a791, 0x00001f2f, 0x00001f27, + 0x00002cc6, 0x00002cc7, 0x000003a8, 0x000003c8, + 0x0000a74e, 0x0000a74f, 0x000001f6, 0x00000195, + 0x00002c82, 0x00002c83, 0x00000136, 0x00000137, + 0x0000a77e, 0x0000a77f, 0x0000a686, 0x0000a687, + 0x00001eac, 0x00001ead, 0x00000427, 0x00000447, + 0x000004fe, 0x000004ff, 0x00002126, 0x000003c9, + 0x00001f28, 0x00001f20, 0x00000214, 0x00000215, + 0x0000ff21, 0x0000ff41, 0x000004a6, 0x000004a7, + 0x00001e08, 0x00001e09, 0x00001e9e, 0x000000df, + 0x00000046, 0x00000066, 0x000000c7, 0x000000e7, + 0x000001e8, 0x000001e9, 0x0000018f, 0x00000259, + 0x00001f0a, 0x00001f02, 0x00000462, 0x00000463, + 0x00001ee8, 0x00001ee9, 0x00001e94, 0x00001e95, + 0x00002ccc, 0x00002ccd, 0x000000d6, 0x000000f6, + 0x00010ca2, 0x00010ce2, 0x00001ff9, 0x00001f79, + 0x000010a2, 0x00002d02, 0x000001bc, 0x000001bd, + 0x00000494, 0x00000495, 0x000118ba, 0x000118da, + 0x0000a73a, 0x0000a73b, 0x00000549, 0x00000579, + 0x00001e8e, 0x00001e8f, 0x00002c18, 0x00002c48, + 0x00000108, 0x00000109, 0x00010c8c, 0x00010ccc, + 0x00002c0b, 0x00002c3b, 0x0000a64c, 0x0000a64d, + 0x0000011c, 0x0000011d, 0x00002cb6, 0x00002cb7, + 0x00001fb8, 0x00001fb0, 0x000013ca, 0x0000ab9a, + 0x0000a78d, 0x00000265, 0x000024ba, 0x000024d4, + 0x00000410, 0x00000430, 0x00010422, 0x0001044a, + 0x00010c8a, 0x00010cca, 0x000013cc, 0x0000ab9c, + 0x0000a792, 0x0000a793, 0x0000015c, 0x0000015d, + 0x00010cab, 0x00010ceb, 0x000010bb, 0x00002d1b, + 0x00000226, 0x00000227, 0x00001f48, 0x00001f40, + 0x000013db, 0x0000abab, 0x00001ea6, 0x00001ea7, + 0x000118a2, 0x000118c2, 0x000004c5, 0x000004c6, + 0x000013b6, 0x0000ab86, 0x0000ff2d, 0x0000ff4d, + 0x00001e34, 0x00001e35, 0x0000a77b, 0x0000a77c, + 0x0001040e, 0x00010436, 0x00010c9e, 0x00010cde, + 0x000013d4, 0x0000aba4, 0x0000021a, 0x0000021b, + 0x00001ef6, 0x00001ef7, 0x0000042a, 0x0000044a, + 0x00001e5e, 0x00001e5f, 0x0001e900, 0x0001e922, + 0x00001f3e, 0x00001f36, 0x0000050e, 0x0000050f, + 0x00000170, 0x00000171, 0x000013c2, 0x0000ab92, + 0x0000014a, 0x0000014b, 0x00001e1c, 0x00001e1d, + 0x00002c9c, 0x00002c9d, 0x00001e0c, 0x00001e0d, + 0x00002160, 0x00002170, 0x00001fca, 0x00001f74, + 0x000004d8, 0x000004d9, 0x000013e4, 0x0000abb4, + 0x000104bc, 0x000104e4, 0x000001c8, 0x000001c9, + 0x000010c2, 0x00002d22, 0x000000c4, 0x000000e4, + 0x000013c7, 0x0000ab97, 0x00002cde, 0x00002cdf, + 0x0000a7ad, 0x0000026c, 0x00002c1e, 0x00002c4e, + 0x0000a654, 0x0000a655, 0x0000a642, 0x0000a643, + 0x00001e5a, 0x00001e5b, 0x00000490, 0x00000491, + 0x000001b3, 0x000001b4, 0x0000a7b6, 0x0000a7b7, + 0x00000246, 0x00000247, 0x00001e16, 0x00001e17, + 0x000001fa, 0x000001fb, 0x00000496, 0x00000497, + 0x00000399, 0x000003b9, 0x00010c87, 0x00010cc7, + 0x0000a682, 0x0000a683, 0x000010b9, 0x00002d19, + 0x00002cd0, 0x00002cd1, 0x0000051a, 0x0000051b, + 0x000003d8, 0x000003d9, 0x000001a6, 0x00000280, + 0x00010426, 0x0001044e, 0x000118a6, 0x000118c6, + 0x000004a2, 0x000004a3, 0x00000100, 0x00000101, + 0x0000a7a2, 0x0000a7a3, 0x00001f98, 0x00001f90, + 0x00000415, 0x00000435, 0x00002ca4, 0x00002ca5, + 0x000013df, 0x0000abaf, 0x00000401, 0x00000451, + 0x0000a7ab, 0x0000025c, 0x00000536, 0x00000566, + 0x0000041b, 0x0000043b, 0x00000476, 0x00000477, + 0x000118a3, 0x000118c3, 0x000001c7, 0x000001c9, + 0x0000040d, 0x0000045d, 0x0000a698, 0x0000a699, + 0x00001ec6, 0x00001ec7, 0x0001e916, 0x0001e938, + 0x000010a7, 0x00002d07, 0x00002c6d, 0x00000251, + 0x00001fe8, 0x00001fe0, 0x000010c4, 0x00002d24, + 0x00002c0e, 0x00002c3e, 0x000013ec, 0x0000abbc, + 0x00000386, 0x000003ac, 0x00000413, 0x00000433, + 0x00000528, 0x00000529, 0x000003f9, 0x000003f2, + 0x000104b2, 0x000104da, 0x00000395, 0x000003b5, + 0x00000376, 0x00000377, 0x00001efc, 0x00001efd, + 0x000024bf, 0x000024d9, 0x00000416, 0x00000436, + 0x00010415, 0x0001043d, 0x000004d4, 0x000004d5, + 0x000013e2, 0x0000abb2, 0x000004fc, 0x000004fd, + 0x000013dd, 0x0000abad, 0x00010cad, 0x00010ced, + 0x00001e06, 0x00001e07, 0x0000054e, 0x0000057e, + 0x00000204, 0x00000205, 0x000024cb, 0x000024e5, + 0x000013c0, 0x0000ab90, 0x000004e4, 0x000004e5, + 0x00001f09, 0x00001f01, 0x000013e6, 0x0000abb6, + 0x0001e91b, 0x0001e93d, 0x000010c0, 0x00002d20, + 0x00000422, 0x00000442, 0x0001040d, 0x00010435, + 0x00001eec, 0x00001eed, 0x000013f1, 0x000013f9, + 0x00002cc4, 0x00002cc5, 0x00001f2a, 0x00001f22, + 0x0000042b, 0x0000044b, 0x00001fba, 0x00001f70, + 0x000000cb, 0x000000eb, 0x00000202, 0x00000203, + 0x00002cc8, 0x00002cc9, 0x00000141, 0x00000142, + 0x00010c8d, 0x00010ccd, 0x00000208, 0x00000209, + 0x000010b1, 0x00002d11, 0x0000ff28, 0x0000ff48, + 0x00001e28, 0x00001e29, 0x0000a7a4, 0x0000a7a5, + 0x00010cac, 0x00010cec, 0x00000460, 0x00000461, + 0x000013f4, 0x000013fc, 0x0001e911, 0x0001e933, + 0x0001e920, 0x0001e942, 0x00010c8e, 0x00010cce, + 0x00000555, 0x00000585, 0x0000a724, 0x0000a725, + 0x00002ce2, 0x00002ce3, 0x00010c84, 0x00010cc4, + 0x00000164, 0x00000165, 0x0000a756, 0x0000a757, + 0x00001f5f, 0x00001f57, 0x000001cf, 0x000001d0, + 0x000004b0, 0x000004b1, 0x00001e3c, 0x00001e3d, + 0x0000a79a, 0x0000a79b, 0x00000052, 0x00000072, + 0x000004be, 0x000004bf, 0x000001f8, 0x000001f9, + 0x0000a76a, 0x0000a76b, 0x00001e3e, 0x00001e3f, + 0x00002c6e, 0x00000271, 0x0001e903, 0x0001e925, + 0x00001eda, 0x00001edb, 0x00002cf2, 0x00002cf3, + 0x0000014e, 0x0000014f, 0x0000a76e, 0x0000a76f, + 0x00001eee, 0x00001eef, 0x000004c0, 0x000004cf, + 0x000013b8, 0x0000ab88, 0x000001b5, 0x000001b6, + 0x00001e3a, 0x00001e3b, 0x00001ee2, 0x00001ee3, + 0x000013cf, 0x0000ab9f, 0x00002c8a, 0x00002c8b, + 0x000001e4, 0x000001e5, 0x00000514, 0x00000515, + 0x0000039c, 0x000003bc, 0x0000a7ac, 0x00000261, + 0x0000053a, 0x0000056a, 0x00001f1c, 0x00001f14, + 0x0000ff31, 0x0000ff51, 0x000118a7, 0x000118c7, + 0x0001e921, 0x0001e943, 0x0000013d, 0x0000013e, + 0x000024c4, 0x000024de, 0x00000130, 0x02000142, + 0x00002c1b, 0x00002c4b, 0x00001e04, 0x00001e05, + 0x0001e90e, 0x0001e930, 0x00000179, 0x0000017a, + 0x00001e46, 0x00001e47, 0x0000ff26, 0x0000ff46, + 0x00000243, 0x00000180, 0x00000389, 0x000003ae, + 0x00001e54, 0x00001e55, 0x000003cf, 0x000003d7, + 0x00001fcb, 0x00001f75, 0x00010c9d, 0x00010cdd, + 0x000000ce, 0x000000ee, 0x00002cbc, 0x00002cbd, + 0x00001eea, 0x00001eeb, 0x000024bc, 0x000024d6, + 0x00001eba, 0x00001ebb, 0x00001f89, 0x00001f81, + 0x00001f2e, 0x00001f26, 0x0000a726, 0x0000a727, + 0x000003ea, 0x000003eb, 0x00000158, 0x00000159, + 0x00000480, 0x00000481, 0x0001e918, 0x0001e93a, + 0x0000a722, 0x0000a723, 0x00001f4a, 0x00001f42, + 0x0000a65a, 0x0000a65b, 0x000000cc, 0x000000ec, + 0x000004c3, 0x000004c4, 0x00002162, 0x00002172, + 0x00002c7e, 0x0000023f, 0x000004e8, 0x000004e9, + 0x00001e0a, 0x00001e0b, 0x000010b3, 0x00002d13, + 0x000003ff, 0x0000037d, 0x000004e2, 0x000004e3, + 0x000013d6, 0x0000aba6, 0x0000a73e, 0x0000a73f, + 0x00001e76, 0x00001e77, 0x0000a66a, 0x0000a66b, + 0x0000010a, 0x0000010b, 0x0000049e, 0x0000049f, + 0x00001f3c, 0x00001f34, 0x00000546, 0x00000576, + 0x000003ec, 0x000003ed, 0x0000046c, 0x0000046d, + 0x000001d1, 0x000001d2, 0x0000ff37, 0x0000ff57, + 0x0001e901, 0x0001e923, 0x00000174, 0x00000175, + 0x00002cb2, 0x00002cb3, 0x00001f1d, 0x00001f15, + 0x00000228, 0x00000229, 0x00000206, 0x00000207, + 0x0000023b, 0x0000023c, 0x000003a5, 0x000003c5, + 0x0000042e, 0x0000044e, 0x00001fdb, 0x00001f77, + 0x00010ca0, 0x00010ce0, 0x00002ce0, 0x00002ce1, + 0x00001ec2, 0x00001ec3, 0x000003e2, 0x000003e3, + 0x00010cb1, 0x00010cf1, 0x00000542, 0x00000572, + 0x00001edc, 0x00001edd, 0x0000024a, 0x0000024b, + 0x00002c0f, 0x00002c3f, 0x00002c60, 0x00002c61, + 0x00000057, 0x00000077, 0x00002c62, 0x0000026b, + 0x00002168, 0x00002178, 0x000004d2, 0x000004d3, + 0x00001e42, 0x00001e43, 0x000013bb, 0x0000ab8b, + 0x0000a684, 0x0000a685, 0x000104cd, 0x000104f5, + 0x00000478, 0x00000479, 0x000118af, 0x000118cf, + 0x0000022c, 0x0000022d, 0x0000020a, 0x0000020b, + 0x0000020c, 0x0000020d, 0x000013a6, 0x0000ab76, + 0x000004a4, 0x000004a5, 0x00001fae, 0x00001fa6, + 0x000013bf, 0x0000ab8f, 0x00000421, 0x00000441, + 0x0000050a, 0x0000050b, 0x000001ea, 0x000001eb, + 0x00010419, 0x00010441, 0x00000392, 0x000003b2, + 0x0001e908, 0x0001e92a, 0x00000538, 0x00000568, + 0x00010c85, 0x00010cc5, 0x00001ee0, 0x00001ee1, + 0x000000dc, 0x000000fc, 0x00000212, 0x00000213, + 0x00000051, 0x00000071, 0x0000a69a, 0x0000a69b, + 0x00000126, 0x00000127, 0x000004b8, 0x000004b9, + 0x0000216f, 0x0000217f, 0x0000a75a, 0x0000a75b, + 0x00001fec, 0x00001fe5, 0x000024c7, 0x000024e1, + 0x00002caa, 0x00002cab, 0x00001f29, 0x00001f21, + 0x0000a65e, 0x0000a65f, 0x00001e58, 0x00001e59, + 0x00000524, 0x00000525, 0x000003f7, 0x000003f8, + 0x00000423, 0x00000443, 0x00001fad, 0x00001fa5, + 0x00010424, 0x0001044c, 0x00000147, 0x00000148, + 0x0000a68c, 0x0000a68d, 0x00001ebc, 0x00001ebd, + 0x00001f3b, 0x00001f33, 0x000013b1, 0x0000ab81, + 0x00001ea2, 0x00001ea3, 0x00000470, 0x00000471, + 0x000013c9, 0x0000ab99, 0x00010c8f, 0x00010ccf, + 0x0001e904, 0x0001e926, 0x000010ac, 0x00002d0c, + 0x000010c5, 0x00002d25, 0x000013f5, 0x000013fd, + 0x0001e907, 0x0001e929, 0x00000049, 0x00000069, + 0x00000104, 0x00000105, 0x0000a744, 0x0000a745, + 0x00002c84, 0x00002c85, 0x000118be, 0x000118de, + 0x0000040e, 0x0000045e, 0x0001040f, 0x00010437, + 0x00002c0c, 0x00002c3c, 0x0000023d, 0x0000019a, + 0x0000a74a, 0x0000a74b, 0x00000172, 0x00000173, + 0x0000042c, 0x0000044c, 0x00000114, 0x00000115, + 0x0001e905, 0x0001e927, 0x00001f1a, 0x00001f12, + 0x0000a64a, 0x0000a64b, 0x00001e4a, 0x00001e4b, + 0x0000018b, 0x0000018c, 0x000010ab, 0x00002d0b, + 0x00001ef4, 0x00001ef5, 0x000000c6, 0x000000e6, + 0x00002c6b, 0x00002c6c, 0x0000a7a6, 0x0000a7a7, + 0x00010401, 0x00010429, 0x000013af, 0x0000ab7f, + 0x000000c3, 0x000000e3, 0x000004b4, 0x000004b5, + 0x000010ad, 0x00002d0d, 0x00000420, 0x00000440, + 0x00000216, 0x00000217, 0x0001e917, 0x0001e939, + 0x00001f3a, 0x00001f32, 0x0001e91e, 0x0001e940, + 0x0000016e, 0x0000016f, 0x00010ca1, 0x00010ce1, + 0x00000516, 0x00000517, 0x00001f2b, 0x00001f23, + 0x0000a76c, 0x0000a76d, 0x0000a78b, 0x0000a78c, + 0x0000a798, 0x0000a799, 0x00000054, 0x00000074, + 0x000013de, 0x0000abae, 0x000104c9, 0x000104f1, + 0x000010c3, 0x00002d23, 0x00001e40, 0x00001e41, + 0x00010c81, 0x00010cc1, 0x00000245, 0x0000028c, + 0x000013ac, 0x0000ab7c, 0x00002cd2, 0x00002cd3, + 0x000118b2, 0x000118d2, 0x00002c26, 0x00002c56, + 0x00001f8e, 0x00001f86, 0x0000a72c, 0x0000a72d, + 0x000001fe, 0x000001ff, 0x000000d3, 0x000000f3, + 0x00000241, 0x00000242, 0x000003a3, 0x000003c3, + 0x000001e0, 0x000001e1, 0x00001f3f, 0x00001f37, + 0x000001ec, 0x000001ed, 0x00002c04, 0x00002c34, + 0x00000397, 0x000003b7, 0x00010caa, 0x00010cea, + 0x0000a656, 0x0000a657, 0x00001fc9, 0x00001f73, + 0x00000550, 0x00000580, 0x000000c8, 0x000000e8, + 0x00002c96, 0x00002c97, 0x00001fac, 0x00001fa4, + 0x00000556, 0x00000586, 0x0000012e, 0x0000012f, + 0x00000492, 0x00000493, 0x0001e906, 0x0001e928, + 0x00000518, 0x00000519, 0x00001ef8, 0x00001ef9, + 0x0000a762, 0x0000a763, 0x000001c4, 0x000001c6, + 0x0000041a, 0x0000043a, 0x00001f39, 0x00001f31, + 0x00001ea0, 0x00001ea1, 0x0000052a, 0x0000052b, + 0x00001e80, 0x00001e81, 0x0000216e, 0x0000217e, + 0x00001ffa, 0x00001f7c, 0x00010c93, 0x00010cd3, + 0x000003e6, 0x000003e7, 0x000024be, 0x000024d8, + 0x0000041c, 0x0000043c, 0x0000018a, 0x00000257, + 0x00010cb0, 0x00010cf0, 0x00000400, 0x00000450, + 0x00000466, 0x00000467, 0x000024c3, 0x000024dd, + 0x00002c1d, 0x00002c4d, 0x00001f0d, 0x00001f05, + 0x0000a65c, 0x0000a65d, 0x00001f4c, 0x00001f44, + 0x000024b8, 0x000024d2, 0x000013e5, 0x0000abb5, + 0x00002ca8, 0x00002ca9, 0x00002c69, 0x00002c6a, + 0x000001cb, 0x000001cc, 0x00001e22, 0x00001e23, + 0x000010b5, 0x00002d15, 0x00000425, 0x00000445, + 0x00010413, 0x0001043b, 0x00002c0a, 0x00002c3a, + 0x00001e88, 0x00001e89, 0x00010c98, 0x00010cd8, + 0x00000156, 0x00000157, 0x0000a740, 0x0000a741, + 0x00000045, 0x00000065, 0x0001e919, 0x0001e93b, + 0x000013b7, 0x0000ab87, 0x000010a1, 0x00002d01, + 0x0000015e, 0x0000015f, 0x0000017d, 0x0000017e, + 0x0001e914, 0x0001e936, 0x000013e9, 0x0000abb9, + 0x00002c92, 0x00002c93, 0x00001e2c, 0x00001e2d, + 0x00000402, 0x00000452, 0x00000042, 0x00000062, + 0x000013a5, 0x0000ab75, 0x0000020e, 0x0000020f, + 0x000001af, 0x000001b0, 0x00001e4e, 0x00001e4f, + 0x00002cb4, 0x00002cb5, 0x000001d9, 0x000001da, + 0x000104c3, 0x000104eb, 0x000004b2, 0x000004b3, + 0x00001f6c, 0x00001f64, 0x00000168, 0x00000169, + 0x000004de, 0x000004df, 0x00000145, 0x00000146, + 0x00001e72, 0x00001e73, 0x00002c09, 0x00002c39, + 0x00001e26, 0x00001e27, 0x0000a79c, 0x0000a79d, + 0x0000054d, 0x0000057d, 0x00002c2a, 0x00002c5a, + 0x0000ff22, 0x0000ff42, 0x000024c5, 0x000024df, + 0x000001d3, 0x000001d4, 0x00001f9d, 0x00001f95, + 0x00000050, 0x00000070, 0x00010c80, 0x00010cc0, + 0x00002cd4, 0x00002cd5, 0x000118b1, 0x000118d1, + 0x0000a768, 0x0000a769, 0x000000dd, 0x000000fd, + 0x000004ea, 0x000004eb, 0x000013c8, 0x0000ab98, + 0x000004ae, 0x000004af, 0x0001040c, 0x00010434, + 0x00002c70, 0x00000252, 0x0000ff23, 0x0000ff43, + 0x00010c83, 0x00010cc3, 0x000001ee, 0x000001ef, + 0x0001041d, 0x00010445, 0x00000394, 0x000003b4, + 0x000010cd, 0x00002d2d, 0x00001fda, 0x00001f76, + 0x00001fa9, 0x00001fa1, 0x00000143, 0x00000144, + 0x000000de, 0x000000fe, 0x000013b9, 0x0000ab89, + 0x000000d9, 0x000000f9, 0x0001e91f, 0x0001e941, + 0x000104c1, 0x000104e9, 0x00002cca, 0x00002ccb, + 0x000004f4, 0x000004f5, 0x0000a780, 0x0000a781, + 0x00000232, 0x00000233, 0x000013a2, 0x0000ab72, + 0x00002c9e, 0x00002c9f, 0x00010c88, 0x00010cc8, + 0x00000197, 0x00000268, 0x0000021c, 0x0000021d, + 0x0000052c, 0x0000052d, 0x00010421, 0x00010449, + 0x0000ff2f, 0x0000ff4f, 0x0000022a, 0x0000022b, + 0x000013cd, 0x0000ab9d, 0x0000039f, 0x000003bf, + 0x000024c2, 0x000024dc, 0x00000408, 0x00000458, + 0x00001f88, 0x00001f80, 0x000001a2, 0x000001a3, + 0x000104bf, 0x000104e7, 0x0000046e, 0x0000046f, + 0x00001f8b, 0x00001f83, 0x00002cb8, 0x00002cb9, + 0x00010408, 0x00010430, 0x00001f0f, 0x00001f07, + 0x00001f4d, 0x00001f45, 0x00000504, 0x00000505, + 0x000104ce, 0x000104f6, 0x000118b0, 0x000118d0, + 0x00001f6e, 0x00001f66, 0x00002169, 0x00002179 +}; + +static const unsigned _uccase_title_g_size = 20; +static const short _uccase_title_g[] = { + 120, 10, 124, 98, -37, -18, -73, 454, + 1, 33, 265, 32767, 20018, 1, -68, 376, + 134, 1, 2, -62 +}; -/* Starting indexes of the case tables - * UpperIndex = 0 - * LowerIndex = _uccase_len[0] - * TitleIndex = LowerIndex + _uccase_len[1] */ +static const unsigned _uccase_title_table_size = 89; +static const unsigned _uccase_title_table[] = { + 0x00001f8b, 0x00001f8b, 0x000001c8, 0x000001c8, + 0x00001f89, 0x00001f89, 0x00001f93, 0x00001f9b, + 0x0000fb13, 0x02000162, 0x00001f91, 0x00001f99, + 0x00001f9b, 0x00001f9b, 0x00001f9f, 0x00001f9f, + 0x00001f99, 0x00001f99, 0x0000fb04, 0x03000155, + 0x00001fa7, 0x00001faf, 0x000001c7, 0x000001c8, + 0x000001c9, 0x000001c8, 0x00001faf, 0x00001faf, + 0x0000fb01, 0x0200014b, 0x000000df, 0x02000145, + 0x00001fb7, 0x03000183, 0x00001fb4, 0x02000174, + 0x0000fb03, 0x03000151, 0x00001fc2, 0x02000177, + 0x00001f86, 0x00001f8e, 0x00001fa0, 0x00001fa8, + 0x00001fc7, 0x03000187, 0x00001f8e, 0x00001f8e, + 0x00001fa8, 0x00001fa8, 0x00001fb2, 0x02000171, + 0x00001f96, 0x00001f9e, 0x000001f3, 0x000001f2, + 0x00001faa, 0x00001faa, 0x00001fa6, 0x00001fae, + 0x00001f80, 0x00001f88, 0x00001ff7, 0x0300018b, + 0x00001f9e, 0x00001f9e, 0x00001f88, 0x00001f88, + 0x000001ca, 0x000001cb, 0x000001f2, 0x000001f2, + 0x00001f90, 0x00001f98, 0x0000fb14, 0x02000165, + 0x00001fa1, 0x00001fa9, 0x00001f98, 0x00001f98, + 0x00001f9c, 0x00001f9c, 0x00001fa9, 0x00001fa9, + 0x0000fb06, 0x0200015c, 0x00001f87, 0x00001f8f, + 0x000001c4, 0x000001c5, 0x00001f85, 0x00001f8d, + 0x00001f8f, 0x00001f8f, 0x000001cc, 0x000001cb, + 0x00001f8d, 0x00001f8d, 0x00001f97, 0x00001f9f, + 0x0000fb17, 0x0200016e, 0x00001f95, 0x00001f9d, + 0x0000fb00, 0x02000148, 0x00001fa3, 0x00001fab, + 0x000001f1, 0x000001f2, 0x000001c5, 0x000001c5, + 0x00001fab, 0x00001fab, 0x000001cb, 0x000001cb, + 0x00001fc4, 0x0200017a, 0x00001fb3, 0x00001fbc, + 0x0000fb05, 0x02000159, 0x00001fcc, 0x00001fcc, + 0x0000fb15, 0x02000168, 0x00001f82, 0x00001f8a, + 0x00001fbc, 0x00001fbc, 0x00001fc3, 0x00001fcc, + 0x00001f8a, 0x00001f8a, 0x00001fa4, 0x00001fac, + 0x0000fb16, 0x0200016b, 0x00001f92, 0x00001f9a, + 0x00001fac, 0x00001fac, 0x00001fae, 0x00001fae, + 0x00001f9a, 0x00001f9a, 0x00001ff2, 0x0200017d, + 0x00001ff3, 0x00001ffc, 0x00001fa2, 0x00001faa, + 0x00001f84, 0x00001f8c, 0x000001c6, 0x000001c5, + 0x00001f9d, 0x00001f9d, 0x00001f8c, 0x00001f8c, + 0x00001ff4, 0x02000180, 0x00001fa5, 0x00001fad, + 0x00001f94, 0x00001f9c, 0x00001ffc, 0x00001ffc, + 0x00001fad, 0x00001fad, 0x0000fb02, 0x0200014e, + 0x00001f83, 0x00001f8b, 0x00000587, 0x0200015f, + 0x00001f81, 0x00001f89 +}; -static const unsigned short _uccase_len[2] = {1273, 1317}; +static const unsigned _uccase_fold_g_size = 257; +static const short _uccase_fold_g[] = { + 4, 162, 2377, 355, 774, 2197, 222, 2, + 1027, -835, 1660, 8, 502, 350, 5, 500, + 220, 3466, 23, 8122, 12032, 3550, 1, 173, + 16536, 288, 350, 2531, 269, 79, 759, 148, + 1092, 8, 36, 418, 9, 1, 1680, 3457, + 585, 436, 2233, 390, 1, 131, -996, 739, + 66, 107, 350, 156, 766, 1041, 1335, 174, + 45, 2825, 4, 72, 79, 154, 358, 46, + 1245, 4280, 122, 63, -1085, 61, 15, 18230, + 2465, 58, 322, 10438, 152, 312, 13, 1667, + 1, 252, 1105, -467, 1384, 46, 705, 1175, + 2, 63, -1169, 98, 409, 1203, 1013, 287, + 20, 11838, 1203, 246, 151, 1584, 2, 123, + 203, -681, 16779, 70, 498, 2058, 35, 128, + -1252, 88, 61, -1375, 4607, 1, 593, 8856, + 851, 243, 384, 78, 107, 2, 1022, 419, + 742, 371, 1282, 52, 20, 146, -1277, 701, + 76, 2782, 493, 513, 139, 2398, 3085, 277, + 403, 3462, 11, 49, 78, 842, 213, 390, + 3873, 1306, 16, 42, -429, 1810, 51, 4437, + 866, 134, 259, 1665, 1325, 1289, 305, 629, + 2, 10, 5, 2025, 448, 133, 2803, 243, + 1, 28, 590, 640, 777, 12597, 2448, 11, + 412, 1069, 209, 208, 13, 3214, 335, 61, + 2, -749, 1273, 3795, 1635, 3207, 1, 17, + 10634, 4536, 78, 3432, 1814, 45, 5470, 2308, + 3851, 1077, 325, 431, 89, 37, 34, 504, + 1259, 911, 13469, 334, 4, 1709, 918, 284, + 91, 166, 5828, 5, 253, 1356, 143, 121, + 29, 4127, 428, 14, 2769, 3414, -369, 31, + 3924, 227, 1, 1026, 16002, 8110, 88, 480, + 457, 28, 1186, 542, 7689, 216, 385, 1642, + 1011 +}; + +static const unsigned _uccase_fold_table_size = 1401; +static const unsigned _uccase_fold_table[] = { + 0x0000022c, 0x0000022d, 0x00001e2c, 0x00001e2d, + 0x000001a4, 0x000001a5, 0x00002c60, 0x00002c61, + 0x0000042d, 0x0000044d, 0x000104c7, 0x000104ef, + 0x00002c2a, 0x00002c5a, 0x00001f0f, 0x00001f07, + 0x000001c7, 0x000001c9, 0x0000fb13, 0x020002c8, + 0x000004f8, 0x000004f9, 0x000001b8, 0x000001b9, + 0x00000190, 0x0000025b, 0x00001f84, 0x020001d3, + 0x0000a7b3, 0x0000ab53, 0x00000409, 0x00000459, + 0x0000a784, 0x0000a785, 0x00002c1c, 0x00002c4c, + 0x000013fb, 0x000013f3, 0x00001eb6, 0x00001eb7, + 0x000001d3, 0x000001d4, 0x00001ed6, 0x00001ed7, + 0x00001eee, 0x00001eef, 0x00002c05, 0x00002c35, + 0x00010c89, 0x00010cc9, 0x0000a7ae, 0x0000026a, + 0x000004c0, 0x000004cf, 0x00001f3a, 0x00001f32, + 0x00000197, 0x00000268, 0x0000abb3, 0x000013e3, + 0x0000047c, 0x0000047d, 0x00000549, 0x00000579, + 0x00001ee6, 0x00001ee7, 0x0000a66a, 0x0000a66b, + 0x00001e3e, 0x00001e3f, 0x00000189, 0x00000256, + 0x00001ebc, 0x00001ebd, 0x00000406, 0x00000456, + 0x0000a72a, 0x0000a72b, 0x0001e90c, 0x0001e92e, + 0x00000427, 0x00000447, 0x0000a779, 0x0000a77a, + 0x000000c2, 0x000000e2, 0x00001e99, 0x020001af, + 0x00001faf, 0x02000254, 0x00002169, 0x00002179, + 0x00010ca7, 0x00010ce7, 0x0000017f, 0x00000073, + 0x000010b1, 0x00002d11, 0x0000042c, 0x0000044c, + 0x00001f2f, 0x00001f27, 0x00000051, 0x00000071, + 0x0000a752, 0x0000a753, 0x0001e903, 0x0001e925, + 0x00001f8d, 0x020001ee, 0x0000212b, 0x000000e5, + 0x00001f87, 0x020001dc, 0x00001c87, 0x00000463, + 0x00001f59, 0x00001f51, 0x000118b1, 0x000118d1, + 0x0000212a, 0x0000006b, 0x00010406, 0x0001042e, + 0x00000472, 0x00000473, 0x00001fc4, 0x02000270, + 0x0000abac, 0x000013dc, 0x0000abba, 0x000013ea, + 0x00001ee2, 0x00001ee3, 0x00000547, 0x00000577, + 0x00000534, 0x00000564, 0x0000a644, 0x0000a645, + 0x0001e900, 0x0001e922, 0x00001f1c, 0x00001f14, + 0x00001f92, 0x020001fd, 0x00010ca1, 0x00010ce1, + 0x000104c6, 0x000104ee, 0x0000a79c, 0x0000a79d, + 0x0000020e, 0x0000020f, 0x00000417, 0x00000437, + 0x00002c72, 0x00002c73, 0x0001e91b, 0x0001e93d, + 0x000024c1, 0x000024db, 0x00002c82, 0x00002c83, + 0x00001ea0, 0x00001ea1, 0x000003cf, 0x000003d7, + 0x00000196, 0x00000269, 0x00001f8a, 0x020001e5, + 0x0000013b, 0x0000013c, 0x00010c83, 0x00010cc3, + 0x0000040b, 0x0000045b, 0x0000a75a, 0x0000a75b, + 0x0000048a, 0x0000048b, 0x00000388, 0x000003ad, + 0x00000222, 0x00000223, 0x000001f1, 0x000001f3, + 0x000001b7, 0x00000292, 0x000118a9, 0x000118c9, + 0x0001e90e, 0x0001e930, 0x0000a77e, 0x0000a77f, + 0x00002ca8, 0x00002ca9, 0x00001fa8, 0x0200023f, + 0x0000ab99, 0x000013c9, 0x0000aba3, 0x000013d3, + 0x000024cb, 0x000024e5, 0x000010a0, 0x00002d00, + 0x00002c18, 0x00002c48, 0x000104b1, 0x000104d9, + 0x00010420, 0x00010448, 0x000003fd, 0x0000037b, + 0x000003fe, 0x0000037c, 0x00002ca2, 0x00002ca3, + 0x0000046c, 0x0000046d, 0x00000508, 0x00000509, + 0x0000038c, 0x000003cc, 0x00001ff8, 0x00001f78, + 0x0001040d, 0x00010435, 0x00000412, 0x00000432, + 0x00001ef2, 0x00001ef3, 0x00000476, 0x00000477, + 0x00002c12, 0x00002c42, 0x0000018b, 0x0000018c, + 0x000010b7, 0x00002d17, 0x000003f1, 0x000003c1, + 0x00010407, 0x0001042f, 0x0000ab7a, 0x000013aa, + 0x0000040a, 0x0000045a, 0x000001d7, 0x000001d8, + 0x0000049c, 0x0000049d, 0x0001041c, 0x00010444, + 0x00001e84, 0x00001e85, 0x000000d1, 0x000000f1, + 0x00001ee8, 0x00001ee9, 0x00001e66, 0x00001e67, + 0x00000191, 0x00000192, 0x0000a640, 0x0000a641, + 0x00001fd2, 0x0300027d, 0x000010ab, 0x00002d0b, + 0x0000ab97, 0x000013c7, 0x00000052, 0x00000072, + 0x00010c95, 0x00010cd5, 0x0000a68a, 0x0000a68b, + 0x00000514, 0x00000515, 0x00001e42, 0x00001e43, + 0x00000132, 0x00000133, 0x0000010a, 0x0000010b, + 0x00001f2e, 0x00001f26, 0x00001e32, 0x00001e33, + 0x00002cc0, 0x00002cc1, 0x00000202, 0x00000203, + 0x00000204, 0x00000205, 0x000010b0, 0x00002d10, + 0x00010ca6, 0x00010ce6, 0x000000dd, 0x000000fd, + 0x000024b9, 0x000024d3, 0x00001e60, 0x00001e61, + 0x000004e8, 0x000004e9, 0x0000050c, 0x0000050d, + 0x0000a66c, 0x0000a66d, 0x0000015a, 0x0000015b, + 0x0000abb4, 0x000013e4, 0x0000ab79, 0x000013a9, + 0x00010c91, 0x00010cd1, 0x00010c9b, 0x00010cdb, + 0x000004fe, 0x000004ff, 0x000010b4, 0x00002d14, + 0x00000041, 0x00000061, 0x000000c6, 0x000000e6, + 0x00001ed2, 0x00001ed3, 0x00001ea4, 0x00001ea5, + 0x000118ae, 0x000118ce, 0x0000216d, 0x0000217d, + 0x0001e91a, 0x0001e93c, 0x00000420, 0x00000440, + 0x0001040f, 0x00010437, 0x00002cb6, 0x00002cb7, + 0x00010c9d, 0x00010cdd, 0x000010c4, 0x00002d24, + 0x00001e92, 0x00001e93, 0x00001e68, 0x00001e69, + 0x00000149, 0x02000195, 0x00000122, 0x00000123, + 0x0001e920, 0x0001e942, 0x000001e8, 0x000001e9, + 0x000118bb, 0x000118db, 0x00010cad, 0x00010ced, + 0x000001f8, 0x000001f9, 0x00001fea, 0x00001f7a, + 0x00002c29, 0x00002c59, 0x00001c88, 0x0000a64b, + 0x000024b7, 0x000024d1, 0x00002cbe, 0x00002cbf, + 0x00002c16, 0x00002c46, 0x00002cde, 0x00002cdf, + 0x00000174, 0x00000175, 0x00000156, 0x00000157, + 0x00002c06, 0x00002c36, 0x0001e916, 0x0001e938, + 0x0000ab91, 0x000013c1, 0x0000a744, 0x0000a745, + 0x0000a742, 0x0000a743, 0x0000053c, 0x0000056c, + 0x000004d0, 0x000004d1, 0x0000abb8, 0x000013e8, + 0x00001fa9, 0x02000242, 0x00002cd8, 0x00002cd9, + 0x0000ab87, 0x000013b7, 0x000118a4, 0x000118c4, + 0x000010bb, 0x00002d1b, 0x00000194, 0x00000263, + 0x00000423, 0x00000443, 0x00000046, 0x00000066, + 0x0000ab96, 0x000013c6, 0x0000a684, 0x0000a685, + 0x00000241, 0x00000242, 0x00002c27, 0x00002c57, + 0x00000128, 0x00000129, 0x0000040e, 0x0000045e, + 0x0000050a, 0x0000050b, 0x00001f93, 0x02000200, + 0x00000540, 0x00000570, 0x00000224, 0x00000225, + 0x000000cb, 0x000000eb, 0x000010a7, 0x00002d07, + 0x00001f4c, 0x00001f44, 0x00002c70, 0x00000252, + 0x0000ab9f, 0x000013cf, 0x00001e46, 0x00001e47, + 0x00000546, 0x00000576, 0x00001e22, 0x00001e23, + 0x00000176, 0x00000177, 0x0000014c, 0x0000014d, + 0x00010408, 0x00010430, 0x00001f29, 0x00001f21, + 0x0000aba8, 0x000013d8, 0x000003a9, 0x000003c9, + 0x0000a7ad, 0x0000026c, 0x0000019f, 0x00000275, + 0x00000512, 0x00000513, 0x00010c8a, 0x00010cca, + 0x000024be, 0x000024d8, 0x00000216, 0x00000217, + 0x000118a8, 0x000118c8, 0x0000054f, 0x0000057f, + 0x0000a698, 0x0000a699, 0x00002c26, 0x00002c56, + 0x00001f3d, 0x00001f35, 0x0000ff38, 0x0000ff58, + 0x00000550, 0x00000580, 0x00010c84, 0x00010cc4, + 0x0000a73a, 0x0000a73b, 0x00002c6b, 0x00002c6c, + 0x000104d1, 0x000104f9, 0x0000019d, 0x00000272, + 0x000000db, 0x000000fb, 0x00002c92, 0x00002c93, + 0x0001e915, 0x0001e937, 0x000118b7, 0x000118d7, + 0x00000139, 0x0000013a, 0x0000a7a2, 0x0000a7a3, + 0x00001fc2, 0x0200026a, 0x0000004f, 0x0000006f, + 0x00001fe9, 0x00001fe1, 0x00000220, 0x0000019e, + 0x00001e0c, 0x00001e0d, 0x00002c20, 0x00002c50, + 0x00000168, 0x00000169, 0x00000152, 0x00000153, + 0x00001e6c, 0x00001e6d, 0x0000fb06, 0x020002c5, + 0x000024c0, 0x000024da, 0x0000a728, 0x0000a729, + 0x00001f54, 0x030001bf, 0x000004ac, 0x000004ad, + 0x000104bf, 0x000104e7, 0x0000017d, 0x0000017e, + 0x00000243, 0x00000180, 0x000024cd, 0x000024e7, + 0x00000494, 0x00000495, 0x00000556, 0x00000586, + 0x0000a696, 0x0000a697, 0x000010b3, 0x00002d13, + 0x0000a7b4, 0x0000a7b5, 0x00001fad, 0x0200024e, + 0x0000ab71, 0x000013a1, 0x00001ef4, 0x00001ef5, + 0x000003a0, 0x000003c0, 0x00000413, 0x00000433, + 0x00002c23, 0x00002c53, 0x000104d3, 0x000104fb, + 0x00000187, 0x00000188, 0x000104b0, 0x000104d8, + 0x000118ab, 0x000118cb, 0x0000039c, 0x000003bc, + 0x00000210, 0x00000211, 0x0000a68c, 0x0000a68d, + 0x00001f97, 0x0200020c, 0x00001f9e, 0x02000221, + 0x00000057, 0x00000077, 0x00001f4a, 0x00001f42, + 0x00001e62, 0x00001e63, 0x000004b0, 0x000004b1, + 0x00002c1f, 0x00002c4f, 0x000104b7, 0x000104df, + 0x00000158, 0x00000159, 0x0000fb16, 0x020002d1, + 0x0000a64a, 0x0000a64b, 0x00002168, 0x00002178, + 0x00000393, 0x000003b3, 0x0000052e, 0x0000052f, + 0x00000470, 0x00000471, 0x000000cc, 0x000000ec, + 0x000024ba, 0x000024d4, 0x000024ca, 0x000024e4, + 0x00001e52, 0x00001e53, 0x000118b4, 0x000118d4, + 0x000001f6, 0x00000195, 0x0000ff21, 0x0000ff41, + 0x0000fb01, 0x020002b4, 0x0001041d, 0x00010445, + 0x00000058, 0x00000078, 0x000104ce, 0x000104f6, + 0x0000a750, 0x0000a751, 0x00001e30, 0x00001e31, + 0x0000053e, 0x0000056e, 0x0001e901, 0x0001e923, + 0x000000d4, 0x000000f4, 0x00002c96, 0x00002c97, + 0x00002167, 0x00002177, 0x00002126, 0x000003c9, + 0x0000ff26, 0x0000ff46, 0x000010c1, 0x00002d21, + 0x00001fb6, 0x02000260, 0x0000ab95, 0x000013c5, + 0x0000ab7b, 0x000013ab, 0x000000c7, 0x000000e7, + 0x00001e6a, 0x00001e6b, 0x00001efc, 0x00001efd, + 0x000004f2, 0x000004f3, 0x000104d2, 0x000104fa, + 0x00001f28, 0x00001f20, 0x00002c94, 0x00002c95, + 0x0000a648, 0x0000a649, 0x00000411, 0x00000431, + 0x000104b8, 0x000104e0, 0x0001e921, 0x0001e943, + 0x00001ffb, 0x00001f7d, 0x000004dc, 0x000004dd, + 0x0000abb9, 0x000013e9, 0x000024b6, 0x000024d0, + 0x00002cc2, 0x00002cc3, 0x00002c1e, 0x00002c4e, + 0x00000548, 0x00000578, 0x000010a3, 0x00002d03, + 0x00001f68, 0x00001f60, 0x000000d9, 0x000000f9, + 0x000003f7, 0x000003f8, 0x000024c9, 0x000024e3, + 0x000104ba, 0x000104e2, 0x00000246, 0x00000247, + 0x00000425, 0x00000445, 0x000104cf, 0x000104f7, + 0x0000abb2, 0x000013e2, 0x00010cae, 0x00010cee, + 0x00001e98, 0x020001ac, 0x00001fdb, 0x00001f77, + 0x00001eaa, 0x00001eab, 0x0000ff31, 0x0000ff51, + 0x000010ac, 0x00002d0c, 0x00001f81, 0x020001ca, + 0x00010425, 0x0001044d, 0x000104cc, 0x000104f4, + 0x00001e02, 0x00001e03, 0x00000404, 0x00000454, + 0x0000038a, 0x000003af, 0x00000533, 0x00000563, + 0x0000011a, 0x0000011b, 0x00001ff3, 0x020002a1, + 0x00001eea, 0x00001eeb, 0x0000ab8f, 0x000013bf, + 0x00002c88, 0x00002c89, 0x000001fa, 0x000001fb, + 0x00001fe8, 0x00001fe0, 0x000118a2, 0x000118c2, + 0x000000d3, 0x000000f3, 0x00000053, 0x00000073, + 0x0000a756, 0x0000a757, 0x000118a5, 0x000118c5, + 0x0000ff2d, 0x0000ff4d, 0x0000a664, 0x0000a665, + 0x0000a75c, 0x0000a75d, 0x00001f5b, 0x00001f53, + 0x00001e3a, 0x00001e3b, 0x0000ab75, 0x000013a5, + 0x0000a746, 0x0000a747, 0x0000023e, 0x00002c66, + 0x0000049e, 0x0000049f, 0x00002c6f, 0x00000250, + 0x00000160, 0x00000161, 0x00001e10, 0x00001e11, + 0x00001f39, 0x00001f31, 0x00002cd4, 0x00002cd5, + 0x000104b6, 0x000104de, 0x00002ceb, 0x00002cec, + 0x0000042a, 0x0000044a, 0x0000042e, 0x0000044e, + 0x00000042, 0x00000062, 0x000001a0, 0x000001a1, + 0x00001f91, 0x020001fa, 0x0000a76a, 0x0000a76b, + 0x000004fc, 0x000004fd, 0x00000120, 0x00000121, + 0x00010ca4, 0x00010ce4, 0x0000013d, 0x0000013e, + 0x00001ede, 0x00001edf, 0x000118b9, 0x000118d9, + 0x00001c83, 0x00000441, 0x00002ca6, 0x00002ca7, + 0x000010bc, 0x00002d1c, 0x00001fc7, 0x03000276, + 0x00000228, 0x00000229, 0x000024b8, 0x000024d2, + 0x000010c2, 0x00002d22, 0x00000542, 0x00000572, + 0x000004b2, 0x000004b3, 0x0000ff36, 0x0000ff56, + 0x0000014a, 0x0000014b, 0x00001f3e, 0x00001f36, + 0x00001f2c, 0x00001f24, 0x00002c17, 0x00002c47, + 0x00001e72, 0x00001e73, 0x00000397, 0x000003b7, + 0x00010c92, 0x00010cd2, 0x0000047e, 0x0000047f, + 0x00002ced, 0x00002cee, 0x000024c2, 0x000024dc, + 0x000010c0, 0x00002d20, 0x00002166, 0x00002176, + 0x00002c7e, 0x0000023f, 0x000001d5, 0x000001d6, + 0x0000018e, 0x000001dd, 0x00001fc8, 0x00001f72, + 0x00010417, 0x0001043f, 0x00000047, 0x00000067, + 0x00001f52, 0x030001bb, 0x0000a75e, 0x0000a75f, + 0x00002c0c, 0x00002c3c, 0x00002cc4, 0x00002cc5, + 0x000104b9, 0x000104e1, 0x0000022e, 0x0000022f, + 0x00001f98, 0x0200020f, 0x00002cc8, 0x00002cc9, + 0x00001e36, 0x00001e37, 0x000010b8, 0x00002d18, + 0x000000c5, 0x000000e5, 0x00001f83, 0x020001d0, + 0x00010423, 0x0001044b, 0x000001e6, 0x000001e7, + 0x00001f69, 0x00001f61, 0x00001e16, 0x00001e17, + 0x0000ab85, 0x000013b5, 0x00000166, 0x00000167, + 0x00000386, 0x000003ac, 0x000003f5, 0x000003b5, + 0x00000232, 0x00000233, 0x00010caf, 0x00010cef, + 0x00002cba, 0x00002cbb, 0x00001e74, 0x00001e75, + 0x00000524, 0x00000525, 0x00002c13, 0x00002c43, + 0x000104c0, 0x000104e8, 0x0000ab8c, 0x000013bc, + 0x00001e8e, 0x00001e8f, 0x00000490, 0x00000491, + 0x00001fa7, 0x0200023c, 0x000001ae, 0x00000288, + 0x000001b5, 0x000001b6, 0x0000fb03, 0x030002ba, + 0x00010415, 0x0001043d, 0x0000abbd, 0x000013ed, + 0x0000020a, 0x0000020b, 0x000003a6, 0x000003c6, + 0x000004c1, 0x000004c2, 0x000004d8, 0x000004d9, + 0x00001e82, 0x00001e83, 0x000000df, 0x0200018f, + 0x0001e902, 0x0001e924, 0x000000c3, 0x000000e3, + 0x0001e90d, 0x0001e92f, 0x00010400, 0x00010428, + 0x000001c8, 0x000001c9, 0x00000421, 0x00000441, + 0x0000ab80, 0x000013b0, 0x00010ca0, 0x00010ce0, + 0x00001ed8, 0x00001ed9, 0x0000a7a4, 0x0000a7a5, + 0x00000500, 0x00000501, 0x00000389, 0x000003ae, + 0x00000150, 0x00000151, 0x0000011e, 0x0000011f, + 0x00001f19, 0x00001f11, 0x0000ab8a, 0x000013ba, + 0x0000216a, 0x0000217a, 0x000104be, 0x000104e6, + 0x000118b0, 0x000118d0, 0x00001ffa, 0x00001f7c, + 0x00001e2a, 0x00001e2b, 0x00002c08, 0x00002c38, + 0x0000a760, 0x0000a761, 0x0000017b, 0x0000017c, + 0x000004f6, 0x000004f7, 0x00001e88, 0x00001e89, + 0x0000ff25, 0x0000ff45, 0x0001e911, 0x0001e933, + 0x000024ce, 0x000024e8, 0x000000c1, 0x000000e1, + 0x0000a7ab, 0x0000025c, 0x00002c63, 0x00001d7d, + 0x0000047a, 0x0000047b, 0x00000428, 0x00000448, + 0x0001e91e, 0x0001e940, 0x000104b5, 0x000104dd, + 0x0000fb17, 0x020002d4, 0x000003f9, 0x000003f2, + 0x00000426, 0x00000446, 0x0000a782, 0x0000a783, + 0x00001fd9, 0x00001fd1, 0x00001fb2, 0x02000257, + 0x00001f89, 0x020001e2, 0x00010424, 0x0001044c, + 0x00000218, 0x00000219, 0x0000a792, 0x0000a793, + 0x0000039e, 0x000003be, 0x0000054e, 0x0000057e, + 0x0000011c, 0x0000011d, 0x00000118, 0x00000119, + 0x000010a8, 0x00002d08, 0x0001e919, 0x0001e93b, + 0x00010c99, 0x00010cd9, 0x00002165, 0x00002175, + 0x00000208, 0x00000209, 0x00001fe3, 0x03000290, + 0x00001e7c, 0x00001e7d, 0x00000480, 0x00000481, + 0x0001e905, 0x0001e927, 0x00001eac, 0x00001ead, + 0x000004be, 0x000004bf, 0x000004d4, 0x000004d5, + 0x0000a666, 0x0000a667, 0x0000015c, 0x0000015d, + 0x00000345, 0x000003b9, 0x000001a6, 0x00000280, + 0x0000ff30, 0x0000ff50, 0x0000a7ac, 0x00000261, + 0x0000a736, 0x0000a737, 0x0001041e, 0x00010446, + 0x00001e70, 0x00001e71, 0x000000c4, 0x000000e4, + 0x000003ee, 0x000003ef, 0x00002132, 0x0000214e, + 0x000004ae, 0x000004af, 0x00001e38, 0x00001e39, + 0x000010c7, 0x00002d27, 0x00001fae, 0x02000251, + 0x00001fac, 0x0200024b, 0x00000043, 0x00000063, + 0x00002c9c, 0x00002c9d, 0x00001e1a, 0x00001e1b, + 0x000004a2, 0x000004a3, 0x0000046e, 0x0000046f, + 0x00000531, 0x00000561, 0x00000114, 0x00000115, + 0x00001f1a, 0x00001f12, 0x00001eec, 0x00001eed, + 0x0000048e, 0x0000048f, 0x000001ea, 0x000001eb, + 0x00001c82, 0x0000043e, 0x00001fec, 0x00001fe5, + 0x00010403, 0x0001042b, 0x0000aba1, 0x000013d1, + 0x0000004a, 0x0000006a, 0x00001e4a, 0x00001e4b, + 0x00000555, 0x00000585, 0x0000ff39, 0x0000ff59, + 0x0000a660, 0x0000a661, 0x0001e917, 0x0001e939, + 0x00001f9f, 0x02000224, 0x00002c7f, 0x00000240, + 0x00002cd0, 0x00002cd1, 0x00002cce, 0x00002ccf, + 0x00000392, 0x000003b2, 0x000003a5, 0x000003c5, + 0x000104c5, 0x000104ed, 0x0000abae, 0x000013de, + 0x00001ef6, 0x00001ef7, 0x00002c2e, 0x00002c5e, + 0x00000478, 0x00000479, 0x00010c9a, 0x00010cda, + 0x000010bf, 0x00002d1f, 0x00001fa4, 0x02000233, + 0x0000053a, 0x0000056a, 0x0000004e, 0x0000006e, + 0x00000141, 0x00000142, 0x00001f5d, 0x00001f55, + 0x0000a768, 0x0000a769, 0x0000040c, 0x0000045c, + 0x0000012e, 0x0000012f, 0x000003fa, 0x000003fb, + 0x00001eb0, 0x00001eb1, 0x00000245, 0x0000028c, + 0x0000216b, 0x0000217b, 0x00010c8b, 0x00010ccb, + 0x000010b2, 0x00002d12, 0x00001fe4, 0x02000294, + 0x000118a1, 0x000118c1, 0x00002cc6, 0x00002cc7, + 0x0000a7a8, 0x0000a7a9, 0x00002cac, 0x00002cad, + 0x00001e9e, 0x020001b5, 0x000118ba, 0x000118da, + 0x0000ff29, 0x0000ff49, 0x0000014e, 0x0000014f, + 0x00001eb4, 0x00001eb5, 0x00001f0d, 0x00001f05, + 0x00010c94, 0x00010cd4, 0x0000a7b2, 0x0000029d, + 0x0001e90a, 0x0001e92c, 0x00010ca9, 0x00010ce9, + 0x000104bd, 0x000104e5, 0x000104c2, 0x000104ea, + 0x000024c3, 0x000024dd, 0x00001e97, 0x020001a9, + 0x000104b3, 0x000104db, 0x0000ff32, 0x0000ff52, + 0x0000a69a, 0x0000a69b, 0x00001fe7, 0x0300029a, + 0x00001fbc, 0x02000267, 0x0001040e, 0x00010436, + 0x0000ab74, 0x000013a4, 0x0000a7b6, 0x0000a7b7, + 0x000003d8, 0x000003d9, 0x00001e3c, 0x00001e3d, + 0x0000a68e, 0x0000a68f, 0x00000106, 0x00000107, + 0x000118ac, 0x000118cc, 0x00001f85, 0x020001d6, + 0x000003e2, 0x000003e3, 0x000004f0, 0x000004f1, + 0x00001f9c, 0x0200021b, 0x000001b3, 0x000001b4, + 0x00001e80, 0x00001e81, 0x0000aba5, 0x000013d5, + 0x00000050, 0x00000070, 0x00001e1c, 0x00001e1d, + 0x00001e0a, 0x00001e0b, 0x00002cd6, 0x00002cd7, + 0x0000a652, 0x0000a653, 0x00002cda, 0x00002cdb, + 0x00002cbc, 0x00002cbd, 0x0000041b, 0x0000043b, + 0x0000038f, 0x000003ce, 0x0000a7a6, 0x0000a7a7, + 0x00002c2b, 0x00002c5b, 0x000001cb, 0x000001cc, + 0x0000ab9a, 0x000013ca, 0x000001f0, 0x02000198, + 0x000003b0, 0x0300019f, 0x00001f90, 0x020001f7, + 0x0000021a, 0x0000021b, 0x000004ec, 0x000004ed, + 0x0000a738, 0x0000a739, 0x0000ff27, 0x0000ff47, + 0x00002c14, 0x00002c44, 0x0001e906, 0x0001e928, + 0x00001fa3, 0x02000230, 0x00010c86, 0x00010cc6, + 0x0000041a, 0x0000043a, 0x00000504, 0x00000505, + 0x000104c4, 0x000104ec, 0x00000104, 0x00000105, + 0x00001e7a, 0x00001e7b, 0x00001f48, 0x00001f40, + 0x00002c8a, 0x00002c8b, 0x00002c11, 0x00002c41, + 0x00001f9a, 0x02000215, 0x00001fa1, 0x0200022a, + 0x00001fb3, 0x0200025a, 0x0000ab8e, 0x000013be, + 0x0000ab94, 0x000013c4, 0x00001ec0, 0x00001ec1, + 0x00001e04, 0x00001e05, 0x00000539, 0x00000569, + 0x0000a658, 0x0000a659, 0x0001e90f, 0x0001e931, + 0x00000126, 0x00000127, 0x00000535, 0x00000565, + 0x00002c07, 0x00002c37, 0x000004aa, 0x000004ab, + 0x00001e34, 0x00001e35, 0x00002c15, 0x00002c45, + 0x00000462, 0x00000463, 0x0000ab98, 0x000013c8, + 0x00000184, 0x00000185, 0x000024c5, 0x000024df, + 0x00001e50, 0x00001e51, 0x00002c90, 0x00002c91, + 0x00000147, 0x00000148, 0x0000ff23, 0x0000ff43, + 0x00001f2b, 0x00001f23, 0x0001041b, 0x00010443, + 0x00000049, 0x00000069, 0x00001efe, 0x00001eff, + 0x0001040c, 0x00010434, 0x00000401, 0x00000451, + 0x000004c5, 0x000004c6, 0x0000048c, 0x0000048d, + 0x000000de, 0x000000fe, 0x00001f4b, 0x00001f43, + 0x00001e12, 0x00001e13, 0x00000522, 0x00000523, + 0x00001ece, 0x00001ecf, 0x00000230, 0x00000231, + 0x00001fbe, 0x000003b9, 0x0000ab8d, 0x000013bd, + 0x0000ab81, 0x000013b1, 0x0000a798, 0x0000a799, + 0x00002c8c, 0x00002c8d, 0x00000498, 0x00000499, + 0x00001e40, 0x00001e41, 0x000013fa, 0x000013f2, + 0x000003e0, 0x000003e1, 0x00001efa, 0x00001efb, + 0x00001e26, 0x00001e27, 0x00001f88, 0x020001df, + 0x0000a72c, 0x0000a72d, 0x000004b8, 0x000004b9, + 0x00001fbb, 0x00001f71, 0x0000a79e, 0x0000a79f, + 0x00000418, 0x00000438, 0x00010404, 0x0001042c, + 0x0000a780, 0x0000a781, 0x000118b6, 0x000118d6, + 0x0000050e, 0x0000050f, 0x00000172, 0x00000173, + 0x00002c0b, 0x00002c3b, 0x00001f09, 0x00001f01, + 0x000013f9, 0x000013f1, 0x00010ca8, 0x00010ce8, + 0x00001c81, 0x00000434, 0x0000a732, 0x0000a733, + 0x00002163, 0x00002173, 0x00002c09, 0x00002c39, + 0x000001ca, 0x000001cc, 0x00002ca0, 0x00002ca1, + 0x00001e96, 0x020001a6, 0x00000506, 0x00000507, + 0x00002cb0, 0x00002cb1, 0x00000186, 0x00000254, + 0x00001fe2, 0x0300028c, 0x00000496, 0x00000497, + 0x00010427, 0x0001044f, 0x00000054, 0x00000074, + 0x0000a79a, 0x0000a79b, 0x0000054c, 0x0000057c, + 0x0001e91f, 0x0001e941, 0x0001041a, 0x00010442, + 0x00001ec2, 0x00001ec3, 0x0000ab7e, 0x000013ae, + 0x0000037f, 0x000003f3, 0x00000460, 0x00000461, + 0x000104bb, 0x000104e3, 0x00002c62, 0x0000026b, + 0x00002c80, 0x00002c81, 0x00001ff2, 0x0200029e, + 0x00000407, 0x00000457, 0x00001e5c, 0x00001e5d, + 0x00001f3f, 0x00001f37, 0x000004de, 0x000004df, + 0x0000ff33, 0x0000ff53, 0x00000170, 0x00000171, + 0x00001f6d, 0x00001f65, 0x000003e6, 0x000003e7, + 0x00000415, 0x00000435, 0x00010c82, 0x00010cc2, + 0x0000a74c, 0x0000a74d, 0x0000a72e, 0x0000a72f, + 0x00002160, 0x00002170, 0x000000c8, 0x000000e8, + 0x0000abbf, 0x000013ef, 0x00001e9b, 0x00001e61, + 0x00002ca4, 0x00002ca5, 0x00010c87, 0x00010cc7, + 0x00000543, 0x00000573, 0x000010bd, 0x00002d1d, + 0x00001fa2, 0x0200022d, 0x0001041f, 0x00010447, + 0x00000044, 0x00000064, 0x0000aba2, 0x000013d2, + 0x00001e9a, 0x020001b2, 0x0000a76c, 0x0000a76d, + 0x000004ee, 0x000004ef, 0x00000130, 0x02000192, + 0x0001e910, 0x0001e932, 0x000024cf, 0x000024e9, + 0x00001edc, 0x00001edd, 0x00002c04, 0x00002c34, + 0x00001eae, 0x00001eaf, 0x0000018f, 0x00000259, + 0x00001fe6, 0x02000297, 0x00001f82, 0x020001cd, + 0x0000023b, 0x0000023c, 0x0000ab84, 0x000013b4, + 0x00001eda, 0x00001edb, 0x0001e918, 0x0001e93a, + 0x0000ab7c, 0x000013ac, 0x00000400, 0x00000450, + 0x0000041d, 0x0000043d, 0x0001e912, 0x0001e934, + 0x00001e44, 0x00001e45, 0x0001e908, 0x0001e92a, + 0x00000248, 0x00000249, 0x0000a724, 0x0000a725, + 0x00002c25, 0x00002c55, 0x000004a0, 0x000004a1, + 0x000000cf, 0x000000ef, 0x00000056, 0x00000076, + 0x00002c00, 0x00002c30, 0x00000179, 0x0000017a, + 0x000001e2, 0x000001e3, 0x000001ac, 0x000001ad, + 0x00001fba, 0x00001f70, 0x00001f96, 0x02000209, + 0x00010419, 0x00010441, 0x00000402, 0x00000452, + 0x00001f8e, 0x020001f1, 0x0000a764, 0x0000a765, + 0x0000ab8b, 0x000013bb, 0x00000419, 0x00000439, + 0x000001d9, 0x000001da, 0x00001ef8, 0x00001ef9, + 0x00002c0e, 0x00002c3e, 0x000118bc, 0x000118dc, + 0x000118a3, 0x000118c3, 0x000010ae, 0x00002d0e, + 0x000010c5, 0x00002d25, 0x00000518, 0x00000519, + 0x0000aba9, 0x000013d9, 0x0000ab77, 0x000013a7, + 0x000024cc, 0x000024e6, 0x000004bc, 0x000004bd, + 0x00000510, 0x00000511, 0x0000a650, 0x0000a651, + 0x00000405, 0x00000455, 0x00001fc6, 0x02000273, + 0x0000fb04, 0x030002be, 0x0000ab89, 0x000013b9, + 0x00000244, 0x00000289, 0x0000a682, 0x0000a683, + 0x000004e2, 0x000004e3, 0x0000040d, 0x0000045d, + 0x00001eca, 0x00001ecb, 0x0001e909, 0x0001e92b, + 0x00001e06, 0x00001e07, 0x000003a4, 0x000003c4, + 0x00000528, 0x00000529, 0x0000a694, 0x0000a695, + 0x0000ff22, 0x0000ff42, 0x00001e78, 0x00001e79, + 0x00010411, 0x00010439, 0x0000ab70, 0x000013a0, + 0x00010cb1, 0x00010cf1, 0x0000a754, 0x0000a755, + 0x0000a77b, 0x0000a77c, 0x000004e6, 0x000004e7, + 0x0000016a, 0x0000016b, 0x00001ef0, 0x00001ef1, + 0x00001fd6, 0x02000285, 0x00001ed0, 0x00001ed1, + 0x0000053d, 0x0000056d, 0x00001e2e, 0x00001e2f, + 0x000010b9, 0x00002d19, 0x000010a1, 0x00002d01, + 0x0000abaf, 0x000013df, 0x0000005a, 0x0000007a, + 0x00010c90, 0x00010cd0, 0x00001f9b, 0x02000218, + 0x00000537, 0x00000567, 0x0000a668, 0x0000a669, + 0x000001c4, 0x000001c6, 0x0000012c, 0x0000012d, + 0x000024c8, 0x000024e2, 0x00010ca5, 0x00010ce5, + 0x000118aa, 0x000118ca, 0x00002161, 0x00002171, + 0x000003ec, 0x000003ed, 0x00000370, 0x00000371, + 0x00001ec8, 0x00001ec9, 0x000004cd, 0x000004ce, + 0x00001e0e, 0x00001e0f, 0x00002c9a, 0x00002c9b, + 0x000003e4, 0x000003e5, 0x000001bc, 0x000001bd, + 0x00000182, 0x00000183, 0x00001f3c, 0x00001f34, + 0x00010401, 0x00010429, 0x000013f8, 0x000013f0, + 0x00010cb2, 0x00010cf2, 0x00002c28, 0x00002c58, + 0x00002c22, 0x00002c52, 0x000004c3, 0x000004c4, + 0x0000fb15, 0x020002ce, 0x0000ab9e, 0x000013ce, + 0x00001e4e, 0x00001e4f, 0x000004f4, 0x000004f5, + 0x00000376, 0x00000377, 0x00000492, 0x00000493, + 0x0000ff2a, 0x0000ff4a, 0x00001fb4, 0x0200025d, + 0x0000ab9b, 0x000013cb, 0x00010426, 0x0001044e, + 0x00001eb8, 0x00001eb9, 0x0000a790, 0x0000a791, + 0x0001e91c, 0x0001e93e, 0x0000052c, 0x0000052d, + 0x00000162, 0x00000163, 0x000001e0, 0x000001e1, + 0x00002c03, 0x00002c33, 0x000003a3, 0x000003c3, + 0x0000049a, 0x0000049b, 0x000003f0, 0x000003ba, + 0x00000200, 0x00000201, 0x00001ff4, 0x020002a4, + 0x00010422, 0x0001044a, 0x0000ab90, 0x000013c0, + 0x00002ccc, 0x00002ccd, 0x00002cd2, 0x00002cd3, + 0x0000a642, 0x0000a643, 0x00001e86, 0x00001e87, + 0x000010be, 0x00002d1e, 0x00001f6c, 0x00001f64, + 0x0000fb05, 0x020002c2, 0x0000ff2c, 0x0000ff4c, + 0x00010414, 0x0001043c, 0x00001e1e, 0x00001e1f, + 0x00002c84, 0x00002c85, 0x00002c6d, 0x00000251, + 0x000000d6, 0x000000f6, 0x000000d2, 0x000000f2, + 0x00000214, 0x00000215, 0x000118b5, 0x000118d5, + 0x000003c2, 0x000003c3, 0x00001e5a, 0x00001e5b, + 0x00002cb2, 0x00002cb3, 0x000010a5, 0x00002d05, + 0x0000042b, 0x0000044b, 0x00000045, 0x00000065, + 0x00001f4d, 0x00001f45, 0x00000394, 0x000003b4, + 0x00000554, 0x00000584, 0x00002c69, 0x00002c6a, + 0x0000a77d, 0x00001d79, 0x00000116, 0x00000117, + 0x0000022a, 0x0000022b, 0x00001e20, 0x00001e21, + 0x00000410, 0x00000430, 0x0001e907, 0x0001e929, + 0x000104b4, 0x000104dc, 0x00001fb7, 0x03000263, + 0x00000526, 0x00000527, 0x000000d5, 0x000000f5, + 0x0000004c, 0x0000006c, 0x00001e8a, 0x00001e8b, + 0x00000468, 0x00000469, 0x0001040a, 0x00010432, + 0x0000a662, 0x0000a663, 0x0000a656, 0x0000a657, + 0x000003e8, 0x000003e9, 0x0000004b, 0x0000006b, + 0x00002ce2, 0x00002ce3, 0x00001fd8, 0x00001fd0, + 0x0000a762, 0x0000a763, 0x00000532, 0x00000562, + 0x00010416, 0x0001043e, 0x000000ce, 0x000000ee, + 0x000024c6, 0x000024e0, 0x00001ea6, 0x00001ea7, + 0x00002c2c, 0x00002c5c, 0x0000ff28, 0x0000ff48, + 0x0000ff34, 0x0000ff54, 0x00001fa6, 0x02000239, + 0x00001f9d, 0x0200021e, 0x00000048, 0x00000068, + 0x0000aba4, 0x000013d4, 0x00001e18, 0x00001e19, + 0x0000053b, 0x0000056b, 0x00000502, 0x00000503, + 0x0000010e, 0x0000010f, 0x000001c5, 0x000001c6, + 0x000003a1, 0x000003c1, 0x00000181, 0x00000253, + 0x000118bd, 0x000118dd, 0x00001e14, 0x00001e15, + 0x000001fe, 0x000001ff, 0x00000466, 0x00000467, + 0x00001fca, 0x00001f74, 0x00001f8b, 0x020001e8, + 0x0000a78b, 0x0000a78c, 0x000003da, 0x000003db, + 0x00010c97, 0x00010cd7, 0x00000538, 0x00000568, + 0x0000016c, 0x0000016d, 0x00002c0a, 0x00002c3a, + 0x000013fd, 0x000013f5, 0x00001f0b, 0x00001f03, + 0x0000051a, 0x0000051b, 0x0000a74a, 0x0000a74b, + 0x0000a722, 0x0000a723, 0x000118a0, 0x000118c0, + 0x000104c3, 0x000104eb, 0x000000ca, 0x000000ea, + 0x000001cd, 0x000001ce, 0x0000ab82, 0x000013b2, + 0x000004e0, 0x000004e1, 0x00002c98, 0x00002c99, + 0x000001f7, 0x000001bf, 0x000004b4, 0x000004b5, + 0x0000fb00, 0x020002b1, 0x000000c9, 0x000000e9, + 0x000003d5, 0x000003c6, 0x00010c8f, 0x00010ccf, + 0x0000a766, 0x0000a767, 0x0000ab92, 0x000013c2, + 0x00000124, 0x00000125, 0x00000108, 0x00000109, + 0x00001e58, 0x00001e59, 0x00002caa, 0x00002cab, + 0x00010cac, 0x00010cec, 0x00000424, 0x00000444, + 0x000001f2, 0x000001f3, 0x000000b5, 0x000003bc, + 0x00010c8e, 0x00010cce, 0x0000abad, 0x000013dd, + 0x000000cd, 0x000000ed, 0x00001e48, 0x00001e49, + 0x0000a7aa, 0x00000266, 0x000003d0, 0x000003b2, + 0x0000a654, 0x0000a655, 0x000010a2, 0x00002d02, + 0x00001feb, 0x00001f7b, 0x00001f0a, 0x00001f02, + 0x0000ab86, 0x000013b6, 0x0000a73e, 0x0000a73f, + 0x0000023a, 0x00002c65, 0x00002cae, 0x00002caf, + 0x00000390, 0x0300019b, 0x000000c0, 0x000000e0, + 0x00001e6e, 0x00001e6f, 0x00001fcb, 0x00001f75, + 0x000004d2, 0x000004d3, 0x000003ff, 0x0000037d, + 0x00000398, 0x000003b8, 0x0000a65a, 0x0000a65b, + 0x00001f80, 0x020001c7, 0x00010413, 0x0001043b, + 0x00000059, 0x00000079, 0x00001c86, 0x0000044a, + 0x0000a7b1, 0x00000287, 0x000001e4, 0x000001e5, + 0x000004d6, 0x000004d7, 0x00000100, 0x00000101, + 0x000000d8, 0x000000f8, 0x00010caa, 0x00010cea, + 0x000118af, 0x000118cf, 0x0000aba6, 0x000013d6, + 0x000001b1, 0x0000028a, 0x00000055, 0x00000075, + 0x00001ebe, 0x00001ebf, 0x0000abaa, 0x000013da, + 0x0000abb6, 0x000013e6, 0x000024c4, 0x000024de, + 0x0000a7a0, 0x0000a7a1, 0x000004a6, 0x000004a7, + 0x0000a64c, 0x0000a64d, 0x00000193, 0x00000260, + 0x00001f3b, 0x00001f33, 0x000003f4, 0x000003b8, + 0x000004ea, 0x000004eb, 0x0000039f, 0x000003bf, + 0x00010405, 0x0001042d, 0x000004ba, 0x000004bb, + 0x00001fc3, 0x0200026d, 0x00002c10, 0x00002c40, + 0x00001c80, 0x00000432, 0x00001f1d, 0x00001f15, + 0x00000587, 0x020001a3, 0x0000054d, 0x0000057d, + 0x00010c9e, 0x00010cde, 0x0000ff2f, 0x0000ff4f, + 0x00001fa5, 0x02000236, 0x00001fab, 0x02000248, + 0x00010c85, 0x00010cc5, 0x000104d0, 0x000104f8, + 0x00000408, 0x00000458, 0x0000040f, 0x0000045f, + 0x000003d6, 0x000003c0, 0x00010402, 0x0001042a, + 0x00001c85, 0x00000442, 0x0000021c, 0x0000021d, + 0x000118ad, 0x000118cd, 0x00001eba, 0x00001ebb, + 0x000003de, 0x000003df, 0x0000018a, 0x00000257, + 0x00001fb8, 0x00001fb0, 0x00002cb8, 0x00002cb9, + 0x0001040b, 0x00010433, 0x00001ee4, 0x00001ee5, + 0x00002c6e, 0x00000271, 0x0000ab88, 0x000013b8, + 0x0000051c, 0x0000051d, 0x00010409, 0x00010431, + 0x0000a686, 0x0000a687, 0x00001f6a, 0x00001f62, + 0x000118a7, 0x000118c7, 0x0000216e, 0x0000217e, + 0x0000021e, 0x0000021f, 0x00001f8c, 0x020001eb, + 0x000104c1, 0x000104e9, 0x0000ab93, 0x000013c3, + 0x0000abb5, 0x000013e5, 0x00000143, 0x00000144, + 0x00001e7e, 0x00001e7f, 0x00000552, 0x00000582, + 0x00000545, 0x00000575, 0x00000178, 0x000000ff, + 0x00000226, 0x00000227, 0x0000039a, 0x000003ba, + 0x0000020c, 0x0000020d, 0x00010c93, 0x00010cd3, + 0x0000a74e, 0x0000a74f, 0x0000a734, 0x0000a735, + 0x000004b6, 0x000004b7, 0x000104cb, 0x000104f3, + 0x0000ff2e, 0x0000ff4e, 0x00001ed4, 0x00001ed5, + 0x0000053f, 0x0000056f, 0x0000041f, 0x0000043f, + 0x00000395, 0x000003b5, 0x00010c98, 0x00010cd8, + 0x000010a9, 0x00002d09, 0x0000abb1, 0x000013e1, + 0x0000ab78, 0x000013a8, 0x0000a78d, 0x00000265, + 0x0000a796, 0x0000a797, 0x00001e76, 0x00001e77, + 0x0000041c, 0x0000043c, 0x0001e914, 0x0001e936, + 0x0000010c, 0x0000010d, 0x00001f18, 0x00001f10, + 0x0001e904, 0x0001e926, 0x00002162, 0x00002172, + 0x000003ea, 0x000003eb, 0x000001f4, 0x000001f5, + 0x00000536, 0x00000566, 0x00001f95, 0x02000206, + 0x00010412, 0x0001043a, 0x00001ea2, 0x00001ea3, + 0x00001ee0, 0x00001ee1, 0x0000024c, 0x0000024d, + 0x0000ff37, 0x0000ff57, 0x0000ff2b, 0x0000ff4b, + 0x00001f6f, 0x00001f67, 0x0000039d, 0x000003bd, + 0x000001a2, 0x000001a3, 0x0000a680, 0x0000a681, + 0x0000a740, 0x0000a741, 0x00002c1a, 0x00002c4a, + 0x0000ab7f, 0x000013af, 0x000000dc, 0x000000fc, + 0x000000da, 0x000000fa, 0x0000004d, 0x0000006d, + 0x00000520, 0x00000521, 0x0000ab7d, 0x000013ad, + 0x00000541, 0x00000571, 0x000001ee, 0x000001ef, + 0x000010af, 0x00002d0f, 0x00001fc9, 0x00001f73, + 0x00010421, 0x00010449, 0x000003a8, 0x000003c8, + 0x00002cf2, 0x00002cf3, 0x0000054a, 0x0000057a, + 0x00002c24, 0x00002c54, 0x0000012a, 0x0000012b, + 0x0000fb14, 0x020002cb, 0x00001fd7, 0x03000288, + 0x0000046a, 0x0000046b, 0x000004a4, 0x000004a5, + 0x00010c8c, 0x00010ccc, 0x000001fc, 0x000001fd, + 0x000010ba, 0x00002d1a, 0x00001f49, 0x00001f41, + 0x0000abbe, 0x000013ee, 0x0000a758, 0x0000a759, + 0x00001e5e, 0x00001e5f, 0x00002cb4, 0x00002cb5, + 0x0000ff24, 0x0000ff44, 0x0000016e, 0x0000016f, + 0x00000145, 0x00000146, 0x00001f38, 0x00001f30, + 0x000003ab, 0x000003cb, 0x00000403, 0x00000453, + 0x0001e90b, 0x0001e92d, 0x0000a726, 0x0000a727, + 0x0000ab83, 0x000013b3, 0x000104c9, 0x000104f1, + 0x00000414, 0x00000434, 0x00001e90, 0x00001e91, + 0x00001e8c, 0x00001e8d, 0x00010c81, 0x00010cc1, + 0x000104ca, 0x000104f2, 0x000001b2, 0x0000028b, + 0x00001fa0, 0x02000227, 0x00001ec6, 0x00001ec7, + 0x000001ec, 0x000001ed, 0x0000ab9c, 0x000013cc, + 0x00001e94, 0x00001e95, 0x0000019c, 0x0000026f, + 0x00002c75, 0x00002c76, 0x00002c2d, 0x00002c5d, + 0x000001a9, 0x00000283, 0x00001e56, 0x00001e57, + 0x00001e4c, 0x00001e4d, 0x000118be, 0x000118de, + 0x000104c8, 0x000104f0, 0x0000a690, 0x0000a691, + 0x00001fb9, 0x00001fb1, 0x00001f6b, 0x00001f63, + 0x0000abab, 0x000013db, 0x000118b8, 0x000118d8, + 0x00002c02, 0x00002c32, 0x00001fcc, 0x0200027a, + 0x000104b2, 0x000104da, 0x00000112, 0x00000113, + 0x000010a4, 0x00002d04, 0x00010cab, 0x00010ceb, + 0x00010c9f, 0x00010cdf, 0x00002c19, 0x00002c49, + 0x0000024a, 0x0000024b, 0x00002c67, 0x00002c68, + 0x00010ca3, 0x00010ce3, 0x000004c7, 0x000004c8, + 0x0000abb0, 0x000013e0, 0x00001eb2, 0x00001eb3, + 0x00000372, 0x00000373, 0x00001ecc, 0x00001ecd, + 0x0000039b, 0x000003bb, 0x000003dc, 0x000003dd, + 0x00000198, 0x00000199, 0x000004cb, 0x000004cc, + 0x00000416, 0x00000436, 0x00010ca2, 0x00010ce2, + 0x0000a76e, 0x0000a76f, 0x00001f0e, 0x00001f06, + 0x00002c9e, 0x00002c9f, 0x000004e4, 0x000004e5, + 0x00000102, 0x00000103, 0x00001e28, 0x00001e29, + 0x00001e54, 0x00001e55, 0x000118a6, 0x000118c6, + 0x0000041e, 0x0000043e, 0x000001de, 0x000001df, + 0x00001fda, 0x00001f76, 0x00001faa, 0x02000245, + 0x0000ff3a, 0x0000ff5a, 0x0000abb7, 0x000013e7, + 0x00001f0c, 0x00001f04, 0x0000054b, 0x0000057b, + 0x000010a6, 0x00002d06, 0x0000a64e, 0x0000a64f, + 0x000010cd, 0x00002d2d, 0x00000399, 0x000003b9, + 0x0000fb02, 0x020002b7, 0x000104bc, 0x000104e4, + 0x00002164, 0x00002174, 0x00000206, 0x00000207, + 0x00002c1d, 0x00002c4d, 0x0000042f, 0x0000044f, + 0x000001a7, 0x000001a8, 0x000024bc, 0x000024d6, + 0x000001af, 0x000001b0, 0x00001f86, 0x020001d9, + 0x00000544, 0x00000574, 0x0000a692, 0x0000a693, + 0x0000a73c, 0x0000a73d, 0x00001f2d, 0x00001f25, + 0x00001ff7, 0x030002aa, 0x0000ab72, 0x000013a2, + 0x00010cb0, 0x00010cf0, 0x00002c21, 0x00002c51, + 0x00002c01, 0x00002c31, 0x00002c0d, 0x00002c3d, + 0x000004c9, 0x000004ca, 0x00010418, 0x00010440, + 0x00001ec4, 0x00001ec5, 0x0000aba0, 0x000013d0, + 0x00010c80, 0x00010cc0, 0x00000396, 0x000003b6, + 0x000001d1, 0x000001d2, 0x00001f99, 0x02000212, + 0x0000ab9d, 0x000013cd, 0x0000051e, 0x0000051f, + 0x000024bf, 0x000024d9, 0x00001f1b, 0x00001f13, + 0x00000464, 0x00000465, 0x0000052a, 0x0000052b, + 0x00000136, 0x00000137, 0x00001f2a, 0x00001f22, + 0x00002cdc, 0x00002cdd, 0x0001e913, 0x0001e935, + 0x0000216c, 0x0000217c, 0x00001f56, 0x030001c3, + 0x00001c84, 0x00000442, 0x00001ffc, 0x020002ae, + 0x0000aba7, 0x000013d7, 0x0000abbb, 0x000013eb, + 0x00001e08, 0x00001e09, 0x00001e24, 0x00001e25, + 0x00000553, 0x00000583, 0x0000a688, 0x0000a689, + 0x000010b6, 0x00002d16, 0x00001f6e, 0x00001f66, + 0x00001f5f, 0x00001f57, 0x0000a7b0, 0x0000029e, + 0x00010c8d, 0x00010ccd, 0x0000023d, 0x0000019a, + 0x00001f94, 0x02000203, 0x000003aa, 0x000003ca, + 0x000104cd, 0x000104f5, 0x00010c88, 0x00010cc8, + 0x00002c8e, 0x00002c8f, 0x000118b3, 0x000118d3, + 0x0000024e, 0x0000024f, 0x00001f08, 0x00001f00, + 0x000010c3, 0x00002d23, 0x000010ad, 0x00002d0d, + 0x00000429, 0x00000449, 0x00010c9c, 0x00010cdc, + 0x00002c86, 0x00002c87, 0x00002c64, 0x0000027d, + 0x00002ce0, 0x00002ce1, 0x0001e91d, 0x0001e93f, + 0x0000a65e, 0x0000a65f, 0x00000134, 0x00000135, + 0x00001f8f, 0x020001f4, 0x0000ab76, 0x000013a6, + 0x0000038e, 0x000003cd, 0x00001e64, 0x00001e65, + 0x00002cca, 0x00002ccb, 0x00001ff9, 0x00001f79, + 0x0000013f, 0x00000140, 0x00001e00, 0x00001e01, + 0x000024c7, 0x000024e1, 0x00000212, 0x00000213, + 0x00000551, 0x00000581, 0x0000ff35, 0x0000ff55, + 0x00000154, 0x00000155, 0x0000015e, 0x0000015f, + 0x000004da, 0x000004db, 0x00000391, 0x000003b1, + 0x000003a7, 0x000003c7, 0x0000a748, 0x0000a749, + 0x0000216f, 0x0000217f, 0x000004a8, 0x000004a9, + 0x00010410, 0x00010438, 0x000000d0, 0x000000f0, + 0x000003d1, 0x000003b8, 0x00002c0f, 0x00002c3f, + 0x00002183, 0x00002184, 0x00010c96, 0x00010cd6, + 0x000010b5, 0x00002d15, 0x000010aa, 0x00002d0a, + 0x00001ff6, 0x020002a7, 0x0000ab73, 0x000013a3, + 0x00000164, 0x00000165, 0x0000a786, 0x0000a787, + 0x00000422, 0x00000442, 0x000001db, 0x000001dc, + 0x000013fc, 0x000013f4, 0x00000110, 0x00000111, + 0x000001cf, 0x000001d0, 0x00001ea8, 0x00001ea9, + 0x000118bf, 0x000118df, 0x0000a646, 0x0000a647, + 0x00001fd3, 0x03000281, 0x000004fa, 0x000004fb, + 0x00000474, 0x00000475, 0x000118b2, 0x000118d2, + 0x000024bb, 0x000024d5, 0x000024bd, 0x000024d7, + 0x00000516, 0x00000517, 0x0000abbc, 0x000013ec, + 0x0000a65c, 0x0000a65d, 0x00002c1b, 0x00002c4b, + 0x00001f50, 0x020001b8 +}; -static const unsigned int _uccase_map[] = { - 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, - 0x0000023a, 0x00002c65, 0x0000023a, - 0x0000023b, 0x0000023c, 0x0000023b, - 0x0000023d, 0x0000019a, 0x0000023d, - 0x0000023e, 0x00002c66, 0x0000023e, - 0x00000241, 0x00000242, 0x00000241, - 0x00000243, 0x00000180, 0x00000243, - 0x00000244, 0x00000289, 0x00000244, - 0x00000245, 0x0000028c, 0x00000245, - 0x00000246, 0x00000247, 0x00000246, - 0x00000248, 0x00000249, 0x00000248, - 0x0000024a, 0x0000024b, 0x0000024a, - 0x0000024c, 0x0000024d, 0x0000024c, - 0x0000024e, 0x0000024f, 0x0000024e, - 0x00000370, 0x00000371, 0x00000370, - 0x00000372, 0x00000373, 0x00000372, - 0x00000376, 0x00000377, 0x00000376, - 0x0000037f, 0x000003f3, 0x0000037f, - 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, - 0x000003cf, 0x000003d7, 0x000003cf, - 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, - 0x000003f7, 0x000003f8, 0x000003f7, - 0x000003f9, 0x000003f2, 0x000003f9, - 0x000003fa, 0x000003fb, 0x000003fa, - 0x000003fd, 0x0000037b, 0x000003fd, - 0x000003fe, 0x0000037c, 0x000003fe, - 0x000003ff, 0x0000037d, 0x000003ff, - 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, - 0x000004c0, 0x000004cf, 0x000004c0, - 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, - 0x000004f6, 0x000004f7, 0x000004f6, - 0x000004f8, 0x000004f9, 0x000004f8, - 0x000004fa, 0x000004fb, 0x000004fa, - 0x000004fc, 0x000004fd, 0x000004fc, - 0x000004fe, 0x000004ff, 0x000004fe, - 0x00000500, 0x00000501, 0x00000500, - 0x00000502, 0x00000503, 0x00000502, - 0x00000504, 0x00000505, 0x00000504, - 0x00000506, 0x00000507, 0x00000506, - 0x00000508, 0x00000509, 0x00000508, - 0x0000050a, 0x0000050b, 0x0000050a, - 0x0000050c, 0x0000050d, 0x0000050c, - 0x0000050e, 0x0000050f, 0x0000050e, - 0x00000510, 0x00000511, 0x00000510, - 0x00000512, 0x00000513, 0x00000512, - 0x00000514, 0x00000515, 0x00000514, - 0x00000516, 0x00000517, 0x00000516, - 0x00000518, 0x00000519, 0x00000518, - 0x0000051a, 0x0000051b, 0x0000051a, - 0x0000051c, 0x0000051d, 0x0000051c, - 0x0000051e, 0x0000051f, 0x0000051e, - 0x00000520, 0x00000521, 0x00000520, - 0x00000522, 0x00000523, 0x00000522, - 0x00000524, 0x00000525, 0x00000524, - 0x00000526, 0x00000527, 0x00000526, - 0x00000528, 0x00000529, 0x00000528, - 0x0000052a, 0x0000052b, 0x0000052a, - 0x0000052c, 0x0000052d, 0x0000052c, - 0x0000052e, 0x0000052f, 0x0000052e, - 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, - 0x000010a0, 0x00002d00, 0x000010a0, - 0x000010a1, 0x00002d01, 0x000010a1, - 0x000010a2, 0x00002d02, 0x000010a2, - 0x000010a3, 0x00002d03, 0x000010a3, - 0x000010a4, 0x00002d04, 0x000010a4, - 0x000010a5, 0x00002d05, 0x000010a5, - 0x000010a6, 0x00002d06, 0x000010a6, - 0x000010a7, 0x00002d07, 0x000010a7, - 0x000010a8, 0x00002d08, 0x000010a8, - 0x000010a9, 0x00002d09, 0x000010a9, - 0x000010aa, 0x00002d0a, 0x000010aa, - 0x000010ab, 0x00002d0b, 0x000010ab, - 0x000010ac, 0x00002d0c, 0x000010ac, - 0x000010ad, 0x00002d0d, 0x000010ad, - 0x000010ae, 0x00002d0e, 0x000010ae, - 0x000010af, 0x00002d0f, 0x000010af, - 0x000010b0, 0x00002d10, 0x000010b0, - 0x000010b1, 0x00002d11, 0x000010b1, - 0x000010b2, 0x00002d12, 0x000010b2, - 0x000010b3, 0x00002d13, 0x000010b3, - 0x000010b4, 0x00002d14, 0x000010b4, - 0x000010b5, 0x00002d15, 0x000010b5, - 0x000010b6, 0x00002d16, 0x000010b6, - 0x000010b7, 0x00002d17, 0x000010b7, - 0x000010b8, 0x00002d18, 0x000010b8, - 0x000010b9, 0x00002d19, 0x000010b9, - 0x000010ba, 0x00002d1a, 0x000010ba, - 0x000010bb, 0x00002d1b, 0x000010bb, - 0x000010bc, 0x00002d1c, 0x000010bc, - 0x000010bd, 0x00002d1d, 0x000010bd, - 0x000010be, 0x00002d1e, 0x000010be, - 0x000010bf, 0x00002d1f, 0x000010bf, - 0x000010c0, 0x00002d20, 0x000010c0, - 0x000010c1, 0x00002d21, 0x000010c1, - 0x000010c2, 0x00002d22, 0x000010c2, - 0x000010c3, 0x00002d23, 0x000010c3, - 0x000010c4, 0x00002d24, 0x000010c4, - 0x000010c5, 0x00002d25, 0x000010c5, - 0x000010c7, 0x00002d27, 0x000010c7, - 0x000010cd, 0x00002d2d, 0x000010cd, - 0x000013a0, 0x0000ab70, 0x000013a0, - 0x000013a1, 0x0000ab71, 0x000013a1, - 0x000013a2, 0x0000ab72, 0x000013a2, - 0x000013a3, 0x0000ab73, 0x000013a3, - 0x000013a4, 0x0000ab74, 0x000013a4, - 0x000013a5, 0x0000ab75, 0x000013a5, - 0x000013a6, 0x0000ab76, 0x000013a6, - 0x000013a7, 0x0000ab77, 0x000013a7, - 0x000013a8, 0x0000ab78, 0x000013a8, - 0x000013a9, 0x0000ab79, 0x000013a9, - 0x000013aa, 0x0000ab7a, 0x000013aa, - 0x000013ab, 0x0000ab7b, 0x000013ab, - 0x000013ac, 0x0000ab7c, 0x000013ac, - 0x000013ad, 0x0000ab7d, 0x000013ad, - 0x000013ae, 0x0000ab7e, 0x000013ae, - 0x000013af, 0x0000ab7f, 0x000013af, - 0x000013b0, 0x0000ab80, 0x000013b0, - 0x000013b1, 0x0000ab81, 0x000013b1, - 0x000013b2, 0x0000ab82, 0x000013b2, - 0x000013b3, 0x0000ab83, 0x000013b3, - 0x000013b4, 0x0000ab84, 0x000013b4, - 0x000013b5, 0x0000ab85, 0x000013b5, - 0x000013b6, 0x0000ab86, 0x000013b6, - 0x000013b7, 0x0000ab87, 0x000013b7, - 0x000013b8, 0x0000ab88, 0x000013b8, - 0x000013b9, 0x0000ab89, 0x000013b9, - 0x000013ba, 0x0000ab8a, 0x000013ba, - 0x000013bb, 0x0000ab8b, 0x000013bb, - 0x000013bc, 0x0000ab8c, 0x000013bc, - 0x000013bd, 0x0000ab8d, 0x000013bd, - 0x000013be, 0x0000ab8e, 0x000013be, - 0x000013bf, 0x0000ab8f, 0x000013bf, - 0x000013c0, 0x0000ab90, 0x000013c0, - 0x000013c1, 0x0000ab91, 0x000013c1, - 0x000013c2, 0x0000ab92, 0x000013c2, - 0x000013c3, 0x0000ab93, 0x000013c3, - 0x000013c4, 0x0000ab94, 0x000013c4, - 0x000013c5, 0x0000ab95, 0x000013c5, - 0x000013c6, 0x0000ab96, 0x000013c6, - 0x000013c7, 0x0000ab97, 0x000013c7, - 0x000013c8, 0x0000ab98, 0x000013c8, - 0x000013c9, 0x0000ab99, 0x000013c9, - 0x000013ca, 0x0000ab9a, 0x000013ca, - 0x000013cb, 0x0000ab9b, 0x000013cb, - 0x000013cc, 0x0000ab9c, 0x000013cc, - 0x000013cd, 0x0000ab9d, 0x000013cd, - 0x000013ce, 0x0000ab9e, 0x000013ce, - 0x000013cf, 0x0000ab9f, 0x000013cf, - 0x000013d0, 0x0000aba0, 0x000013d0, - 0x000013d1, 0x0000aba1, 0x000013d1, - 0x000013d2, 0x0000aba2, 0x000013d2, - 0x000013d3, 0x0000aba3, 0x000013d3, - 0x000013d4, 0x0000aba4, 0x000013d4, - 0x000013d5, 0x0000aba5, 0x000013d5, - 0x000013d6, 0x0000aba6, 0x000013d6, - 0x000013d7, 0x0000aba7, 0x000013d7, - 0x000013d8, 0x0000aba8, 0x000013d8, - 0x000013d9, 0x0000aba9, 0x000013d9, - 0x000013da, 0x0000abaa, 0x000013da, - 0x000013db, 0x0000abab, 0x000013db, - 0x000013dc, 0x0000abac, 0x000013dc, - 0x000013dd, 0x0000abad, 0x000013dd, - 0x000013de, 0x0000abae, 0x000013de, - 0x000013df, 0x0000abaf, 0x000013df, - 0x000013e0, 0x0000abb0, 0x000013e0, - 0x000013e1, 0x0000abb1, 0x000013e1, - 0x000013e2, 0x0000abb2, 0x000013e2, - 0x000013e3, 0x0000abb3, 0x000013e3, - 0x000013e4, 0x0000abb4, 0x000013e4, - 0x000013e5, 0x0000abb5, 0x000013e5, - 0x000013e6, 0x0000abb6, 0x000013e6, - 0x000013e7, 0x0000abb7, 0x000013e7, - 0x000013e8, 0x0000abb8, 0x000013e8, - 0x000013e9, 0x0000abb9, 0x000013e9, - 0x000013ea, 0x0000abba, 0x000013ea, - 0x000013eb, 0x0000abbb, 0x000013eb, - 0x000013ec, 0x0000abbc, 0x000013ec, - 0x000013ed, 0x0000abbd, 0x000013ed, - 0x000013ee, 0x0000abbe, 0x000013ee, - 0x000013ef, 0x0000abbf, 0x000013ef, - 0x000013f0, 0x000013f8, 0x000013f0, - 0x000013f1, 0x000013f9, 0x000013f1, - 0x000013f2, 0x000013fa, 0x000013f2, - 0x000013f3, 0x000013fb, 0x000013f3, - 0x000013f4, 0x000013fc, 0x000013f4, - 0x000013f5, 0x000013fd, 0x000013f5, - 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, - 0x00001e9e, 0x000000df, 0x00001e9e, - 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, - 0x00001efa, 0x00001efb, 0x00001efa, - 0x00001efc, 0x00001efd, 0x00001efc, - 0x00001efe, 0x00001eff, 0x00001efe, - 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, - 0x00001fb8, 0x00001fb0, 0x00001fb8, - 0x00001fb9, 0x00001fb1, 0x00001fb9, - 0x00001fba, 0x00001f70, 0x00001fba, - 0x00001fbb, 0x00001f71, 0x00001fbb, - 0x00001fc8, 0x00001f72, 0x00001fc8, - 0x00001fc9, 0x00001f73, 0x00001fc9, - 0x00001fca, 0x00001f74, 0x00001fca, - 0x00001fcb, 0x00001f75, 0x00001fcb, - 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, - 0x00002126, 0x000003c9, 0x00002126, - 0x0000212a, 0x0000006b, 0x0000212a, - 0x0000212b, 0x000000e5, 0x0000212b, - 0x00002132, 0x0000214e, 0x00002132, - 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, - 0x00002183, 0x00002184, 0x00002183, - 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, - 0x00002c00, 0x00002c30, 0x00002c00, - 0x00002c01, 0x00002c31, 0x00002c01, - 0x00002c02, 0x00002c32, 0x00002c02, - 0x00002c03, 0x00002c33, 0x00002c03, - 0x00002c04, 0x00002c34, 0x00002c04, - 0x00002c05, 0x00002c35, 0x00002c05, - 0x00002c06, 0x00002c36, 0x00002c06, - 0x00002c07, 0x00002c37, 0x00002c07, - 0x00002c08, 0x00002c38, 0x00002c08, - 0x00002c09, 0x00002c39, 0x00002c09, - 0x00002c0a, 0x00002c3a, 0x00002c0a, - 0x00002c0b, 0x00002c3b, 0x00002c0b, - 0x00002c0c, 0x00002c3c, 0x00002c0c, - 0x00002c0d, 0x00002c3d, 0x00002c0d, - 0x00002c0e, 0x00002c3e, 0x00002c0e, - 0x00002c0f, 0x00002c3f, 0x00002c0f, - 0x00002c10, 0x00002c40, 0x00002c10, - 0x00002c11, 0x00002c41, 0x00002c11, - 0x00002c12, 0x00002c42, 0x00002c12, - 0x00002c13, 0x00002c43, 0x00002c13, - 0x00002c14, 0x00002c44, 0x00002c14, - 0x00002c15, 0x00002c45, 0x00002c15, - 0x00002c16, 0x00002c46, 0x00002c16, - 0x00002c17, 0x00002c47, 0x00002c17, - 0x00002c18, 0x00002c48, 0x00002c18, - 0x00002c19, 0x00002c49, 0x00002c19, - 0x00002c1a, 0x00002c4a, 0x00002c1a, - 0x00002c1b, 0x00002c4b, 0x00002c1b, - 0x00002c1c, 0x00002c4c, 0x00002c1c, - 0x00002c1d, 0x00002c4d, 0x00002c1d, - 0x00002c1e, 0x00002c4e, 0x00002c1e, - 0x00002c1f, 0x00002c4f, 0x00002c1f, - 0x00002c20, 0x00002c50, 0x00002c20, - 0x00002c21, 0x00002c51, 0x00002c21, - 0x00002c22, 0x00002c52, 0x00002c22, - 0x00002c23, 0x00002c53, 0x00002c23, - 0x00002c24, 0x00002c54, 0x00002c24, - 0x00002c25, 0x00002c55, 0x00002c25, - 0x00002c26, 0x00002c56, 0x00002c26, - 0x00002c27, 0x00002c57, 0x00002c27, - 0x00002c28, 0x00002c58, 0x00002c28, - 0x00002c29, 0x00002c59, 0x00002c29, - 0x00002c2a, 0x00002c5a, 0x00002c2a, - 0x00002c2b, 0x00002c5b, 0x00002c2b, - 0x00002c2c, 0x00002c5c, 0x00002c2c, - 0x00002c2d, 0x00002c5d, 0x00002c2d, - 0x00002c2e, 0x00002c5e, 0x00002c2e, - 0x00002c60, 0x00002c61, 0x00002c60, - 0x00002c62, 0x0000026b, 0x00002c62, - 0x00002c63, 0x00001d7d, 0x00002c63, - 0x00002c64, 0x0000027d, 0x00002c64, - 0x00002c67, 0x00002c68, 0x00002c67, - 0x00002c69, 0x00002c6a, 0x00002c69, - 0x00002c6b, 0x00002c6c, 0x00002c6b, - 0x00002c6d, 0x00000251, 0x00002c6d, - 0x00002c6e, 0x00000271, 0x00002c6e, - 0x00002c6f, 0x00000250, 0x00002c6f, - 0x00002c70, 0x00000252, 0x00002c70, - 0x00002c72, 0x00002c73, 0x00002c72, - 0x00002c75, 0x00002c76, 0x00002c75, - 0x00002c7e, 0x0000023f, 0x00002c7e, - 0x00002c7f, 0x00000240, 0x00002c7f, - 0x00002c80, 0x00002c81, 0x00002c80, - 0x00002c82, 0x00002c83, 0x00002c82, - 0x00002c84, 0x00002c85, 0x00002c84, - 0x00002c86, 0x00002c87, 0x00002c86, - 0x00002c88, 0x00002c89, 0x00002c88, - 0x00002c8a, 0x00002c8b, 0x00002c8a, - 0x00002c8c, 0x00002c8d, 0x00002c8c, - 0x00002c8e, 0x00002c8f, 0x00002c8e, - 0x00002c90, 0x00002c91, 0x00002c90, - 0x00002c92, 0x00002c93, 0x00002c92, - 0x00002c94, 0x00002c95, 0x00002c94, - 0x00002c96, 0x00002c97, 0x00002c96, - 0x00002c98, 0x00002c99, 0x00002c98, - 0x00002c9a, 0x00002c9b, 0x00002c9a, - 0x00002c9c, 0x00002c9d, 0x00002c9c, - 0x00002c9e, 0x00002c9f, 0x00002c9e, - 0x00002ca0, 0x00002ca1, 0x00002ca0, - 0x00002ca2, 0x00002ca3, 0x00002ca2, - 0x00002ca4, 0x00002ca5, 0x00002ca4, - 0x00002ca6, 0x00002ca7, 0x00002ca6, - 0x00002ca8, 0x00002ca9, 0x00002ca8, - 0x00002caa, 0x00002cab, 0x00002caa, - 0x00002cac, 0x00002cad, 0x00002cac, - 0x00002cae, 0x00002caf, 0x00002cae, - 0x00002cb0, 0x00002cb1, 0x00002cb0, - 0x00002cb2, 0x00002cb3, 0x00002cb2, - 0x00002cb4, 0x00002cb5, 0x00002cb4, - 0x00002cb6, 0x00002cb7, 0x00002cb6, - 0x00002cb8, 0x00002cb9, 0x00002cb8, - 0x00002cba, 0x00002cbb, 0x00002cba, - 0x00002cbc, 0x00002cbd, 0x00002cbc, - 0x00002cbe, 0x00002cbf, 0x00002cbe, - 0x00002cc0, 0x00002cc1, 0x00002cc0, - 0x00002cc2, 0x00002cc3, 0x00002cc2, - 0x00002cc4, 0x00002cc5, 0x00002cc4, - 0x00002cc6, 0x00002cc7, 0x00002cc6, - 0x00002cc8, 0x00002cc9, 0x00002cc8, - 0x00002cca, 0x00002ccb, 0x00002cca, - 0x00002ccc, 0x00002ccd, 0x00002ccc, - 0x00002cce, 0x00002ccf, 0x00002cce, - 0x00002cd0, 0x00002cd1, 0x00002cd0, - 0x00002cd2, 0x00002cd3, 0x00002cd2, - 0x00002cd4, 0x00002cd5, 0x00002cd4, - 0x00002cd6, 0x00002cd7, 0x00002cd6, - 0x00002cd8, 0x00002cd9, 0x00002cd8, - 0x00002cda, 0x00002cdb, 0x00002cda, - 0x00002cdc, 0x00002cdd, 0x00002cdc, - 0x00002cde, 0x00002cdf, 0x00002cde, - 0x00002ce0, 0x00002ce1, 0x00002ce0, - 0x00002ce2, 0x00002ce3, 0x00002ce2, - 0x00002ceb, 0x00002cec, 0x00002ceb, - 0x00002ced, 0x00002cee, 0x00002ced, - 0x00002cf2, 0x00002cf3, 0x00002cf2, - 0x0000a640, 0x0000a641, 0x0000a640, - 0x0000a642, 0x0000a643, 0x0000a642, - 0x0000a644, 0x0000a645, 0x0000a644, - 0x0000a646, 0x0000a647, 0x0000a646, - 0x0000a648, 0x0000a649, 0x0000a648, - 0x0000a64a, 0x0000a64b, 0x0000a64a, - 0x0000a64c, 0x0000a64d, 0x0000a64c, - 0x0000a64e, 0x0000a64f, 0x0000a64e, - 0x0000a650, 0x0000a651, 0x0000a650, - 0x0000a652, 0x0000a653, 0x0000a652, - 0x0000a654, 0x0000a655, 0x0000a654, - 0x0000a656, 0x0000a657, 0x0000a656, - 0x0000a658, 0x0000a659, 0x0000a658, - 0x0000a65a, 0x0000a65b, 0x0000a65a, - 0x0000a65c, 0x0000a65d, 0x0000a65c, - 0x0000a65e, 0x0000a65f, 0x0000a65e, - 0x0000a660, 0x0000a661, 0x0000a660, - 0x0000a662, 0x0000a663, 0x0000a662, - 0x0000a664, 0x0000a665, 0x0000a664, - 0x0000a666, 0x0000a667, 0x0000a666, - 0x0000a668, 0x0000a669, 0x0000a668, - 0x0000a66a, 0x0000a66b, 0x0000a66a, - 0x0000a66c, 0x0000a66d, 0x0000a66c, - 0x0000a680, 0x0000a681, 0x0000a680, - 0x0000a682, 0x0000a683, 0x0000a682, - 0x0000a684, 0x0000a685, 0x0000a684, - 0x0000a686, 0x0000a687, 0x0000a686, - 0x0000a688, 0x0000a689, 0x0000a688, - 0x0000a68a, 0x0000a68b, 0x0000a68a, - 0x0000a68c, 0x0000a68d, 0x0000a68c, - 0x0000a68e, 0x0000a68f, 0x0000a68e, - 0x0000a690, 0x0000a691, 0x0000a690, - 0x0000a692, 0x0000a693, 0x0000a692, - 0x0000a694, 0x0000a695, 0x0000a694, - 0x0000a696, 0x0000a697, 0x0000a696, - 0x0000a698, 0x0000a699, 0x0000a698, - 0x0000a69a, 0x0000a69b, 0x0000a69a, - 0x0000a722, 0x0000a723, 0x0000a722, - 0x0000a724, 0x0000a725, 0x0000a724, - 0x0000a726, 0x0000a727, 0x0000a726, - 0x0000a728, 0x0000a729, 0x0000a728, - 0x0000a72a, 0x0000a72b, 0x0000a72a, - 0x0000a72c, 0x0000a72d, 0x0000a72c, - 0x0000a72e, 0x0000a72f, 0x0000a72e, - 0x0000a732, 0x0000a733, 0x0000a732, - 0x0000a734, 0x0000a735, 0x0000a734, - 0x0000a736, 0x0000a737, 0x0000a736, - 0x0000a738, 0x0000a739, 0x0000a738, - 0x0000a73a, 0x0000a73b, 0x0000a73a, - 0x0000a73c, 0x0000a73d, 0x0000a73c, - 0x0000a73e, 0x0000a73f, 0x0000a73e, - 0x0000a740, 0x0000a741, 0x0000a740, - 0x0000a742, 0x0000a743, 0x0000a742, - 0x0000a744, 0x0000a745, 0x0000a744, - 0x0000a746, 0x0000a747, 0x0000a746, - 0x0000a748, 0x0000a749, 0x0000a748, - 0x0000a74a, 0x0000a74b, 0x0000a74a, - 0x0000a74c, 0x0000a74d, 0x0000a74c, - 0x0000a74e, 0x0000a74f, 0x0000a74e, - 0x0000a750, 0x0000a751, 0x0000a750, - 0x0000a752, 0x0000a753, 0x0000a752, - 0x0000a754, 0x0000a755, 0x0000a754, - 0x0000a756, 0x0000a757, 0x0000a756, - 0x0000a758, 0x0000a759, 0x0000a758, - 0x0000a75a, 0x0000a75b, 0x0000a75a, - 0x0000a75c, 0x0000a75d, 0x0000a75c, - 0x0000a75e, 0x0000a75f, 0x0000a75e, - 0x0000a760, 0x0000a761, 0x0000a760, - 0x0000a762, 0x0000a763, 0x0000a762, - 0x0000a764, 0x0000a765, 0x0000a764, - 0x0000a766, 0x0000a767, 0x0000a766, - 0x0000a768, 0x0000a769, 0x0000a768, - 0x0000a76a, 0x0000a76b, 0x0000a76a, - 0x0000a76c, 0x0000a76d, 0x0000a76c, - 0x0000a76e, 0x0000a76f, 0x0000a76e, - 0x0000a779, 0x0000a77a, 0x0000a779, - 0x0000a77b, 0x0000a77c, 0x0000a77b, - 0x0000a77d, 0x00001d79, 0x0000a77d, - 0x0000a77e, 0x0000a77f, 0x0000a77e, - 0x0000a780, 0x0000a781, 0x0000a780, - 0x0000a782, 0x0000a783, 0x0000a782, - 0x0000a784, 0x0000a785, 0x0000a784, - 0x0000a786, 0x0000a787, 0x0000a786, - 0x0000a78b, 0x0000a78c, 0x0000a78b, - 0x0000a78d, 0x00000265, 0x0000a78d, - 0x0000a790, 0x0000a791, 0x0000a790, - 0x0000a792, 0x0000a793, 0x0000a792, - 0x0000a796, 0x0000a797, 0x0000a796, - 0x0000a798, 0x0000a799, 0x0000a798, - 0x0000a79a, 0x0000a79b, 0x0000a79a, - 0x0000a79c, 0x0000a79d, 0x0000a79c, - 0x0000a79e, 0x0000a79f, 0x0000a79e, - 0x0000a7a0, 0x0000a7a1, 0x0000a7a0, - 0x0000a7a2, 0x0000a7a3, 0x0000a7a2, - 0x0000a7a4, 0x0000a7a5, 0x0000a7a4, - 0x0000a7a6, 0x0000a7a7, 0x0000a7a6, - 0x0000a7a8, 0x0000a7a9, 0x0000a7a8, - 0x0000a7aa, 0x00000266, 0x0000a7aa, - 0x0000a7ab, 0x0000025c, 0x0000a7ab, - 0x0000a7ac, 0x00000261, 0x0000a7ac, - 0x0000a7ad, 0x0000026c, 0x0000a7ad, - 0x0000a7ae, 0x0000026a, 0x0000a7ae, - 0x0000a7b0, 0x0000029e, 0x0000a7b0, - 0x0000a7b1, 0x00000287, 0x0000a7b1, - 0x0000a7b2, 0x0000029d, 0x0000a7b2, - 0x0000a7b3, 0x0000ab53, 0x0000a7b3, - 0x0000a7b4, 0x0000a7b5, 0x0000a7b4, - 0x0000a7b6, 0x0000a7b7, 0x0000a7b6, - 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, - 0x00010426, 0x0001044e, 0x00010426, - 0x00010427, 0x0001044f, 0x00010427, - 0x000104b0, 0x000104d8, 0x000104b0, - 0x000104b1, 0x000104d9, 0x000104b1, - 0x000104b2, 0x000104da, 0x000104b2, - 0x000104b3, 0x000104db, 0x000104b3, - 0x000104b4, 0x000104dc, 0x000104b4, - 0x000104b5, 0x000104dd, 0x000104b5, - 0x000104b6, 0x000104de, 0x000104b6, - 0x000104b7, 0x000104df, 0x000104b7, - 0x000104b8, 0x000104e0, 0x000104b8, - 0x000104b9, 0x000104e1, 0x000104b9, - 0x000104ba, 0x000104e2, 0x000104ba, - 0x000104bb, 0x000104e3, 0x000104bb, - 0x000104bc, 0x000104e4, 0x000104bc, - 0x000104bd, 0x000104e5, 0x000104bd, - 0x000104be, 0x000104e6, 0x000104be, - 0x000104bf, 0x000104e7, 0x000104bf, - 0x000104c0, 0x000104e8, 0x000104c0, - 0x000104c1, 0x000104e9, 0x000104c1, - 0x000104c2, 0x000104ea, 0x000104c2, - 0x000104c3, 0x000104eb, 0x000104c3, - 0x000104c4, 0x000104ec, 0x000104c4, - 0x000104c5, 0x000104ed, 0x000104c5, - 0x000104c6, 0x000104ee, 0x000104c6, - 0x000104c7, 0x000104ef, 0x000104c7, - 0x000104c8, 0x000104f0, 0x000104c8, - 0x000104c9, 0x000104f1, 0x000104c9, - 0x000104ca, 0x000104f2, 0x000104ca, - 0x000104cb, 0x000104f3, 0x000104cb, - 0x000104cc, 0x000104f4, 0x000104cc, - 0x000104cd, 0x000104f5, 0x000104cd, - 0x000104ce, 0x000104f6, 0x000104ce, - 0x000104cf, 0x000104f7, 0x000104cf, - 0x000104d0, 0x000104f8, 0x000104d0, - 0x000104d1, 0x000104f9, 0x000104d1, - 0x000104d2, 0x000104fa, 0x000104d2, - 0x000104d3, 0x000104fb, 0x000104d3, - 0x00010c80, 0x00010cc0, 0x00010c80, - 0x00010c81, 0x00010cc1, 0x00010c81, - 0x00010c82, 0x00010cc2, 0x00010c82, - 0x00010c83, 0x00010cc3, 0x00010c83, - 0x00010c84, 0x00010cc4, 0x00010c84, - 0x00010c85, 0x00010cc5, 0x00010c85, - 0x00010c86, 0x00010cc6, 0x00010c86, - 0x00010c87, 0x00010cc7, 0x00010c87, - 0x00010c88, 0x00010cc8, 0x00010c88, - 0x00010c89, 0x00010cc9, 0x00010c89, - 0x00010c8a, 0x00010cca, 0x00010c8a, - 0x00010c8b, 0x00010ccb, 0x00010c8b, - 0x00010c8c, 0x00010ccc, 0x00010c8c, - 0x00010c8d, 0x00010ccd, 0x00010c8d, - 0x00010c8e, 0x00010cce, 0x00010c8e, - 0x00010c8f, 0x00010ccf, 0x00010c8f, - 0x00010c90, 0x00010cd0, 0x00010c90, - 0x00010c91, 0x00010cd1, 0x00010c91, - 0x00010c92, 0x00010cd2, 0x00010c92, - 0x00010c93, 0x00010cd3, 0x00010c93, - 0x00010c94, 0x00010cd4, 0x00010c94, - 0x00010c95, 0x00010cd5, 0x00010c95, - 0x00010c96, 0x00010cd6, 0x00010c96, - 0x00010c97, 0x00010cd7, 0x00010c97, - 0x00010c98, 0x00010cd8, 0x00010c98, - 0x00010c99, 0x00010cd9, 0x00010c99, - 0x00010c9a, 0x00010cda, 0x00010c9a, - 0x00010c9b, 0x00010cdb, 0x00010c9b, - 0x00010c9c, 0x00010cdc, 0x00010c9c, - 0x00010c9d, 0x00010cdd, 0x00010c9d, - 0x00010c9e, 0x00010cde, 0x00010c9e, - 0x00010c9f, 0x00010cdf, 0x00010c9f, - 0x00010ca0, 0x00010ce0, 0x00010ca0, - 0x00010ca1, 0x00010ce1, 0x00010ca1, - 0x00010ca2, 0x00010ce2, 0x00010ca2, - 0x00010ca3, 0x00010ce3, 0x00010ca3, - 0x00010ca4, 0x00010ce4, 0x00010ca4, - 0x00010ca5, 0x00010ce5, 0x00010ca5, - 0x00010ca6, 0x00010ce6, 0x00010ca6, - 0x00010ca7, 0x00010ce7, 0x00010ca7, - 0x00010ca8, 0x00010ce8, 0x00010ca8, - 0x00010ca9, 0x00010ce9, 0x00010ca9, - 0x00010caa, 0x00010cea, 0x00010caa, - 0x00010cab, 0x00010ceb, 0x00010cab, - 0x00010cac, 0x00010cec, 0x00010cac, - 0x00010cad, 0x00010ced, 0x00010cad, - 0x00010cae, 0x00010cee, 0x00010cae, - 0x00010caf, 0x00010cef, 0x00010caf, - 0x00010cb0, 0x00010cf0, 0x00010cb0, - 0x00010cb1, 0x00010cf1, 0x00010cb1, - 0x00010cb2, 0x00010cf2, 0x00010cb2, - 0x000118a0, 0x000118c0, 0x000118a0, - 0x000118a1, 0x000118c1, 0x000118a1, - 0x000118a2, 0x000118c2, 0x000118a2, - 0x000118a3, 0x000118c3, 0x000118a3, - 0x000118a4, 0x000118c4, 0x000118a4, - 0x000118a5, 0x000118c5, 0x000118a5, - 0x000118a6, 0x000118c6, 0x000118a6, - 0x000118a7, 0x000118c7, 0x000118a7, - 0x000118a8, 0x000118c8, 0x000118a8, - 0x000118a9, 0x000118c9, 0x000118a9, - 0x000118aa, 0x000118ca, 0x000118aa, - 0x000118ab, 0x000118cb, 0x000118ab, - 0x000118ac, 0x000118cc, 0x000118ac, - 0x000118ad, 0x000118cd, 0x000118ad, - 0x000118ae, 0x000118ce, 0x000118ae, - 0x000118af, 0x000118cf, 0x000118af, - 0x000118b0, 0x000118d0, 0x000118b0, - 0x000118b1, 0x000118d1, 0x000118b1, - 0x000118b2, 0x000118d2, 0x000118b2, - 0x000118b3, 0x000118d3, 0x000118b3, - 0x000118b4, 0x000118d4, 0x000118b4, - 0x000118b5, 0x000118d5, 0x000118b5, - 0x000118b6, 0x000118d6, 0x000118b6, - 0x000118b7, 0x000118d7, 0x000118b7, - 0x000118b8, 0x000118d8, 0x000118b8, - 0x000118b9, 0x000118d9, 0x000118b9, - 0x000118ba, 0x000118da, 0x000118ba, - 0x000118bb, 0x000118db, 0x000118bb, - 0x000118bc, 0x000118dc, 0x000118bc, - 0x000118bd, 0x000118dd, 0x000118bd, - 0x000118be, 0x000118de, 0x000118be, - 0x000118bf, 0x000118df, 0x000118bf, - 0x0001e900, 0x0001e922, 0x0001e900, - 0x0001e901, 0x0001e923, 0x0001e901, - 0x0001e902, 0x0001e924, 0x0001e902, - 0x0001e903, 0x0001e925, 0x0001e903, - 0x0001e904, 0x0001e926, 0x0001e904, - 0x0001e905, 0x0001e927, 0x0001e905, - 0x0001e906, 0x0001e928, 0x0001e906, - 0x0001e907, 0x0001e929, 0x0001e907, - 0x0001e908, 0x0001e92a, 0x0001e908, - 0x0001e909, 0x0001e92b, 0x0001e909, - 0x0001e90a, 0x0001e92c, 0x0001e90a, - 0x0001e90b, 0x0001e92d, 0x0001e90b, - 0x0001e90c, 0x0001e92e, 0x0001e90c, - 0x0001e90d, 0x0001e92f, 0x0001e90d, - 0x0001e90e, 0x0001e930, 0x0001e90e, - 0x0001e90f, 0x0001e931, 0x0001e90f, - 0x0001e910, 0x0001e932, 0x0001e910, - 0x0001e911, 0x0001e933, 0x0001e911, - 0x0001e912, 0x0001e934, 0x0001e912, - 0x0001e913, 0x0001e935, 0x0001e913, - 0x0001e914, 0x0001e936, 0x0001e914, - 0x0001e915, 0x0001e937, 0x0001e915, - 0x0001e916, 0x0001e938, 0x0001e916, - 0x0001e917, 0x0001e939, 0x0001e917, - 0x0001e918, 0x0001e93a, 0x0001e918, - 0x0001e919, 0x0001e93b, 0x0001e919, - 0x0001e91a, 0x0001e93c, 0x0001e91a, - 0x0001e91b, 0x0001e93d, 0x0001e91b, - 0x0001e91c, 0x0001e93e, 0x0001e91c, - 0x0001e91d, 0x0001e93f, 0x0001e91d, - 0x0001e91e, 0x0001e940, 0x0001e91e, - 0x0001e91f, 0x0001e941, 0x0001e91f, - 0x0001e920, 0x0001e942, 0x0001e920, - 0x0001e921, 0x0001e943, 0x0001e921, - 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, - 0x00000180, 0x00000243, 0x00000243, - 0x00000183, 0x00000182, 0x00000182, - 0x00000185, 0x00000184, 0x00000184, - 0x00000188, 0x00000187, 0x00000187, - 0x0000018c, 0x0000018b, 0x0000018b, - 0x00000192, 0x00000191, 0x00000191, - 0x00000195, 0x000001f6, 0x000001f6, - 0x00000199, 0x00000198, 0x00000198, - 0x0000019a, 0x0000023d, 0x0000023d, - 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, - 0x0000023c, 0x0000023b, 0x0000023b, - 0x0000023f, 0x00002c7e, 0x00002c7e, - 0x00000240, 0x00002c7f, 0x00002c7f, - 0x00000242, 0x00000241, 0x00000241, - 0x00000247, 0x00000246, 0x00000246, - 0x00000249, 0x00000248, 0x00000248, - 0x0000024b, 0x0000024a, 0x0000024a, - 0x0000024d, 0x0000024c, 0x0000024c, - 0x0000024f, 0x0000024e, 0x0000024e, - 0x00000250, 0x00002c6f, 0x00002c6f, - 0x00000251, 0x00002c6d, 0x00002c6d, - 0x00000252, 0x00002c70, 0x00002c70, - 0x00000253, 0x00000181, 0x00000181, - 0x00000254, 0x00000186, 0x00000186, - 0x00000256, 0x00000189, 0x00000189, - 0x00000257, 0x0000018a, 0x0000018a, - 0x00000259, 0x0000018f, 0x0000018f, - 0x0000025b, 0x00000190, 0x00000190, - 0x0000025c, 0x0000a7ab, 0x0000a7ab, - 0x00000260, 0x00000193, 0x00000193, - 0x00000261, 0x0000a7ac, 0x0000a7ac, - 0x00000263, 0x00000194, 0x00000194, - 0x00000265, 0x0000a78d, 0x0000a78d, - 0x00000266, 0x0000a7aa, 0x0000a7aa, - 0x00000268, 0x00000197, 0x00000197, - 0x00000269, 0x00000196, 0x00000196, - 0x0000026a, 0x0000a7ae, 0x0000a7ae, - 0x0000026b, 0x00002c62, 0x00002c62, - 0x0000026c, 0x0000a7ad, 0x0000a7ad, - 0x0000026f, 0x0000019c, 0x0000019c, - 0x00000271, 0x00002c6e, 0x00002c6e, - 0x00000272, 0x0000019d, 0x0000019d, - 0x00000275, 0x0000019f, 0x0000019f, - 0x0000027d, 0x00002c64, 0x00002c64, - 0x00000280, 0x000001a6, 0x000001a6, - 0x00000283, 0x000001a9, 0x000001a9, - 0x00000287, 0x0000a7b1, 0x0000a7b1, - 0x00000288, 0x000001ae, 0x000001ae, - 0x00000289, 0x00000244, 0x00000244, - 0x0000028a, 0x000001b1, 0x000001b1, - 0x0000028b, 0x000001b2, 0x000001b2, - 0x0000028c, 0x00000245, 0x00000245, - 0x00000292, 0x000001b7, 0x000001b7, - 0x0000029d, 0x0000a7b2, 0x0000a7b2, - 0x0000029e, 0x0000a7b0, 0x0000a7b0, - 0x00000345, 0x00000399, 0x00000399, - 0x00000371, 0x00000370, 0x00000370, - 0x00000373, 0x00000372, 0x00000372, - 0x00000377, 0x00000376, 0x00000376, - 0x0000037b, 0x000003fd, 0x000003fd, - 0x0000037c, 0x000003fe, 0x000003fe, - 0x0000037d, 0x000003ff, 0x000003ff, - 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, - 0x000003d7, 0x000003cf, 0x000003cf, - 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, 0x000003f9, 0x000003f9, - 0x000003f3, 0x0000037f, 0x0000037f, - 0x000003f5, 0x00000395, 0x00000395, - 0x000003f8, 0x000003f7, 0x000003f7, - 0x000003fb, 0x000003fa, 0x000003fa, - 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, - 0x000004cf, 0x000004c0, 0x000004c0, - 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, - 0x000004f7, 0x000004f6, 0x000004f6, - 0x000004f9, 0x000004f8, 0x000004f8, - 0x000004fb, 0x000004fa, 0x000004fa, - 0x000004fd, 0x000004fc, 0x000004fc, - 0x000004ff, 0x000004fe, 0x000004fe, - 0x00000501, 0x00000500, 0x00000500, - 0x00000503, 0x00000502, 0x00000502, - 0x00000505, 0x00000504, 0x00000504, - 0x00000507, 0x00000506, 0x00000506, - 0x00000509, 0x00000508, 0x00000508, - 0x0000050b, 0x0000050a, 0x0000050a, - 0x0000050d, 0x0000050c, 0x0000050c, - 0x0000050f, 0x0000050e, 0x0000050e, - 0x00000511, 0x00000510, 0x00000510, - 0x00000513, 0x00000512, 0x00000512, - 0x00000515, 0x00000514, 0x00000514, - 0x00000517, 0x00000516, 0x00000516, - 0x00000519, 0x00000518, 0x00000518, - 0x0000051b, 0x0000051a, 0x0000051a, - 0x0000051d, 0x0000051c, 0x0000051c, - 0x0000051f, 0x0000051e, 0x0000051e, - 0x00000521, 0x00000520, 0x00000520, - 0x00000523, 0x00000522, 0x00000522, - 0x00000525, 0x00000524, 0x00000524, - 0x00000527, 0x00000526, 0x00000526, - 0x00000529, 0x00000528, 0x00000528, - 0x0000052b, 0x0000052a, 0x0000052a, - 0x0000052d, 0x0000052c, 0x0000052c, - 0x0000052f, 0x0000052e, 0x0000052e, - 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, - 0x000013f8, 0x000013f0, 0x000013f0, - 0x000013f9, 0x000013f1, 0x000013f1, - 0x000013fa, 0x000013f2, 0x000013f2, - 0x000013fb, 0x000013f3, 0x000013f3, - 0x000013fc, 0x000013f4, 0x000013f4, - 0x000013fd, 0x000013f5, 0x000013f5, - 0x00001c80, 0x00000412, 0x00000412, - 0x00001c81, 0x00000414, 0x00000414, - 0x00001c82, 0x0000041e, 0x0000041e, - 0x00001c83, 0x00000421, 0x00000421, - 0x00001c84, 0x00000422, 0x00000422, - 0x00001c85, 0x00000422, 0x00000422, - 0x00001c86, 0x0000042a, 0x0000042a, - 0x00001c87, 0x00000462, 0x00000462, - 0x00001c88, 0x0000a64a, 0x0000a64a, - 0x00001d79, 0x0000a77d, 0x0000a77d, - 0x00001d7d, 0x00002c63, 0x00002c63, - 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, - 0x00001efb, 0x00001efa, 0x00001efa, - 0x00001efd, 0x00001efc, 0x00001efc, - 0x00001eff, 0x00001efe, 0x00001efe, - 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, - 0x0000214e, 0x00002132, 0x00002132, - 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, - 0x00002184, 0x00002183, 0x00002183, - 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, - 0x00002c30, 0x00002c00, 0x00002c00, - 0x00002c31, 0x00002c01, 0x00002c01, - 0x00002c32, 0x00002c02, 0x00002c02, - 0x00002c33, 0x00002c03, 0x00002c03, - 0x00002c34, 0x00002c04, 0x00002c04, - 0x00002c35, 0x00002c05, 0x00002c05, - 0x00002c36, 0x00002c06, 0x00002c06, - 0x00002c37, 0x00002c07, 0x00002c07, - 0x00002c38, 0x00002c08, 0x00002c08, - 0x00002c39, 0x00002c09, 0x00002c09, - 0x00002c3a, 0x00002c0a, 0x00002c0a, - 0x00002c3b, 0x00002c0b, 0x00002c0b, - 0x00002c3c, 0x00002c0c, 0x00002c0c, - 0x00002c3d, 0x00002c0d, 0x00002c0d, - 0x00002c3e, 0x00002c0e, 0x00002c0e, - 0x00002c3f, 0x00002c0f, 0x00002c0f, - 0x00002c40, 0x00002c10, 0x00002c10, - 0x00002c41, 0x00002c11, 0x00002c11, - 0x00002c42, 0x00002c12, 0x00002c12, - 0x00002c43, 0x00002c13, 0x00002c13, - 0x00002c44, 0x00002c14, 0x00002c14, - 0x00002c45, 0x00002c15, 0x00002c15, - 0x00002c46, 0x00002c16, 0x00002c16, - 0x00002c47, 0x00002c17, 0x00002c17, - 0x00002c48, 0x00002c18, 0x00002c18, - 0x00002c49, 0x00002c19, 0x00002c19, - 0x00002c4a, 0x00002c1a, 0x00002c1a, - 0x00002c4b, 0x00002c1b, 0x00002c1b, - 0x00002c4c, 0x00002c1c, 0x00002c1c, - 0x00002c4d, 0x00002c1d, 0x00002c1d, - 0x00002c4e, 0x00002c1e, 0x00002c1e, - 0x00002c4f, 0x00002c1f, 0x00002c1f, - 0x00002c50, 0x00002c20, 0x00002c20, - 0x00002c51, 0x00002c21, 0x00002c21, - 0x00002c52, 0x00002c22, 0x00002c22, - 0x00002c53, 0x00002c23, 0x00002c23, - 0x00002c54, 0x00002c24, 0x00002c24, - 0x00002c55, 0x00002c25, 0x00002c25, - 0x00002c56, 0x00002c26, 0x00002c26, - 0x00002c57, 0x00002c27, 0x00002c27, - 0x00002c58, 0x00002c28, 0x00002c28, - 0x00002c59, 0x00002c29, 0x00002c29, - 0x00002c5a, 0x00002c2a, 0x00002c2a, - 0x00002c5b, 0x00002c2b, 0x00002c2b, - 0x00002c5c, 0x00002c2c, 0x00002c2c, - 0x00002c5d, 0x00002c2d, 0x00002c2d, - 0x00002c5e, 0x00002c2e, 0x00002c2e, - 0x00002c61, 0x00002c60, 0x00002c60, - 0x00002c65, 0x0000023a, 0x0000023a, - 0x00002c66, 0x0000023e, 0x0000023e, - 0x00002c68, 0x00002c67, 0x00002c67, - 0x00002c6a, 0x00002c69, 0x00002c69, - 0x00002c6c, 0x00002c6b, 0x00002c6b, - 0x00002c73, 0x00002c72, 0x00002c72, - 0x00002c76, 0x00002c75, 0x00002c75, - 0x00002c81, 0x00002c80, 0x00002c80, - 0x00002c83, 0x00002c82, 0x00002c82, - 0x00002c85, 0x00002c84, 0x00002c84, - 0x00002c87, 0x00002c86, 0x00002c86, - 0x00002c89, 0x00002c88, 0x00002c88, - 0x00002c8b, 0x00002c8a, 0x00002c8a, - 0x00002c8d, 0x00002c8c, 0x00002c8c, - 0x00002c8f, 0x00002c8e, 0x00002c8e, - 0x00002c91, 0x00002c90, 0x00002c90, - 0x00002c93, 0x00002c92, 0x00002c92, - 0x00002c95, 0x00002c94, 0x00002c94, - 0x00002c97, 0x00002c96, 0x00002c96, - 0x00002c99, 0x00002c98, 0x00002c98, - 0x00002c9b, 0x00002c9a, 0x00002c9a, - 0x00002c9d, 0x00002c9c, 0x00002c9c, - 0x00002c9f, 0x00002c9e, 0x00002c9e, - 0x00002ca1, 0x00002ca0, 0x00002ca0, - 0x00002ca3, 0x00002ca2, 0x00002ca2, - 0x00002ca5, 0x00002ca4, 0x00002ca4, - 0x00002ca7, 0x00002ca6, 0x00002ca6, - 0x00002ca9, 0x00002ca8, 0x00002ca8, - 0x00002cab, 0x00002caa, 0x00002caa, - 0x00002cad, 0x00002cac, 0x00002cac, - 0x00002caf, 0x00002cae, 0x00002cae, - 0x00002cb1, 0x00002cb0, 0x00002cb0, - 0x00002cb3, 0x00002cb2, 0x00002cb2, - 0x00002cb5, 0x00002cb4, 0x00002cb4, - 0x00002cb7, 0x00002cb6, 0x00002cb6, - 0x00002cb9, 0x00002cb8, 0x00002cb8, - 0x00002cbb, 0x00002cba, 0x00002cba, - 0x00002cbd, 0x00002cbc, 0x00002cbc, - 0x00002cbf, 0x00002cbe, 0x00002cbe, - 0x00002cc1, 0x00002cc0, 0x00002cc0, - 0x00002cc3, 0x00002cc2, 0x00002cc2, - 0x00002cc5, 0x00002cc4, 0x00002cc4, - 0x00002cc7, 0x00002cc6, 0x00002cc6, - 0x00002cc9, 0x00002cc8, 0x00002cc8, - 0x00002ccb, 0x00002cca, 0x00002cca, - 0x00002ccd, 0x00002ccc, 0x00002ccc, - 0x00002ccf, 0x00002cce, 0x00002cce, - 0x00002cd1, 0x00002cd0, 0x00002cd0, - 0x00002cd3, 0x00002cd2, 0x00002cd2, - 0x00002cd5, 0x00002cd4, 0x00002cd4, - 0x00002cd7, 0x00002cd6, 0x00002cd6, - 0x00002cd9, 0x00002cd8, 0x00002cd8, - 0x00002cdb, 0x00002cda, 0x00002cda, - 0x00002cdd, 0x00002cdc, 0x00002cdc, - 0x00002cdf, 0x00002cde, 0x00002cde, - 0x00002ce1, 0x00002ce0, 0x00002ce0, - 0x00002ce3, 0x00002ce2, 0x00002ce2, - 0x00002cec, 0x00002ceb, 0x00002ceb, - 0x00002cee, 0x00002ced, 0x00002ced, - 0x00002cf3, 0x00002cf2, 0x00002cf2, - 0x00002d00, 0x000010a0, 0x000010a0, - 0x00002d01, 0x000010a1, 0x000010a1, - 0x00002d02, 0x000010a2, 0x000010a2, - 0x00002d03, 0x000010a3, 0x000010a3, - 0x00002d04, 0x000010a4, 0x000010a4, - 0x00002d05, 0x000010a5, 0x000010a5, - 0x00002d06, 0x000010a6, 0x000010a6, - 0x00002d07, 0x000010a7, 0x000010a7, - 0x00002d08, 0x000010a8, 0x000010a8, - 0x00002d09, 0x000010a9, 0x000010a9, - 0x00002d0a, 0x000010aa, 0x000010aa, - 0x00002d0b, 0x000010ab, 0x000010ab, - 0x00002d0c, 0x000010ac, 0x000010ac, - 0x00002d0d, 0x000010ad, 0x000010ad, - 0x00002d0e, 0x000010ae, 0x000010ae, - 0x00002d0f, 0x000010af, 0x000010af, - 0x00002d10, 0x000010b0, 0x000010b0, - 0x00002d11, 0x000010b1, 0x000010b1, - 0x00002d12, 0x000010b2, 0x000010b2, - 0x00002d13, 0x000010b3, 0x000010b3, - 0x00002d14, 0x000010b4, 0x000010b4, - 0x00002d15, 0x000010b5, 0x000010b5, - 0x00002d16, 0x000010b6, 0x000010b6, - 0x00002d17, 0x000010b7, 0x000010b7, - 0x00002d18, 0x000010b8, 0x000010b8, - 0x00002d19, 0x000010b9, 0x000010b9, - 0x00002d1a, 0x000010ba, 0x000010ba, - 0x00002d1b, 0x000010bb, 0x000010bb, - 0x00002d1c, 0x000010bc, 0x000010bc, - 0x00002d1d, 0x000010bd, 0x000010bd, - 0x00002d1e, 0x000010be, 0x000010be, - 0x00002d1f, 0x000010bf, 0x000010bf, - 0x00002d20, 0x000010c0, 0x000010c0, - 0x00002d21, 0x000010c1, 0x000010c1, - 0x00002d22, 0x000010c2, 0x000010c2, - 0x00002d23, 0x000010c3, 0x000010c3, - 0x00002d24, 0x000010c4, 0x000010c4, - 0x00002d25, 0x000010c5, 0x000010c5, - 0x00002d27, 0x000010c7, 0x000010c7, - 0x00002d2d, 0x000010cd, 0x000010cd, - 0x0000a641, 0x0000a640, 0x0000a640, - 0x0000a643, 0x0000a642, 0x0000a642, - 0x0000a645, 0x0000a644, 0x0000a644, - 0x0000a647, 0x0000a646, 0x0000a646, - 0x0000a649, 0x0000a648, 0x0000a648, - 0x0000a64b, 0x0000a64a, 0x0000a64a, - 0x0000a64d, 0x0000a64c, 0x0000a64c, - 0x0000a64f, 0x0000a64e, 0x0000a64e, - 0x0000a651, 0x0000a650, 0x0000a650, - 0x0000a653, 0x0000a652, 0x0000a652, - 0x0000a655, 0x0000a654, 0x0000a654, - 0x0000a657, 0x0000a656, 0x0000a656, - 0x0000a659, 0x0000a658, 0x0000a658, - 0x0000a65b, 0x0000a65a, 0x0000a65a, - 0x0000a65d, 0x0000a65c, 0x0000a65c, - 0x0000a65f, 0x0000a65e, 0x0000a65e, - 0x0000a661, 0x0000a660, 0x0000a660, - 0x0000a663, 0x0000a662, 0x0000a662, - 0x0000a665, 0x0000a664, 0x0000a664, - 0x0000a667, 0x0000a666, 0x0000a666, - 0x0000a669, 0x0000a668, 0x0000a668, - 0x0000a66b, 0x0000a66a, 0x0000a66a, - 0x0000a66d, 0x0000a66c, 0x0000a66c, - 0x0000a681, 0x0000a680, 0x0000a680, - 0x0000a683, 0x0000a682, 0x0000a682, - 0x0000a685, 0x0000a684, 0x0000a684, - 0x0000a687, 0x0000a686, 0x0000a686, - 0x0000a689, 0x0000a688, 0x0000a688, - 0x0000a68b, 0x0000a68a, 0x0000a68a, - 0x0000a68d, 0x0000a68c, 0x0000a68c, - 0x0000a68f, 0x0000a68e, 0x0000a68e, - 0x0000a691, 0x0000a690, 0x0000a690, - 0x0000a693, 0x0000a692, 0x0000a692, - 0x0000a695, 0x0000a694, 0x0000a694, - 0x0000a697, 0x0000a696, 0x0000a696, - 0x0000a699, 0x0000a698, 0x0000a698, - 0x0000a69b, 0x0000a69a, 0x0000a69a, - 0x0000a723, 0x0000a722, 0x0000a722, - 0x0000a725, 0x0000a724, 0x0000a724, - 0x0000a727, 0x0000a726, 0x0000a726, - 0x0000a729, 0x0000a728, 0x0000a728, - 0x0000a72b, 0x0000a72a, 0x0000a72a, - 0x0000a72d, 0x0000a72c, 0x0000a72c, - 0x0000a72f, 0x0000a72e, 0x0000a72e, - 0x0000a733, 0x0000a732, 0x0000a732, - 0x0000a735, 0x0000a734, 0x0000a734, - 0x0000a737, 0x0000a736, 0x0000a736, - 0x0000a739, 0x0000a738, 0x0000a738, - 0x0000a73b, 0x0000a73a, 0x0000a73a, - 0x0000a73d, 0x0000a73c, 0x0000a73c, - 0x0000a73f, 0x0000a73e, 0x0000a73e, - 0x0000a741, 0x0000a740, 0x0000a740, - 0x0000a743, 0x0000a742, 0x0000a742, - 0x0000a745, 0x0000a744, 0x0000a744, - 0x0000a747, 0x0000a746, 0x0000a746, - 0x0000a749, 0x0000a748, 0x0000a748, - 0x0000a74b, 0x0000a74a, 0x0000a74a, - 0x0000a74d, 0x0000a74c, 0x0000a74c, - 0x0000a74f, 0x0000a74e, 0x0000a74e, - 0x0000a751, 0x0000a750, 0x0000a750, - 0x0000a753, 0x0000a752, 0x0000a752, - 0x0000a755, 0x0000a754, 0x0000a754, - 0x0000a757, 0x0000a756, 0x0000a756, - 0x0000a759, 0x0000a758, 0x0000a758, - 0x0000a75b, 0x0000a75a, 0x0000a75a, - 0x0000a75d, 0x0000a75c, 0x0000a75c, - 0x0000a75f, 0x0000a75e, 0x0000a75e, - 0x0000a761, 0x0000a760, 0x0000a760, - 0x0000a763, 0x0000a762, 0x0000a762, - 0x0000a765, 0x0000a764, 0x0000a764, - 0x0000a767, 0x0000a766, 0x0000a766, - 0x0000a769, 0x0000a768, 0x0000a768, - 0x0000a76b, 0x0000a76a, 0x0000a76a, - 0x0000a76d, 0x0000a76c, 0x0000a76c, - 0x0000a76f, 0x0000a76e, 0x0000a76e, - 0x0000a77a, 0x0000a779, 0x0000a779, - 0x0000a77c, 0x0000a77b, 0x0000a77b, - 0x0000a77f, 0x0000a77e, 0x0000a77e, - 0x0000a781, 0x0000a780, 0x0000a780, - 0x0000a783, 0x0000a782, 0x0000a782, - 0x0000a785, 0x0000a784, 0x0000a784, - 0x0000a787, 0x0000a786, 0x0000a786, - 0x0000a78c, 0x0000a78b, 0x0000a78b, - 0x0000a791, 0x0000a790, 0x0000a790, - 0x0000a793, 0x0000a792, 0x0000a792, - 0x0000a797, 0x0000a796, 0x0000a796, - 0x0000a799, 0x0000a798, 0x0000a798, - 0x0000a79b, 0x0000a79a, 0x0000a79a, - 0x0000a79d, 0x0000a79c, 0x0000a79c, - 0x0000a79f, 0x0000a79e, 0x0000a79e, - 0x0000a7a1, 0x0000a7a0, 0x0000a7a0, - 0x0000a7a3, 0x0000a7a2, 0x0000a7a2, - 0x0000a7a5, 0x0000a7a4, 0x0000a7a4, - 0x0000a7a7, 0x0000a7a6, 0x0000a7a6, - 0x0000a7a9, 0x0000a7a8, 0x0000a7a8, - 0x0000a7b5, 0x0000a7b4, 0x0000a7b4, - 0x0000a7b7, 0x0000a7b6, 0x0000a7b6, - 0x0000ab53, 0x0000a7b3, 0x0000a7b3, - 0x0000ab70, 0x000013a0, 0x000013a0, - 0x0000ab71, 0x000013a1, 0x000013a1, - 0x0000ab72, 0x000013a2, 0x000013a2, - 0x0000ab73, 0x000013a3, 0x000013a3, - 0x0000ab74, 0x000013a4, 0x000013a4, - 0x0000ab75, 0x000013a5, 0x000013a5, - 0x0000ab76, 0x000013a6, 0x000013a6, - 0x0000ab77, 0x000013a7, 0x000013a7, - 0x0000ab78, 0x000013a8, 0x000013a8, - 0x0000ab79, 0x000013a9, 0x000013a9, - 0x0000ab7a, 0x000013aa, 0x000013aa, - 0x0000ab7b, 0x000013ab, 0x000013ab, - 0x0000ab7c, 0x000013ac, 0x000013ac, - 0x0000ab7d, 0x000013ad, 0x000013ad, - 0x0000ab7e, 0x000013ae, 0x000013ae, - 0x0000ab7f, 0x000013af, 0x000013af, - 0x0000ab80, 0x000013b0, 0x000013b0, - 0x0000ab81, 0x000013b1, 0x000013b1, - 0x0000ab82, 0x000013b2, 0x000013b2, - 0x0000ab83, 0x000013b3, 0x000013b3, - 0x0000ab84, 0x000013b4, 0x000013b4, - 0x0000ab85, 0x000013b5, 0x000013b5, - 0x0000ab86, 0x000013b6, 0x000013b6, - 0x0000ab87, 0x000013b7, 0x000013b7, - 0x0000ab88, 0x000013b8, 0x000013b8, - 0x0000ab89, 0x000013b9, 0x000013b9, - 0x0000ab8a, 0x000013ba, 0x000013ba, - 0x0000ab8b, 0x000013bb, 0x000013bb, - 0x0000ab8c, 0x000013bc, 0x000013bc, - 0x0000ab8d, 0x000013bd, 0x000013bd, - 0x0000ab8e, 0x000013be, 0x000013be, - 0x0000ab8f, 0x000013bf, 0x000013bf, - 0x0000ab90, 0x000013c0, 0x000013c0, - 0x0000ab91, 0x000013c1, 0x000013c1, - 0x0000ab92, 0x000013c2, 0x000013c2, - 0x0000ab93, 0x000013c3, 0x000013c3, - 0x0000ab94, 0x000013c4, 0x000013c4, - 0x0000ab95, 0x000013c5, 0x000013c5, - 0x0000ab96, 0x000013c6, 0x000013c6, - 0x0000ab97, 0x000013c7, 0x000013c7, - 0x0000ab98, 0x000013c8, 0x000013c8, - 0x0000ab99, 0x000013c9, 0x000013c9, - 0x0000ab9a, 0x000013ca, 0x000013ca, - 0x0000ab9b, 0x000013cb, 0x000013cb, - 0x0000ab9c, 0x000013cc, 0x000013cc, - 0x0000ab9d, 0x000013cd, 0x000013cd, - 0x0000ab9e, 0x000013ce, 0x000013ce, - 0x0000ab9f, 0x000013cf, 0x000013cf, - 0x0000aba0, 0x000013d0, 0x000013d0, - 0x0000aba1, 0x000013d1, 0x000013d1, - 0x0000aba2, 0x000013d2, 0x000013d2, - 0x0000aba3, 0x000013d3, 0x000013d3, - 0x0000aba4, 0x000013d4, 0x000013d4, - 0x0000aba5, 0x000013d5, 0x000013d5, - 0x0000aba6, 0x000013d6, 0x000013d6, - 0x0000aba7, 0x000013d7, 0x000013d7, - 0x0000aba8, 0x000013d8, 0x000013d8, - 0x0000aba9, 0x000013d9, 0x000013d9, - 0x0000abaa, 0x000013da, 0x000013da, - 0x0000abab, 0x000013db, 0x000013db, - 0x0000abac, 0x000013dc, 0x000013dc, - 0x0000abad, 0x000013dd, 0x000013dd, - 0x0000abae, 0x000013de, 0x000013de, - 0x0000abaf, 0x000013df, 0x000013df, - 0x0000abb0, 0x000013e0, 0x000013e0, - 0x0000abb1, 0x000013e1, 0x000013e1, - 0x0000abb2, 0x000013e2, 0x000013e2, - 0x0000abb3, 0x000013e3, 0x000013e3, - 0x0000abb4, 0x000013e4, 0x000013e4, - 0x0000abb5, 0x000013e5, 0x000013e5, - 0x0000abb6, 0x000013e6, 0x000013e6, - 0x0000abb7, 0x000013e7, 0x000013e7, - 0x0000abb8, 0x000013e8, 0x000013e8, - 0x0000abb9, 0x000013e9, 0x000013e9, - 0x0000abba, 0x000013ea, 0x000013ea, - 0x0000abbb, 0x000013eb, 0x000013eb, - 0x0000abbc, 0x000013ec, 0x000013ec, - 0x0000abbd, 0x000013ed, 0x000013ed, - 0x0000abbe, 0x000013ee, 0x000013ee, - 0x0000abbf, 0x000013ef, 0x000013ef, - 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, - 0x0001044e, 0x00010426, 0x00010426, - 0x0001044f, 0x00010427, 0x00010427, - 0x000104d8, 0x000104b0, 0x000104b0, - 0x000104d9, 0x000104b1, 0x000104b1, - 0x000104da, 0x000104b2, 0x000104b2, - 0x000104db, 0x000104b3, 0x000104b3, - 0x000104dc, 0x000104b4, 0x000104b4, - 0x000104dd, 0x000104b5, 0x000104b5, - 0x000104de, 0x000104b6, 0x000104b6, - 0x000104df, 0x000104b7, 0x000104b7, - 0x000104e0, 0x000104b8, 0x000104b8, - 0x000104e1, 0x000104b9, 0x000104b9, - 0x000104e2, 0x000104ba, 0x000104ba, - 0x000104e3, 0x000104bb, 0x000104bb, - 0x000104e4, 0x000104bc, 0x000104bc, - 0x000104e5, 0x000104bd, 0x000104bd, - 0x000104e6, 0x000104be, 0x000104be, - 0x000104e7, 0x000104bf, 0x000104bf, - 0x000104e8, 0x000104c0, 0x000104c0, - 0x000104e9, 0x000104c1, 0x000104c1, - 0x000104ea, 0x000104c2, 0x000104c2, - 0x000104eb, 0x000104c3, 0x000104c3, - 0x000104ec, 0x000104c4, 0x000104c4, - 0x000104ed, 0x000104c5, 0x000104c5, - 0x000104ee, 0x000104c6, 0x000104c6, - 0x000104ef, 0x000104c7, 0x000104c7, - 0x000104f0, 0x000104c8, 0x000104c8, - 0x000104f1, 0x000104c9, 0x000104c9, - 0x000104f2, 0x000104ca, 0x000104ca, - 0x000104f3, 0x000104cb, 0x000104cb, - 0x000104f4, 0x000104cc, 0x000104cc, - 0x000104f5, 0x000104cd, 0x000104cd, - 0x000104f6, 0x000104ce, 0x000104ce, - 0x000104f7, 0x000104cf, 0x000104cf, - 0x000104f8, 0x000104d0, 0x000104d0, - 0x000104f9, 0x000104d1, 0x000104d1, - 0x000104fa, 0x000104d2, 0x000104d2, - 0x000104fb, 0x000104d3, 0x000104d3, - 0x00010cc0, 0x00010c80, 0x00010c80, - 0x00010cc1, 0x00010c81, 0x00010c81, - 0x00010cc2, 0x00010c82, 0x00010c82, - 0x00010cc3, 0x00010c83, 0x00010c83, - 0x00010cc4, 0x00010c84, 0x00010c84, - 0x00010cc5, 0x00010c85, 0x00010c85, - 0x00010cc6, 0x00010c86, 0x00010c86, - 0x00010cc7, 0x00010c87, 0x00010c87, - 0x00010cc8, 0x00010c88, 0x00010c88, - 0x00010cc9, 0x00010c89, 0x00010c89, - 0x00010cca, 0x00010c8a, 0x00010c8a, - 0x00010ccb, 0x00010c8b, 0x00010c8b, - 0x00010ccc, 0x00010c8c, 0x00010c8c, - 0x00010ccd, 0x00010c8d, 0x00010c8d, - 0x00010cce, 0x00010c8e, 0x00010c8e, - 0x00010ccf, 0x00010c8f, 0x00010c8f, - 0x00010cd0, 0x00010c90, 0x00010c90, - 0x00010cd1, 0x00010c91, 0x00010c91, - 0x00010cd2, 0x00010c92, 0x00010c92, - 0x00010cd3, 0x00010c93, 0x00010c93, - 0x00010cd4, 0x00010c94, 0x00010c94, - 0x00010cd5, 0x00010c95, 0x00010c95, - 0x00010cd6, 0x00010c96, 0x00010c96, - 0x00010cd7, 0x00010c97, 0x00010c97, - 0x00010cd8, 0x00010c98, 0x00010c98, - 0x00010cd9, 0x00010c99, 0x00010c99, - 0x00010cda, 0x00010c9a, 0x00010c9a, - 0x00010cdb, 0x00010c9b, 0x00010c9b, - 0x00010cdc, 0x00010c9c, 0x00010c9c, - 0x00010cdd, 0x00010c9d, 0x00010c9d, - 0x00010cde, 0x00010c9e, 0x00010c9e, - 0x00010cdf, 0x00010c9f, 0x00010c9f, - 0x00010ce0, 0x00010ca0, 0x00010ca0, - 0x00010ce1, 0x00010ca1, 0x00010ca1, - 0x00010ce2, 0x00010ca2, 0x00010ca2, - 0x00010ce3, 0x00010ca3, 0x00010ca3, - 0x00010ce4, 0x00010ca4, 0x00010ca4, - 0x00010ce5, 0x00010ca5, 0x00010ca5, - 0x00010ce6, 0x00010ca6, 0x00010ca6, - 0x00010ce7, 0x00010ca7, 0x00010ca7, - 0x00010ce8, 0x00010ca8, 0x00010ca8, - 0x00010ce9, 0x00010ca9, 0x00010ca9, - 0x00010cea, 0x00010caa, 0x00010caa, - 0x00010ceb, 0x00010cab, 0x00010cab, - 0x00010cec, 0x00010cac, 0x00010cac, - 0x00010ced, 0x00010cad, 0x00010cad, - 0x00010cee, 0x00010cae, 0x00010cae, - 0x00010cef, 0x00010caf, 0x00010caf, - 0x00010cf0, 0x00010cb0, 0x00010cb0, - 0x00010cf1, 0x00010cb1, 0x00010cb1, - 0x00010cf2, 0x00010cb2, 0x00010cb2, - 0x000118c0, 0x000118a0, 0x000118a0, - 0x000118c1, 0x000118a1, 0x000118a1, - 0x000118c2, 0x000118a2, 0x000118a2, - 0x000118c3, 0x000118a3, 0x000118a3, - 0x000118c4, 0x000118a4, 0x000118a4, - 0x000118c5, 0x000118a5, 0x000118a5, - 0x000118c6, 0x000118a6, 0x000118a6, - 0x000118c7, 0x000118a7, 0x000118a7, - 0x000118c8, 0x000118a8, 0x000118a8, - 0x000118c9, 0x000118a9, 0x000118a9, - 0x000118ca, 0x000118aa, 0x000118aa, - 0x000118cb, 0x000118ab, 0x000118ab, - 0x000118cc, 0x000118ac, 0x000118ac, - 0x000118cd, 0x000118ad, 0x000118ad, - 0x000118ce, 0x000118ae, 0x000118ae, - 0x000118cf, 0x000118af, 0x000118af, - 0x000118d0, 0x000118b0, 0x000118b0, - 0x000118d1, 0x000118b1, 0x000118b1, - 0x000118d2, 0x000118b2, 0x000118b2, - 0x000118d3, 0x000118b3, 0x000118b3, - 0x000118d4, 0x000118b4, 0x000118b4, - 0x000118d5, 0x000118b5, 0x000118b5, - 0x000118d6, 0x000118b6, 0x000118b6, - 0x000118d7, 0x000118b7, 0x000118b7, - 0x000118d8, 0x000118b8, 0x000118b8, - 0x000118d9, 0x000118b9, 0x000118b9, - 0x000118da, 0x000118ba, 0x000118ba, - 0x000118db, 0x000118bb, 0x000118bb, - 0x000118dc, 0x000118bc, 0x000118bc, - 0x000118dd, 0x000118bd, 0x000118bd, - 0x000118de, 0x000118be, 0x000118be, - 0x000118df, 0x000118bf, 0x000118bf, - 0x0001e922, 0x0001e900, 0x0001e900, - 0x0001e923, 0x0001e901, 0x0001e901, - 0x0001e924, 0x0001e902, 0x0001e902, - 0x0001e925, 0x0001e903, 0x0001e903, - 0x0001e926, 0x0001e904, 0x0001e904, - 0x0001e927, 0x0001e905, 0x0001e905, - 0x0001e928, 0x0001e906, 0x0001e906, - 0x0001e929, 0x0001e907, 0x0001e907, - 0x0001e92a, 0x0001e908, 0x0001e908, - 0x0001e92b, 0x0001e909, 0x0001e909, - 0x0001e92c, 0x0001e90a, 0x0001e90a, - 0x0001e92d, 0x0001e90b, 0x0001e90b, - 0x0001e92e, 0x0001e90c, 0x0001e90c, - 0x0001e92f, 0x0001e90d, 0x0001e90d, - 0x0001e930, 0x0001e90e, 0x0001e90e, - 0x0001e931, 0x0001e90f, 0x0001e90f, - 0x0001e932, 0x0001e910, 0x0001e910, - 0x0001e933, 0x0001e911, 0x0001e911, - 0x0001e934, 0x0001e912, 0x0001e912, - 0x0001e935, 0x0001e913, 0x0001e913, - 0x0001e936, 0x0001e914, 0x0001e914, - 0x0001e937, 0x0001e915, 0x0001e915, - 0x0001e938, 0x0001e916, 0x0001e916, - 0x0001e939, 0x0001e917, 0x0001e917, - 0x0001e93a, 0x0001e918, 0x0001e918, - 0x0001e93b, 0x0001e919, 0x0001e919, - 0x0001e93c, 0x0001e91a, 0x0001e91a, - 0x0001e93d, 0x0001e91b, 0x0001e91b, - 0x0001e93e, 0x0001e91c, 0x0001e91c, - 0x0001e93f, 0x0001e91d, 0x0001e91d, - 0x0001e940, 0x0001e91e, 0x0001e91e, - 0x0001e941, 0x0001e91f, 0x0001e91f, - 0x0001e942, 0x0001e920, 0x0001e920, - 0x0001e943, 0x0001e921, 0x0001e921, - 0x000001c5, 0x000001c4, 0x000001c6, - 0x000001c8, 0x000001c7, 0x000001c9, - 0x000001cb, 0x000001ca, 0x000001cc, - 0x000001f2, 0x000001f1, 0x000001f3, - 0x00001f88, 0x00001f88, 0x00001f80, - 0x00001f89, 0x00001f89, 0x00001f81, - 0x00001f8a, 0x00001f8a, 0x00001f82, - 0x00001f8b, 0x00001f8b, 0x00001f83, - 0x00001f8c, 0x00001f8c, 0x00001f84, - 0x00001f8d, 0x00001f8d, 0x00001f85, - 0x00001f8e, 0x00001f8e, 0x00001f86, - 0x00001f8f, 0x00001f8f, 0x00001f87, - 0x00001f98, 0x00001f98, 0x00001f90, - 0x00001f99, 0x00001f99, 0x00001f91, - 0x00001f9a, 0x00001f9a, 0x00001f92, - 0x00001f9b, 0x00001f9b, 0x00001f93, - 0x00001f9c, 0x00001f9c, 0x00001f94, - 0x00001f9d, 0x00001f9d, 0x00001f95, - 0x00001f9e, 0x00001f9e, 0x00001f96, - 0x00001f9f, 0x00001f9f, 0x00001f97, - 0x00001fa8, 0x00001fa8, 0x00001fa0, - 0x00001fa9, 0x00001fa9, 0x00001fa1, - 0x00001faa, 0x00001faa, 0x00001fa2, - 0x00001fab, 0x00001fab, 0x00001fa3, - 0x00001fac, 0x00001fac, 0x00001fa4, - 0x00001fad, 0x00001fad, 0x00001fa5, - 0x00001fae, 0x00001fae, 0x00001fa6, - 0x00001faf, 0x00001faf, 0x00001fa7, - 0x00001fbc, 0x00001fbc, 0x00001fb3, - 0x00001fcc, 0x00001fcc, 0x00001fc3, - 0x00001ffc, 0x00001ffc, 0x00001ff3 +static const unsigned _uccase_extra_table[] = { + 0x00001f88, 0x00001f08, 0x00000399, 0x00001f89, + 0x00001f09, 0x00000399, 0x00001f8a, 0x00001f0a, + 0x00000399, 0x00001f8b, 0x00001f0b, 0x00000399, + 0x00001f8c, 0x00001f0c, 0x00000399, 0x00001f8d, + 0x00001f0d, 0x00000399, 0x00001f8e, 0x00001f0e, + 0x00000399, 0x00001f8f, 0x00001f0f, 0x00000399, + 0x00001f98, 0x00001f28, 0x00000399, 0x00001f99, + 0x00001f29, 0x00000399, 0x00001f9a, 0x00001f2a, + 0x00000399, 0x00001f9b, 0x00001f2b, 0x00000399, + 0x00001f9c, 0x00001f2c, 0x00000399, 0x00001f9d, + 0x00001f2d, 0x00000399, 0x00001f9e, 0x00001f2e, + 0x00000399, 0x00001f9f, 0x00001f2f, 0x00000399, + 0x00001fa8, 0x00001f68, 0x00000399, 0x00001fa9, + 0x00001f69, 0x00000399, 0x00001faa, 0x00001f6a, + 0x00000399, 0x00001fab, 0x00001f6b, 0x00000399, + 0x00001fac, 0x00001f6c, 0x00000399, 0x00001fad, + 0x00001f6d, 0x00000399, 0x00001fae, 0x00001f6e, + 0x00000399, 0x00001faf, 0x00001f6f, 0x00000399, + 0x00001fbc, 0x00000391, 0x00000399, 0x00001fcc, + 0x00000397, 0x00000399, 0x00001ffc, 0x000003a9, + 0x00000399, 0x000000df, 0x00000053, 0x00000053, + 0x0000fb00, 0x00000046, 0x00000046, 0x0000fb01, + 0x00000046, 0x00000049, 0x0000fb02, 0x00000046, + 0x0000004c, 0x0000fb03, 0x00000046, 0x00000046, + 0x00000049, 0x0000fb04, 0x00000046, 0x00000046, + 0x0000004c, 0x0000fb05, 0x00000053, 0x00000054, + 0x0000fb06, 0x00000053, 0x00000054, 0x00000587, + 0x00000535, 0x00000552, 0x0000fb13, 0x00000544, + 0x00000546, 0x0000fb14, 0x00000544, 0x00000535, + 0x0000fb15, 0x00000544, 0x0000053b, 0x0000fb16, + 0x0000054e, 0x00000546, 0x0000fb17, 0x00000544, + 0x0000053d, 0x00000149, 0x000002bc, 0x0000004e, + 0x00000390, 0x00000399, 0x00000308, 0x00000301, + 0x000003b0, 0x000003a5, 0x00000308, 0x00000301, + 0x000001f0, 0x0000004a, 0x0000030c, 0x00001e96, + 0x00000048, 0x00000331, 0x00001e97, 0x00000054, + 0x00000308, 0x00001e98, 0x00000057, 0x0000030a, + 0x00001e99, 0x00000059, 0x0000030a, 0x00001e9a, + 0x00000041, 0x000002be, 0x00001f50, 0x000003a5, + 0x00000313, 0x00001f52, 0x000003a5, 0x00000313, + 0x00000300, 0x00001f54, 0x000003a5, 0x00000313, + 0x00000301, 0x00001f56, 0x000003a5, 0x00000313, + 0x00000342, 0x00001fb6, 0x00000391, 0x00000342, + 0x00001fc6, 0x00000397, 0x00000342, 0x00001fd2, + 0x00000399, 0x00000308, 0x00000300, 0x00001fd3, + 0x00000399, 0x00000308, 0x00000301, 0x00001fd6, + 0x00000399, 0x00000342, 0x00001fd7, 0x00000399, + 0x00000308, 0x00000342, 0x00001fe2, 0x000003a5, + 0x00000308, 0x00000300, 0x00001fe3, 0x000003a5, + 0x00000308, 0x00000301, 0x00001fe4, 0x000003a1, + 0x00000313, 0x00001fe6, 0x000003a5, 0x00000342, + 0x00001fe7, 0x000003a5, 0x00000308, 0x00000342, + 0x00001ff6, 0x000003a9, 0x00000342, 0x00001f88, + 0x00001f08, 0x00000399, 0x00001f89, 0x00001f09, + 0x00000399, 0x00001f8a, 0x00001f0a, 0x00000399, + 0x00001f8b, 0x00001f0b, 0x00000399, 0x00001f8c, + 0x00001f0c, 0x00000399, 0x00001f8d, 0x00001f0d, + 0x00000399, 0x00001f8e, 0x00001f0e, 0x00000399, + 0x00001f8f, 0x00001f0f, 0x00000399, 0x00001f98, + 0x00001f28, 0x00000399, 0x00001f99, 0x00001f29, + 0x00000399, 0x00001f9a, 0x00001f2a, 0x00000399, + 0x00001f9b, 0x00001f2b, 0x00000399, 0x00001f9c, + 0x00001f2c, 0x00000399, 0x00001f9d, 0x00001f2d, + 0x00000399, 0x00001f9e, 0x00001f2e, 0x00000399, + 0x00001f9f, 0x00001f2f, 0x00000399, 0x00001fa8, + 0x00001f68, 0x00000399, 0x00001fa9, 0x00001f69, + 0x00000399, 0x00001faa, 0x00001f6a, 0x00000399, + 0x00001fab, 0x00001f6b, 0x00000399, 0x00001fac, + 0x00001f6c, 0x00000399, 0x00001fad, 0x00001f6d, + 0x00000399, 0x00001fae, 0x00001f6e, 0x00000399, + 0x00001faf, 0x00001f6f, 0x00000399, 0x00001fbc, + 0x00000391, 0x00000399, 0x00001fcc, 0x00000397, + 0x00000399, 0x00001ffc, 0x000003a9, 0x00000399, + 0x00001fb2, 0x00001fba, 0x00000399, 0x00001fb4, + 0x00000386, 0x00000399, 0x00001fc2, 0x00001fca, + 0x00000399, 0x00001fc4, 0x00000389, 0x00000399, + 0x00001ff2, 0x00001ffa, 0x00000399, 0x00001ff4, + 0x0000038f, 0x00000399, 0x00001fb7, 0x00000391, + 0x00000342, 0x00000399, 0x00001fc7, 0x00000397, + 0x00000342, 0x00000399, 0x00001ff7, 0x000003a9, + 0x00000342, 0x00000399, 0x00000069, 0x00000069, + 0x00000307, 0x000000df, 0x00000053, 0x00000073, + 0x0000fb00, 0x00000046, 0x00000066, 0x0000fb01, + 0x00000046, 0x00000069, 0x0000fb02, 0x00000046, + 0x0000006c, 0x0000fb03, 0x00000046, 0x00000066, + 0x00000069, 0x0000fb04, 0x00000046, 0x00000066, + 0x0000006c, 0x0000fb05, 0x00000053, 0x00000074, + 0x0000fb06, 0x00000053, 0x00000074, 0x00000587, + 0x00000535, 0x00000582, 0x0000fb13, 0x00000544, + 0x00000576, 0x0000fb14, 0x00000544, 0x00000565, + 0x0000fb15, 0x00000544, 0x0000056b, 0x0000fb16, + 0x0000054e, 0x00000576, 0x0000fb17, 0x00000544, + 0x0000056d, 0x00001fb2, 0x00001fba, 0x00000345, + 0x00001fb4, 0x00000386, 0x00000345, 0x00001fc2, + 0x00001fca, 0x00000345, 0x00001fc4, 0x00000389, + 0x00000345, 0x00001ff2, 0x00001ffa, 0x00000345, + 0x00001ff4, 0x0000038f, 0x00000345, 0x00001fb7, + 0x00000391, 0x00000342, 0x00000345, 0x00001fc7, + 0x00000397, 0x00000342, 0x00000345, 0x00001ff7, + 0x000003a9, 0x00000342, 0x00000345, 0x000000df, + 0x00000073, 0x00000073, 0x00000130, 0x00000069, + 0x00000307, 0x00000149, 0x000002bc, 0x0000006e, + 0x000001f0, 0x0000006a, 0x0000030c, 0x00000390, + 0x000003b9, 0x00000308, 0x00000301, 0x000003b0, + 0x000003c5, 0x00000308, 0x00000301, 0x00000587, + 0x00000565, 0x00000582, 0x00001e96, 0x00000068, + 0x00000331, 0x00001e97, 0x00000074, 0x00000308, + 0x00001e98, 0x00000077, 0x0000030a, 0x00001e99, + 0x00000079, 0x0000030a, 0x00001e9a, 0x00000061, + 0x000002be, 0x000000df, 0x00000073, 0x00000073, + 0x00001f50, 0x000003c5, 0x00000313, 0x00001f52, + 0x000003c5, 0x00000313, 0x00000300, 0x00001f54, + 0x000003c5, 0x00000313, 0x00000301, 0x00001f56, + 0x000003c5, 0x00000313, 0x00000342, 0x00001f80, + 0x00001f00, 0x000003b9, 0x00001f81, 0x00001f01, + 0x000003b9, 0x00001f82, 0x00001f02, 0x000003b9, + 0x00001f83, 0x00001f03, 0x000003b9, 0x00001f84, + 0x00001f04, 0x000003b9, 0x00001f85, 0x00001f05, + 0x000003b9, 0x00001f86, 0x00001f06, 0x000003b9, + 0x00001f87, 0x00001f07, 0x000003b9, 0x00001f80, + 0x00001f00, 0x000003b9, 0x00001f81, 0x00001f01, + 0x000003b9, 0x00001f82, 0x00001f02, 0x000003b9, + 0x00001f83, 0x00001f03, 0x000003b9, 0x00001f84, + 0x00001f04, 0x000003b9, 0x00001f85, 0x00001f05, + 0x000003b9, 0x00001f86, 0x00001f06, 0x000003b9, + 0x00001f87, 0x00001f07, 0x000003b9, 0x00001f90, + 0x00001f20, 0x000003b9, 0x00001f91, 0x00001f21, + 0x000003b9, 0x00001f92, 0x00001f22, 0x000003b9, + 0x00001f93, 0x00001f23, 0x000003b9, 0x00001f94, + 0x00001f24, 0x000003b9, 0x00001f95, 0x00001f25, + 0x000003b9, 0x00001f96, 0x00001f26, 0x000003b9, + 0x00001f97, 0x00001f27, 0x000003b9, 0x00001f90, + 0x00001f20, 0x000003b9, 0x00001f91, 0x00001f21, + 0x000003b9, 0x00001f92, 0x00001f22, 0x000003b9, + 0x00001f93, 0x00001f23, 0x000003b9, 0x00001f94, + 0x00001f24, 0x000003b9, 0x00001f95, 0x00001f25, + 0x000003b9, 0x00001f96, 0x00001f26, 0x000003b9, + 0x00001f97, 0x00001f27, 0x000003b9, 0x00001fa0, + 0x00001f60, 0x000003b9, 0x00001fa1, 0x00001f61, + 0x000003b9, 0x00001fa2, 0x00001f62, 0x000003b9, + 0x00001fa3, 0x00001f63, 0x000003b9, 0x00001fa4, + 0x00001f64, 0x000003b9, 0x00001fa5, 0x00001f65, + 0x000003b9, 0x00001fa6, 0x00001f66, 0x000003b9, + 0x00001fa7, 0x00001f67, 0x000003b9, 0x00001fa0, + 0x00001f60, 0x000003b9, 0x00001fa1, 0x00001f61, + 0x000003b9, 0x00001fa2, 0x00001f62, 0x000003b9, + 0x00001fa3, 0x00001f63, 0x000003b9, 0x00001fa4, + 0x00001f64, 0x000003b9, 0x00001fa5, 0x00001f65, + 0x000003b9, 0x00001fa6, 0x00001f66, 0x000003b9, + 0x00001fa7, 0x00001f67, 0x000003b9, 0x00001fb2, + 0x00001f70, 0x000003b9, 0x00001fb3, 0x000003b1, + 0x000003b9, 0x00001fb4, 0x000003ac, 0x000003b9, + 0x00001fb6, 0x000003b1, 0x00000342, 0x00001fb7, + 0x000003b1, 0x00000342, 0x000003b9, 0x00001fb3, + 0x000003b1, 0x000003b9, 0x00001fc2, 0x00001f74, + 0x000003b9, 0x00001fc3, 0x000003b7, 0x000003b9, + 0x00001fc4, 0x000003ae, 0x000003b9, 0x00001fc6, + 0x000003b7, 0x00000342, 0x00001fc7, 0x000003b7, + 0x00000342, 0x000003b9, 0x00001fc3, 0x000003b7, + 0x000003b9, 0x00001fd2, 0x000003b9, 0x00000308, + 0x00000300, 0x00001fd3, 0x000003b9, 0x00000308, + 0x00000301, 0x00001fd6, 0x000003b9, 0x00000342, + 0x00001fd7, 0x000003b9, 0x00000308, 0x00000342, + 0x00001fe2, 0x000003c5, 0x00000308, 0x00000300, + 0x00001fe3, 0x000003c5, 0x00000308, 0x00000301, + 0x00001fe4, 0x000003c1, 0x00000313, 0x00001fe6, + 0x000003c5, 0x00000342, 0x00001fe7, 0x000003c5, + 0x00000308, 0x00000342, 0x00001ff2, 0x00001f7c, + 0x000003b9, 0x00001ff3, 0x000003c9, 0x000003b9, + 0x00001ff4, 0x000003ce, 0x000003b9, 0x00001ff6, + 0x000003c9, 0x00000342, 0x00001ff7, 0x000003c9, + 0x00000342, 0x000003b9, 0x00001ff3, 0x000003c9, + 0x000003b9, 0x0000fb00, 0x00000066, 0x00000066, + 0x0000fb01, 0x00000066, 0x00000069, 0x0000fb02, + 0x00000066, 0x0000006c, 0x0000fb03, 0x00000066, + 0x00000066, 0x00000069, 0x0000fb04, 0x00000066, + 0x00000066, 0x0000006c, 0x0000fb05, 0x00000073, + 0x00000074, 0x0000fb06, 0x00000073, 0x00000074, + 0x0000fb13, 0x00000574, 0x00000576, 0x0000fb14, + 0x00000574, 0x00000565, 0x0000fb15, 0x00000574, + 0x0000056b, 0x0000fb16, 0x0000057e, 0x00000576, + 0x0000fb17, 0x00000574, 0x0000056d }; diff --git a/ext/mysqli/mysqli.c b/ext/mysqli/mysqli.c index d1588f1439863..63065b5e90538 100644 --- a/ext/mysqli/mysqli.c +++ b/ext/mysqli/mysqli.c @@ -424,8 +424,7 @@ HashTable *mysqli_object_get_debug_info(zval *object, int *is_temp) HashTable *retval, *props = obj->prop_handler; mysqli_prop_handler *entry; - ALLOC_HASHTABLE(retval); - ZEND_INIT_SYMTABLE_EX(retval, zend_hash_num_elements(props) + 1, 0); + retval = zend_new_array(zend_hash_num_elements(props) + 1); ZEND_HASH_FOREACH_PTR(props, entry) { zval rv, member; @@ -568,11 +567,9 @@ PHP_MINIT_FUNCTION(mysqli) REGISTER_INI_ENTRIES(); #ifndef MYSQLI_USE_MYSQLND -#if MYSQL_VERSION_ID >= 40000 if (mysql_server_init(0, NULL, NULL)) { return FAILURE; } -#endif #endif memcpy(&mysqli_object_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers)); @@ -691,9 +688,7 @@ PHP_MINIT_FUNCTION(mysqli) REGISTER_LONG_CONSTANT("MYSQLI_OPT_CONNECT_TIMEOUT", MYSQL_OPT_CONNECT_TIMEOUT, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("MYSQLI_OPT_LOCAL_INFILE", MYSQL_OPT_LOCAL_INFILE, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("MYSQLI_INIT_COMMAND", MYSQL_INIT_COMMAND, CONST_CS | CONST_PERSISTENT); -#if MYSQL_VERSION_ID > 40101 || defined(MYSQLI_USE_MYSQLND) REGISTER_LONG_CONSTANT("MYSQLI_OPT_READ_TIMEOUT", MYSQL_OPT_READ_TIMEOUT, CONST_CS | CONST_PERSISTENT); -#endif #if defined(MYSQLI_USE_MYSQLND) REGISTER_LONG_CONSTANT("MYSQLI_OPT_NET_CMD_BUFFER_SIZE", MYSQLND_OPT_NET_CMD_BUFFER_SIZE, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("MYSQLI_OPT_NET_READ_BUFFER_SIZE", MYSQLND_OPT_NET_READ_BUFFER_SIZE, CONST_CS | CONST_PERSISTENT); @@ -885,7 +880,6 @@ PHP_MINIT_FUNCTION(mysqli) PHP_MSHUTDOWN_FUNCTION(mysqli) { #ifndef MYSQLI_USE_MYSQLND -#if MYSQL_VERSION_ID >= 40000 #ifdef PHP_WIN32 zend_ulong client_ver = mysql_get_client_version(); /* @@ -898,7 +892,6 @@ PHP_MSHUTDOWN_FUNCTION(mysqli) #else mysql_server_end(); #endif -#endif #endif zend_hash_destroy(&mysqli_driver_properties); @@ -917,7 +910,7 @@ PHP_MSHUTDOWN_FUNCTION(mysqli) */ PHP_RINIT_FUNCTION(mysqli) { -#if !defined(MYSQLI_USE_MYSQLND) && defined(ZTS) && MYSQL_VERSION_ID >= 40000 +#if !defined(MYSQLI_USE_MYSQLND) && defined(ZTS) if (mysql_thread_init()) { return FAILURE; } @@ -954,7 +947,7 @@ PHP_RSHUTDOWN_FUNCTION(mysqli) { /* check persistent connections, move used to free */ -#if !defined(MYSQLI_USE_MYSQLND) && defined(ZTS) && MYSQL_VERSION_ID >= 40000 +#if !defined(MYSQLI_USE_MYSQLND) && defined(ZTS) mysql_thread_end(); #endif if (MyG(error_msg)) { diff --git a/ext/mysqli/mysqli_api.c b/ext/mysqli/mysqli_api.c index de1d806f0f5be..2c9915111d4df 100644 --- a/ext/mysqli/mysqli_api.c +++ b/ext/mysqli/mysqli_api.c @@ -1714,14 +1714,12 @@ static int mysqli_options_get_option_zval_type(int option) #ifdef MYSQL_OPT_PROTOCOL case MYSQL_OPT_PROTOCOL: #endif /* MySQL 4.1.0 */ -#if MYSQL_VERSION_ID > 40101 || defined(MYSQLI_USE_MYSQLND) case MYSQL_OPT_READ_TIMEOUT: case MYSQL_OPT_WRITE_TIMEOUT: case MYSQL_OPT_GUESS_CONNECTION: case MYSQL_OPT_USE_EMBEDDED_CONNECTION: case MYSQL_OPT_USE_REMOTE_CONNECTION: case MYSQL_SECURE_AUTH: -#endif #ifdef MYSQL_OPT_RECONNECT case MYSQL_OPT_RECONNECT: #endif /* MySQL 5.0.13 */ diff --git a/ext/mysqli/mysqli_priv.h b/ext/mysqli/mysqli_priv.h index 34c7a74779b31..cd9a8081ec513 100644 --- a/ext/mysqli/mysqli_priv.h +++ b/ext/mysqli/mysqli_priv.h @@ -33,7 +33,7 @@ #define HAVE_MYSQLI_GET_CHARSET #endif -#if defined(MYSQLND_VERSION_ID) || (MYSQL_VERSION_ID > 40112 && MYSQL_VERSION_ID < 50000) || MYSQL_VERSION_ID > 50005 +#if defined(MYSQLND_VERSION_ID) || MYSQL_VERSION_ID > 50005 #define HAVE_MYSQLI_SET_CHARSET #endif diff --git a/ext/mysqli/package.xml b/ext/mysqli/package.xml deleted file mode 100644 index bfeeb718505e3..0000000000000 --- a/ext/mysqli/package.xml +++ /dev/null @@ -1,116 +0,0 @@ - - - - mysqli - MySQLi - new MySQL interface for PHP 5 and MySQL 4.1+ - - - georg - Georg Richter - georg@php.net - lead - - - zak - Zak Greant - zak@php.net - lead - - - -MySQLi is a rewrite of the original MySQL extension ... - - PHP - - beta - 5.0.0rc1 - 2004-03-19 - -package.xml added to support installation using pear installer - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/ext/mysqlnd/mysqlnd_wireprotocol.c b/ext/mysqlnd/mysqlnd_wireprotocol.c index 8f9c9797e14fd..9d951746f8ca6 100644 --- a/ext/mysqlnd/mysqlnd_wireprotocol.c +++ b/ext/mysqlnd/mysqlnd_wireprotocol.c @@ -538,7 +538,7 @@ size_t php_mysqlnd_auth_write(void * _packet) DBG_RETURN(0); } - int1store(p, packet->auth_data_len); + int1store(p, (int8_t)packet->auth_data_len); ++p; /*!!!!! is the buffer big enough ??? */ if (sizeof(buffer) < (packet->auth_data_len + (p - buffer))) { diff --git a/ext/odbc/birdstep.c b/ext/odbc/birdstep.c deleted file mode 100644 index 18aa62b22f64c..0000000000000 --- a/ext/odbc/birdstep.c +++ /dev/null @@ -1,709 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | PHP Version 7 | - +----------------------------------------------------------------------+ - | Copyright (c) 1997-2017 The PHP Group | - +----------------------------------------------------------------------+ - | This source file is subject to version 3.01 of the PHP license, | - | that is bundled with this package in the file LICENSE, and is | - | available through the world-wide-web at the following url: | - | http://www.php.net/license/3_01.txt | - | If you did not receive a copy of the PHP license and are unable to | - | obtain it through the world-wide-web, please send a note to | - | license@php.net so we can mail you a copy immediately. | - +----------------------------------------------------------------------+ - | Authors: Nikolay P. Romanyuk | - +----------------------------------------------------------------------+ - */ - -/* $Id$ */ - -/* - * TODO: - * birdstep_fetch_into(), - * Check all on real life apps. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include "php.h" - -#if WIN32 -# include "config.w32.h" -# ifdef PHP_EXPORTS -# define PHPAPI __declspec(dllexport) -# else -# define PHPAPI __declspec(dllimport) -# endif -#else -# include -# define PHPAPI -# define THREAD_LS -#endif - -#ifdef HAVE_BIRDSTEP -#include "php_birdstep.h" -#include "ext/standard/info.h" -#include "php_ini.h" - -/* {{{ arginfo */ -ZEND_BEGIN_ARG_INFO_EX(arginfo_birdstep_connect, 0, 0, 3) - ZEND_ARG_INFO(0, server) - ZEND_ARG_INFO(0, user) - ZEND_ARG_INFO(0, pass) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_birdstep_close, 0, 0, 1) - ZEND_ARG_INFO(0, id) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_birdstep_exec, 0, 0, 2) - ZEND_ARG_INFO(0, index) - ZEND_ARG_INFO(0, exec_str) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_birdstep_fetch, 0, 0, 1) - ZEND_ARG_INFO(0, index) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_birdstep_result, 0, 0, 2) - ZEND_ARG_INFO(0, index) - ZEND_ARG_INFO(0, col) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_birdstep_freeresult, 0, 0, 1) - ZEND_ARG_INFO(0, index) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_birdstep_autocommit, 0, 0, 1) - ZEND_ARG_INFO(0, index) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_birdstep_off_autocommit, 0, 0, 1) - ZEND_ARG_INFO(0, index) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_birdstep_commit, 0, 0, 1) - ZEND_ARG_INFO(0, index) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_birdstep_rollback, 0, 0, 1) - ZEND_ARG_INFO(0, index) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_birdstep_fieldname, 0, 0, 2) - ZEND_ARG_INFO(0, index) - ZEND_ARG_INFO(0, col) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_birdstep_fieldnum, 0, 0, 1) - ZEND_ARG_INFO(0, index) -ZEND_END_ARG_INFO() -/* }}} */ - -const zend_function_entry birdstep_functions[] = { - PHP_FE(birdstep_connect, arginfo_birdstep_connect) - PHP_FE(birdstep_close, arginfo_birdstep_close) - PHP_FE(birdstep_exec, arginfo_birdstep_exec) - PHP_FE(birdstep_fetch, arginfo_birdstep_fetch) - PHP_FE(birdstep_result, arginfo_birdstep_result) - PHP_FE(birdstep_freeresult, arginfo_birdstep_freeresult) - PHP_FE(birdstep_autocommit, arginfo_birdstep_autocommit) - PHP_FE(birdstep_off_autocommit, arginfo_birdstep_off_autocommit) - PHP_FE(birdstep_commit, arginfo_birdstep_commit) - PHP_FE(birdstep_rollback, arginfo_birdstep_rollback) - PHP_FE(birdstep_fieldnum, arginfo_birdstep_fieldnum) - PHP_FE(birdstep_fieldname, arginfo_birdstep_fieldname) -/* - * Temporary Function aliases until the next major upgrade to PHP. - * These should allow users to continue to use their current scripts, - * but should in reality warn the user that this functionality is - * deprecated. - */ - PHP_FALIAS(velocis_connect, birdstep_connect, arginfo_birdstep_connect) - PHP_FALIAS(velocis_close, birdstep_close, arginfo_birdstep_close) - PHP_FALIAS(velocis_exec, birdstep_exec, arginfo_birdstep_exec) - PHP_FALIAS(velocis_fetch, birdstep_fetch, arginfo_birdstep_fetch) - PHP_FALIAS(velocis_result, birdstep_result, arginfo_birdstep_result) - PHP_FALIAS(velocis_freeresult, birdstep_freeresult, arginfo_birdstep_freeresult) - PHP_FALIAS(velocis_autocommit, birdstep_autocommit, arginfo_birdstep_autocommit) - PHP_FALIAS(velocis_off_autocommit, birdstep_off_autocommit, arginfo_birdstep_off_autocommit) - PHP_FALIAS(velocis_commit, birdstep_commit, arginfo_birdstep_commit) - PHP_FALIAS(velocis_rollback, birdstep_rollback, arginfo_birdstep_rollback) - PHP_FALIAS(velocis_fieldnum, birdstep_fieldnum, arginfo_birdstep_fieldnum) - PHP_FALIAS(velocis_fieldname, birdstep_fieldname, arginfo_birdstep_fieldname) -/* End temporary aliases */ - PHP_FE_END -}; - -zend_module_entry birdstep_module_entry = { - STANDARD_MODULE_HEADER, - "birdstep", - birdstep_functions, - PHP_MINIT(birdstep), - PHP_MSHUTDOWN(birdstep), - PHP_RINIT(birdstep), - NULL, - PHP_MINFO(birdstep), - PHP_BIRDSTEP_VERSION, - STANDARD_MODULE_PROPERTIES -}; - -#ifdef COMPILE_DL_ODBC -ZEND_GET_MODULE(birdstep) -#endif - -THREAD_LS birdstep_module php_birdstep_module; -THREAD_LS static HENV henv; - -#define PHP_GET_BIRDSTEP_RES_IDX(id) if (!(res = birdstep_find_result(list, id))) { php_error_docref(NULL, E_WARNING, "Birdstep: Not result index (%ld)", id); RETURN_FALSE; } -#define PHP_BIRDSTEP_CHK_LNK(id) if (!(conn = birdstep_find_conn(list, id))) { php_error_docref(NULL, E_WARNING, "Birdstep: Not connection index (%ld)", id); RETURN_FALSE; } - - -static void _close_birdstep_link(zend_rsrc_list_entry *rsrc) -{ - VConn *conn = (VConn *)rsrc->ptr; - - if ( conn ) { - efree(conn); - } -} - -static void _free_birdstep_result(zend_rsrc_list_entry *rsrc) -{ - Vresult *res = (Vresult *)rsrc->ptr; - - if ( res && res->values ) { - register int i; - for ( i=0; i < res->numcols; i++ ) { - if ( res->values[i].value ) - efree(res->values[i].value); - } - efree(res->values); - } - if ( res ) { - efree(res); - } -} - -PHP_MINIT_FUNCTION(birdstep) -{ - SQLAllocEnv(&henv); - - if ( cfg_get_long("birdstep.max_links",&php_birdstep_module.max_links) == FAILURE ) { - php_birdstep_module.max_links = -1; - } - php_birdstep_module.num_links = 0; - php_birdstep_module.le_link = zend_register_list_destructors_ex(_close_birdstep_link, NULL, "birdstep link", module_number); - php_birdstep_module.le_result = zend_register_list_destructors_ex(_free_birdstep_result, NULL, "birdstep result", module_number); - - return SUCCESS; -} - -PHP_RINIT_FUNCTION(birdstep) -{ - return SUCCESS; -} - - -PHP_MINFO_FUNCTION(birdstep) -{ - php_info_print_table_start(); - php_info_print_table_row(2, "RAIMA Birdstep Support", "enabled" ); - php_info_print_table_end(); -} - -PHP_MSHUTDOWN_FUNCTION(birdstep) -{ - SQLFreeEnv(henv); - return SUCCESS; -} - -/* Some internal functions. Connections and result manupulate */ - -static int birdstep_add_conn(HashTable *list,VConn *conn,HDBC hdbc) -{ - int ind; - - ind = zend_list_insert(conn,php_birdstep_module.le_link); - conn->hdbc = hdbc; - conn->index = ind; - - return(ind); -} - -static VConn * birdstep_find_conn(HashTable *list,int ind) -{ - VConn *conn; - int type; - - conn = zend_list_find(ind,&type); - if ( !conn || type != php_birdstep_module.le_link ) { - return(NULL); - } - return(conn); -} - -static void birdstep_del_conn(HashTable *list,int ind) -{ - zend_list_delete(ind); -} - -static int birdstep_add_result(HashTable *list,Vresult *res,VConn *conn) -{ - int ind; - - ind = zend_list_insert(res,php_birdstep_module.le_result); - res->conn = conn; - res->index = ind; - - return(ind); -} - -static Vresult * birdstep_find_result(HashTable *list,int ind) -{ - Vresult *res; - int type; - - res = zend_list_find(ind,&type); - if ( !res || type != php_birdstep_module.le_result ) { - return(NULL); - } - return(res); -} - -static void birdstep_del_result(HashTable *list,int ind) -{ - zend_list_delete(ind); -} - -/* Users functions */ - -/* {{{ proto int birdstep_connect(string server, string user, string pass) - */ -PHP_FUNCTION(birdstep_connect) -{ - char *serv, *user, *pass; - size_t serv_len, user_len, pass_len; - RETCODE stat; - HDBC hdbc; - VConn *new; - zend_long ind; - - if (zend_parse_parameters(ZEND_NUM_ARGS(), "sss", &serv, &serv_len, &user, &user_len, &pass, &pass_len) == FAILURE) { - return; - } - - if ( php_birdstep_module.max_links != -1 && php_birdstep_module.num_links == php_birdstep_module.max_links ) { - php_error_docref(NULL, E_WARNING, "Birdstep: Too many open connections (%d)",php_birdstep_module.num_links); - RETURN_FALSE; - } - - stat = SQLAllocConnect(henv,&hdbc); - if ( stat != SQL_SUCCESS ) { - php_error_docref(NULL, E_WARNING, "Birdstep: Could not allocate connection handle"); - RETURN_FALSE; - } - stat = SQLConnect(hdbc, serv, SQL_NTS, user, SQL_NTS, pass, SQL_NTS); - if ( stat != SQL_SUCCESS && stat != SQL_SUCCESS_WITH_INFO ) { - php_error_docref(NULL, E_WARNING, "Birdstep: Could not connect to server \"%s\" for %s", serv, user); - SQLFreeConnect(hdbc); - RETURN_FALSE; - } - new = (VConn *)emalloc(sizeof(VConn)); - ind = birdstep_add_conn(list,new,hdbc); - php_birdstep_module.num_links++; - RETURN_LONG(ind); -} -/* }}} */ - -/* {{{ proto bool birdstep_close(int id) - */ -PHP_FUNCTION(birdstep_close) -{ - zend_long id; - VConn *conn; - - if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &id) == FAILURE) { - return; - } - - PHP_BIRDSTEP_CHK_LNK(id); - - SQLDisconnect(conn->hdbc); - SQLFreeConnect(conn->hdbc); - birdstep_del_conn(list, id); - php_birdstep_module.num_links--; - RETURN_TRUE; -} -/* }}} */ - -/* {{{ proto int birdstep_exec(int index, string exec_str) - */ -PHP_FUNCTION(birdstep_exec) -{ - char *query; - zend_long ind; - size_t query_len, indx; - VConn *conn; - Vresult *res; - RETCODE stat; - SWORD cols,i,colnamelen; - SDWORD rows,coldesc; - - if (zend_parse_parameters(ZEND_NUM_ARGS(), "ls", &ind, &query, &query_len) == FAILURE) { - return; - } - - PHP_BIRDSTEP_CHK_LNK(ind); - - res = (Vresult *)emalloc(sizeof(Vresult)); - stat = SQLAllocStmt(conn->hdbc,&res->hstmt); - if ( stat != SQL_SUCCESS && stat != SQL_SUCCESS_WITH_INFO ) { - php_error_docref(NULL, E_WARNING, "Birdstep: SQLAllocStmt return %d",stat); - efree(res); - RETURN_FALSE; - } - stat = SQLExecDirect(res->hstmt,query,SQL_NTS); - if ( stat != SQL_SUCCESS && stat != SQL_SUCCESS_WITH_INFO ) { - php_error_docref(NULL, E_WARNING, "Birdstep: Cannot execute \"%s\" query",query); - SQLFreeStmt(res->hstmt,SQL_DROP); - efree(res); - RETURN_FALSE; - } - /* Success query */ - stat = SQLNumResultCols(res->hstmt,&cols); - if ( stat != SQL_SUCCESS ) { - php_error_docref(NULL, E_WARNING, "Birdstep: SQLNumResultCols return %d",stat); - SQLFreeStmt(res->hstmt,SQL_DROP); - efree(res); - RETURN_FALSE; - } - if ( !cols ) { /* Was INSERT, UPDATE, DELETE, etc. query */ - stat = SQLRowCount(res->hstmt,&rows); - if ( stat != SQL_SUCCESS ) { - php_error_docref(NULL, E_WARNING, "Birdstep: SQLNumResultCols return %d",stat); - SQLFreeStmt(res->hstmt,SQL_DROP); - efree(res); - RETURN_FALSE; - } - SQLFreeStmt(res->hstmt,SQL_DROP); - efree(res); - RETURN_LONG(rows); - } else { /* Was SELECT query */ - res->values = (VResVal *)safe_emalloc(sizeof(VResVal), cols, 0); - res->numcols = cols; - for ( i = 0; i < cols; i++ ) { - SQLColAttributes(res->hstmt,i+1,SQL_COLUMN_NAME, - res->values[i].name,sizeof(res->values[i].name), - &colnamelen,NULL); - SQLColAttributes(res->hstmt,i+1,SQL_COLUMN_TYPE, - NULL,0,NULL,&res->values[i].valtype); - switch ( res->values[i].valtype ) { - case SQL_LONGVARBINARY: - case SQL_LONGVARCHAR: - res->values[i].value = NULL; - continue; - default: - break; - } - SQLColAttributes(res->hstmt,i+1,SQL_COLUMN_DISPLAY_SIZE, - NULL,0,NULL,&coldesc); - res->values[i].value = (char *)emalloc(coldesc+1); - SQLBindCol(res->hstmt,i+1,SQL_C_CHAR, res->values[i].value,coldesc+1, &res->values[i].vallen); - } - } - res->fetched = 0; - indx = birdstep_add_result(list,res,conn); - RETURN_LONG(indx); -} -/* }}} */ - -/* {{{ proto bool birdstep_fetch(int index) - */ -PHP_FUNCTION(birdstep_fetch) -{ - zend_long ind; - Vresult *res; - RETCODE stat; - UDWORD row; - UWORD RowStat[1]; - - if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &ind) == FAILURE) { - return; - } - - PHP_GET_BIRDSTEP_RES_IDX(ind); - - stat = SQLExtendedFetch(res->hstmt,SQL_FETCH_NEXT,1,&row,RowStat); - if ( stat == SQL_NO_DATA_FOUND ) { - SQLFreeStmt(res->hstmt,SQL_DROP); - birdstep_del_result(list,Z_LVAL_PP(ind)); - RETURN_FALSE; - } - if ( stat != SQL_SUCCESS && stat != SQL_SUCCESS_WITH_INFO ) { - php_error_docref(NULL, E_WARNING, "Birdstep: SQLFetch return error"); - SQLFreeStmt(res->hstmt,SQL_DROP); - birdstep_del_result(list,Z_LVAL_PP(ind)); - RETURN_FALSE; - } - res->fetched = 1; - RETURN_TRUE; -} -/* }}} */ - -/* {{{ proto mixed birdstep_result(int index, mixed col) - */ -PHP_FUNCTION(birdstep_result) -{ - zval **col; - zend_long ind; - Vresult *res; - RETCODE stat; - int i,sql_c_type; - UDWORD row; - UWORD RowStat[1]; - SWORD indx = -1; - char *field = NULL; - - if (zend_parse_parameters(ZEND_NUM_ARGS(), "lZ", &ind, &col) == FAILURE) { - return; - } - - PHP_GET_BIRDSTEP_RES_IDX(ind); - - if ( Z_TYPE_PP(col) == IS_STRING ) { - field = Z_STRVAL_PP(col); - } else { - convert_to_long_ex(col); - indx = Z_LVAL_PP(col); - } - if ( field ) { - for ( i = 0; i < res->numcols; i++ ) { - if ( !strcasecmp(res->values[i].name,field)) { - indx = i; - break; - } - } - if ( indx < 0 ) { - php_error_docref(NULL, E_WARNING, "Field %s not found",field); - RETURN_FALSE; - } - } else { - if ( indx < 0 || indx >= res->numcols ) { - php_error_docref(NULL, E_WARNING, "Birdstep: Field index not in range"); - RETURN_FALSE; - } - } - if ( !res->fetched ) { - stat = SQLExtendedFetch(res->hstmt,SQL_FETCH_NEXT,1,&row,RowStat); - if ( stat == SQL_NO_DATA_FOUND ) { - SQLFreeStmt(res->hstmt,SQL_DROP); - birdstep_del_result(list,Z_LVAL_PP(ind)); - RETURN_FALSE; - } - if ( stat != SQL_SUCCESS && stat != SQL_SUCCESS_WITH_INFO ) { - php_error_docref(NULL, E_WARNING, "Birdstep: SQLFetch return error"); - SQLFreeStmt(res->hstmt,SQL_DROP); - birdstep_del_result(list,Z_LVAL_PP(ind)); - RETURN_FALSE; - } - res->fetched = 1; - } - switch ( res->values[indx].valtype ) { - case SQL_LONGVARBINARY: - sql_c_type = SQL_C_BINARY; - goto l1; - case SQL_LONGVARCHAR: - sql_c_type = SQL_C_CHAR; -l1: - if ( !res->values[indx].value ) { - res->values[indx].value = emalloc(4096); - } - stat = SQLGetData(res->hstmt,indx+1,sql_c_type, - res->values[indx].value,4095,&res->values[indx].vallen); - if ( stat == SQL_NO_DATA_FOUND ) { - SQLFreeStmt(res->hstmt,SQL_DROP); - birdstep_del_result(list,Z_LVAL_PP(ind)); - RETURN_FALSE; - } - if ( stat != SQL_SUCCESS && stat != SQL_SUCCESS_WITH_INFO ) { - php_error_docref(NULL, E_WARNING, "Birdstep: SQLGetData return error"); - SQLFreeStmt(res->hstmt,SQL_DROP); - birdstep_del_result(list,Z_LVAL_PP(ind)); - RETURN_FALSE; - } - if ( res->values[indx].valtype == SQL_LONGVARCHAR ) { - RETURN_STRING(res->values[indx].value,TRUE); - } else { - RETURN_LONG((zend_long)res->values[indx].value); - } - default: - if ( res->values[indx].value != NULL ) { - RETURN_STRING(res->values[indx].value,TRUE); - } - } -} -/* }}} */ - -/* {{{ proto bool birdstep_freeresult(int index) - */ -PHP_FUNCTION(birdstep_freeresult) -{ - zend_long ind; - Vresult *res; - - if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &ind) == FAILURE) { - return; - } - - PHP_GET_BIRDSTEP_RES_IDX(ind); - - SQLFreeStmt(res->hstmt,SQL_DROP); - birdstep_del_result(list, ind); - RETURN_TRUE; -} -/* }}} */ - -/* {{{ proto bool birdstep_autocommit(int index) - */ -PHP_FUNCTION(birdstep_autocommit) -{ - zend_long id; - RETCODE stat; - VConn *conn; - - if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &id) == FAILURE) { - return; - } - - PHP_BIRDSTEP_CHK_LNK(id); - - stat = SQLSetConnectOption(conn->hdbc,SQL_AUTOCOMMIT,SQL_AUTOCOMMIT_ON); - if ( stat != SQL_SUCCESS && stat != SQL_SUCCESS_WITH_INFO ) { - php_error_docref(NULL, E_WARNING, "Birdstep: Set autocommit_on option failure"); - RETURN_FALSE; - } - RETURN_TRUE; -} -/* }}} */ - -/* {{{ proto bool birdstep_off_autocommit(int index) - */ -PHP_FUNCTION(birdstep_off_autocommit) -{ - zend_long id; - RETCODE stat; - VConn *conn; - - if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &id) == FAILURE) { - return; - } - - PHP_BIRDSTEP_CHK_LNK(id); - - stat = SQLSetConnectOption(conn->hdbc,SQL_AUTOCOMMIT,SQL_AUTOCOMMIT_OFF); - if ( stat != SQL_SUCCESS && stat != SQL_SUCCESS_WITH_INFO ) { - php_error_docref(NULL, E_WARNING, "Birdstep: Set autocommit_off option failure"); - RETURN_FALSE; - } - RETURN_TRUE; -} -/* }}} */ - -/* {{{ proto bool birdstep_commit(int index) - */ -PHP_FUNCTION(birdstep_commit) -{ - zend_long id; - RETCODE stat; - VConn *conn; - - if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &id) == FAILURE) { - return; - } - - PHP_BIRDSTEP_CHK_LNK(id) - - stat = SQLTransact(NULL,conn->hdbc,SQL_COMMIT); - if ( stat != SQL_SUCCESS ) { - php_error_docref(NULL, E_WARNING, "Birdstep: Commit failure"); - RETURN_FALSE; - } - RETURN_TRUE; -} -/* }}} */ - -/* {{{ proto bool birdstep_rollback(int index) - */ -PHP_FUNCTION(birdstep_rollback) -{ - zend_long id; - RETCODE stat; - VConn *conn; - - if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &id) == FAILURE) { - return; - } - - PHP_BIRDSTEP_CHK_LNK(id); - - stat = SQLTransact(NULL,conn->hdbc,SQL_ROLLBACK); - if ( stat != SQL_SUCCESS ) { - php_error_docref(NULL, E_WARNING, "Birdstep: Rollback failure"); - RETURN_FALSE; - } - RETURN_TRUE; -} -/* }}} */ - -/* {{{ proto string birdstep_fieldname(int index, int col) - */ -PHP_FUNCTION(birdstep_fieldname) -{ - zend_long ind, col; - Vresult *res; - SWORD indx; - - if (zend_parse_parameters(ZEND_NUM_ARGS(), "ll", &ind, &col) == FAILURE) { - return; - } - - PHP_GET_BIRDSTEP_RES_IDX(ind); - - indx = col; - if ( indx < 0 || indx >= res->numcols ) { - php_error_docref(NULL, E_WARNING, "Birdstep: Field index not in range"); - RETURN_FALSE; - } - RETURN_STRING(res->values[indx].name,TRUE); -} -/* }}} */ - -/* {{{ proto int birdstep_fieldnum(int index) - */ -PHP_FUNCTION(birdstep_fieldnum) -{ - zend_long ind; - Vresult *res; - - if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &ind) == FAILURE) { - return; - } - - PHP_GET_BIRDSTEP_RES_IDX(ind); - - RETURN_LONG(res->numcols); -} -/* }}} */ - -#endif /* HAVE_BIRDSTEP */ - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * End: - */ diff --git a/ext/odbc/config.m4 b/ext/odbc/config.m4 index ecee15fd1cdee..fab38019a398c 100644 --- a/ext/odbc/config.m4 +++ b/ext/odbc/config.m4 @@ -219,28 +219,6 @@ You need to source your DB2 environment before running PHP configure: fi fi -if test -z "$ODBC_TYPE"; then -PHP_ARG_WITH(ODBCRouter,, -[ --with-ODBCRouter[=DIR] Include ODBCRouter.com support [/usr]]) - - AC_MSG_CHECKING(for ODBCRouter.com support) - if test "$PHP_ODBCROUTER" != "no"; then - if test "$PHP_ODBCROUTER" = "yes"; then - PHP_ODBCROUTER=/usr - fi - ODBC_INCDIR=$PHP_ODBCROUTER/include - ODBC_LIBDIR=$PHP_ODBCROUTER/lib - ODBC_LFLAGS=-L$ODBC_LIBDIR - ODBC_INCLUDE=-I$ODBC_INCDIR - ODBC_LIBS=-lodbcsdk - ODBC_TYPE=ODBCRouter - AC_DEFINE(HAVE_ODBC_ROUTER,1,[ ]) - AC_MSG_RESULT([$ext_output]) - else - AC_MSG_RESULT(no) - fi -fi - if test -z "$ODBC_TYPE"; then PHP_ARG_WITH(empress,, [ --with-empress[=DIR] Include Empress support [\$EMPRESSPATH] @@ -308,55 +286,6 @@ PHP_ARG_WITH(empress-bcs,, fi fi -if test -z "$ODBC_TYPE"; then -PHP_ARG_WITH(birdstep,, -[ --with-birdstep[=DIR] Include Birdstep support [/usr/local/birdstep]]) - - AC_MSG_CHECKING(for Birdstep support) - if test "$PHP_BIRDSTEP" != "no"; then - if test "$PHP_BIRDSTEP" = "yes"; then - ODBC_INCDIR=/usr/local/birdstep/include - ODBC_LIBDIR=/usr/local/birdstep/lib - else - ODBC_INCDIR=$PHP_BIRDSTEP/include - ODBC_LIBDIR=$PHP_BIRDSTEP/$PHP_LIBDIR - fi - - case $host_alias in - *aix*[)] - AC_DEFINE(AIX,1,[ ]);; - *hpux*[)] - AC_DEFINE(HPUX,1,[ ]);; - *linux*[)] - AC_DEFINE(LINUX,1,[ ]);; - *qnx*[)] - AC_DEFINE(NEUTRINO,1,[ ]);; - i?86-*-solaris*[)] - AC_DEFINE(ISOLARIS,1,[ ]);; - sparc-*-solaris*[)] - AC_DEFINE(SOLARIS,1,[ ]);; - *unixware*[)] - AC_DEFINE(UNIXWARE,1,[ ]);; - esac - - ODBC_INCLUDE=-I$ODBC_INCDIR - ODBC_TYPE=birdstep - ODBC_LFLAGS=-L$ODBC_LIBDIR - ODBC_LIBS="-lCadm -lCdict -lCenc -lCrdm -lCrpc -lCrdbc -lCrm -lCuapi -lutil" - - if test -f "$ODBC_LIBDIR/libCrdbc32.$SHLIB_SUFFIX_NAME"; then - ODBC_LIBS="-lCrdbc32 -lCadm32 -lCncp32 -lCrm32 -lCsql32 -lCdict32 -lCrdm32 -lCrpc32 -lutil" - elif test -f "$ODBC_LIBDIR/libCrdbc.$SHLIB_SUFFIX_NAME"; then - ODBC_LIBS="-lCrdbc -lCadm -lCncp -lCrm -lCsql -lCdict -lCrdm -lCrpc -lutil" - fi - - AC_DEFINE(HAVE_BIRDSTEP,1,[ ]) - AC_MSG_RESULT([$ext_output]) - else - AC_MSG_RESULT(no) - fi -fi - if test -z "$ODBC_TYPE"; then PHP_ARG_WITH(custom-odbc,, [ --with-custom-odbc[=DIR] Include user defined ODBC support. DIR is ODBC install base @@ -536,7 +465,7 @@ dnl if test -n "$ODBC_TYPE"; then if test "$ODBC_TYPE" != "dbmaker"; then PHP_EVAL_LIBLINE([$ODBC_LFLAGS $ODBC_LIBS], ODBC_SHARED_LIBADD) - if test "$ODBC_TYPE" != "birdstep" && test "$ODBC_TYPE" != "solid"; then + if test "$ODBC_TYPE" != "solid"; then AC_DEFINE(HAVE_SQLDATASOURCES,1,[ ]) fi fi diff --git a/ext/odbc/php_birdstep.h b/ext/odbc/php_birdstep.h deleted file mode 100644 index 43787ca4783d5..0000000000000 --- a/ext/odbc/php_birdstep.h +++ /dev/null @@ -1,95 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | PHP Version 7 | - +----------------------------------------------------------------------+ - | Copyright (c) 1997-2017 The PHP Group | - +----------------------------------------------------------------------+ - | This source file is subject to version 3.01 of the PHP license, | - | that is bundled with this package in the file LICENSE, and is | - | available through the world-wide-web at the following url: | - | http://www.php.net/license/3_01.txt | - | If you did not receive a copy of the PHP license and are unable to | - | obtain it through the world-wide-web, please send a note to | - | license@php.net so we can mail you a copy immediately. | - +----------------------------------------------------------------------+ - | Authors: Nikolay P. Romanyuk | - +----------------------------------------------------------------------+ -*/ - -/* $Id$ */ - -#ifndef PHP_BIRDSTEP_H -#define PHP_BIRDSTEP_H - -#if defined(HAVE_BIRDSTEP) && !HAVE_UODBC -#define UNIX -#include -#include - -#include "php_version.h" -#define PHP_BIRDSTEP_VERSION PHP_VERSION - -typedef struct VConn { - HDBC hdbc; - zend_long index; -} VConn; - -typedef struct { - char name[32]; - char *value; - zend_long vallen; - SDWORD valtype; -} VResVal; - -typedef struct Vresult { - HSTMT hstmt; - VConn *conn; - zend_long index; - VResVal *values; - zend_long numcols; - int fetched; -} Vresult; - -typedef struct { - zend_long num_links; - zend_long max_links; - int le_link,le_result; -} birdstep_module; - -extern zend_module_entry birdstep_module_entry; -#define birdstep_module_ptr &birdstep_module_entry - -/* birdstep.c functions */ -PHP_MINIT_FUNCTION(birdstep); -PHP_RINIT_FUNCTION(birdstep); -PHP_MINFO_FUNCTION(birdstep); -PHP_MSHUTDOWN_FUNCTION(birdstep); - -PHP_FUNCTION(birdstep_connect); -PHP_FUNCTION(birdstep_close); -PHP_FUNCTION(birdstep_exec); -PHP_FUNCTION(birdstep_fetch); -PHP_FUNCTION(birdstep_result); -PHP_FUNCTION(birdstep_freeresult); -PHP_FUNCTION(birdstep_autocommit); -PHP_FUNCTION(birdstep_off_autocommit); -PHP_FUNCTION(birdstep_commit); -PHP_FUNCTION(birdstep_rollback); -PHP_FUNCTION(birdstep_fieldnum); -PHP_FUNCTION(birdstep_fieldname); - -extern birdstep_module php_birdstep_module; - -#else - -#define birdstep_module_ptr NULL - -#endif /* HAVE_BIRDSTEP */ -#endif /* PHP_BIRDSTEP_H */ - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * End: - */ diff --git a/ext/odbc/php_odbc.c b/ext/odbc/php_odbc.c index bfaa0b89ac49b..010eaa6a18504 100644 --- a/ext/odbc/php_odbc.c +++ b/ext/odbc/php_odbc.c @@ -15,7 +15,7 @@ | Authors: Stig Sæther Bakken | | Andreas Karajannis | | Frank M. Kromann Support for DB/2 CLI | - | Kevin N. Shallow Birdstep Support| + | Kevin N. Shallow | | Daniel R. Kalowsky | +----------------------------------------------------------------------+ */ @@ -258,7 +258,6 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_odbc_primarykeys, 0, 0, 4) ZEND_END_ARG_INFO() #if !defined(HAVE_SOLID) && !defined(HAVE_SOLID_30) && !defined(HAVE_SOLID_35) -#if !defined(HAVE_BIRDSTEP) ZEND_BEGIN_ARG_INFO_EX(arginfo_odbc_procedurecolumns, 0, 0, 1) ZEND_ARG_INFO(0, connection_id) ZEND_ARG_INFO(0, qualifier) @@ -266,7 +265,6 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_odbc_procedurecolumns, 0, 0, 1) ZEND_ARG_INFO(0, proc) ZEND_ARG_INFO(0, column) ZEND_END_ARG_INFO() -#endif ZEND_BEGIN_ARG_INFO_EX(arginfo_odbc_procedures, 0, 0, 1) ZEND_ARG_INFO(0, connection_id) @@ -305,7 +303,7 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_odbc_statistics, 0, 0, 6) ZEND_ARG_INFO(0, accuracy) ZEND_END_ARG_INFO() -#if !defined(HAVE_DBMAKER) && !defined(HAVE_SOLID) && !defined(HAVE_SOLID_30) &&!defined(HAVE_SOLID_35) && !defined(HAVE_BIRDSTEP) +#if !defined(HAVE_DBMAKER) && !defined(HAVE_SOLID) && !defined(HAVE_SOLID_30) &&!defined(HAVE_SOLID_35) ZEND_BEGIN_ARG_INFO_EX(arginfo_odbc_tableprivileges, 0, 0, 4) ZEND_ARG_INFO(0, connection_id) ZEND_ARG_INFO(0, qualifier) @@ -370,16 +368,14 @@ const zend_function_entry odbc_functions[] = { PHP_FE(odbc_statistics, arginfo_odbc_statistics) PHP_FE(odbc_tables, arginfo_odbc_tables) PHP_FE(odbc_primarykeys, arginfo_odbc_primarykeys) -#if !defined(HAVE_DBMAKER) && !defined(HAVE_SOLID) && !defined(HAVE_SOLID_30) &&!defined(HAVE_SOLID_35) && !defined(HAVE_BIRDSTEP) /* not supported now */ +#if !defined(HAVE_DBMAKER) && !defined(HAVE_SOLID) && !defined(HAVE_SOLID_30) &&!defined(HAVE_SOLID_35) /* not supported now */ PHP_FE(odbc_columnprivileges, arginfo_odbc_columnprivileges) PHP_FE(odbc_tableprivileges, arginfo_odbc_tableprivileges) #endif #if !defined(HAVE_SOLID) && !defined(HAVE_SOLID_30) && !defined(HAVE_SOLID_35) /* not supported */ PHP_FE(odbc_foreignkeys, arginfo_odbc_foreignkeys) PHP_FE(odbc_procedures, arginfo_odbc_procedures) -#if !defined(HAVE_BIRDSTEP) PHP_FE(odbc_procedurecolumns, arginfo_odbc_procedurecolumns) -#endif #endif PHP_FALIAS(odbc_do, odbc_exec, arginfo_odbc_exec) PHP_FALIAS(odbc_field_precision, odbc_field_len, arginfo_odbc_field_len) @@ -2447,45 +2443,6 @@ int odbc_sqlconnect(odbc_connection **conn, char *db, char *uid, char *pwd, int SQLSetConnectOption((*conn)->hdbc, SQL_TRANSLATE_OPTION, SQL_SOLID_XLATOPT_NOCNV); #endif -#ifdef HAVE_ODBC_ROUTER - { -#define CONNSTRSIZE 2048 - char *lpszConnStr = emalloc(CONNSTRSIZE); - if (lpszConnStr && db) { - short cbszConnStr; - if (strstr(db, ";")) { - /* the caller has apparently passed a connection-string */ - if (strstr(db, "uid") || strstr(db, "UID")) { - uid = NULL; - } - if (strstr(db, "pwd") || strstr(db, "PWD")) { - pwd = NULL; - } - strlcpy( lpszConnStr, db, CONNSTRSIZE); - } - else { - strcpy(lpszConnStr, "DSN="); - strlcat(lpszConnStr, db, CONNSTRSIZE); - } - if (uid) { - if (uid[0]) { - strlcat(lpszConnStr, ";UID=", CONNSTRSIZE); - strlcat(lpszConnStr, uid, CONNSTRSIZE); - strlcat(lpszConnStr, ";", CONNSTRSIZE); - } - if (pwd) { - if (pwd[0]) { - strlcat(lpszConnStr, "PWD=", CONNSTRSIZE); - strlcat(lpszConnStr, pwd, CONNSTRSIZE); - strlcat(lpszConnStr, ";", CONNSTRSIZE); - } - } - } - rc = SQLDriverConnect((*conn)->hdbc, NULL, lpszConnStr, SQL_NTS, lpszConnStr, CONNSTRSIZE, &cbszConnStr, SQL_DRIVER_NOPROMPT); - efree(lpszConnStr); - } - } -#else #ifdef HAVE_OPENLINK { char dsnbuf[1024]; @@ -2539,7 +2496,6 @@ int odbc_sqlconnect(odbc_connection **conn, char *db, char *uid, char *pwd, int #else rc = SQLConnect((*conn)->hdbc, db, SQL_NTS, uid, SQL_NTS, pwd, SQL_NTS); #endif -#endif #endif if (rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) { odbc_sql_error(*conn, SQL_NULL_HSTMT, "SQLConnect"); @@ -3289,7 +3245,7 @@ PHP_FUNCTION(odbc_columns) } /* }}} */ -#if !defined(HAVE_DBMAKER) && !defined(HAVE_SOLID) && !defined(HAVE_SOLID_30) && !defined(HAVE_SOLID_35) && !defined(HAVE_BIRDSTEP) +#if !defined(HAVE_DBMAKER) && !defined(HAVE_SOLID) && !defined(HAVE_SOLID_30) && !defined(HAVE_SOLID_35) /* {{{ proto resource odbc_columnprivileges(resource connection_id, string catalog, string schema, string table, string column) Returns a result identifier that can be used to fetch a list of columns and associated privileges for the specified table */ PHP_FUNCTION(odbc_columnprivileges) @@ -3558,7 +3514,7 @@ PHP_FUNCTION(odbc_primarykeys) } /* }}} */ -#if !defined(HAVE_SOLID) && !defined(HAVE_SOLID_30) && !defined(HAVE_SOLID_35) && !defined(HAVE_BIRDSTEP) +#if !defined(HAVE_SOLID) && !defined(HAVE_SOLID_30) && !defined(HAVE_SOLID_35) /* {{{ proto resource odbc_procedurecolumns(resource connection_id [, string qualifier, string owner, string proc, string column]) Returns a result identifier containing the list of input and output parameters, as well as the columns that make up the result set for the specified procedures */ PHP_FUNCTION(odbc_procedurecolumns) @@ -3838,7 +3794,7 @@ PHP_FUNCTION(odbc_statistics) } /* }}} */ -#if !defined(HAVE_DBMAKER) && !defined(HAVE_SOLID) && !defined(HAVE_SOLID_30) && !defined(HAVE_SOLID_35) && !defined(HAVE_BIRDSTEP) +#if !defined(HAVE_DBMAKER) && !defined(HAVE_SOLID) && !defined(HAVE_SOLID_30) && !defined(HAVE_SOLID_35) /* {{{ proto resource odbc_tableprivileges(resource connection_id, string qualifier, string owner, string name) Returns a result identifier containing a list of tables and the privileges associated with each table */ PHP_FUNCTION(odbc_tableprivileges) diff --git a/ext/odbc/php_odbc.h b/ext/odbc/php_odbc.h index b55f43b3ce795..ee5f6da29590f 100644 --- a/ext/odbc/php_odbc.h +++ b/ext/odbc/php_odbc.h @@ -14,7 +14,7 @@ +----------------------------------------------------------------------+ | Authors: Stig Sæther Bakken | | Andreas Karajannis | - | Kevin N. Shallow (Birdstep) | + | Kevin N. Shallow | +----------------------------------------------------------------------+ */ @@ -35,7 +35,7 @@ extern zend_module_entry odbc_module_entry; #include "php_version.h" #define PHP_ODBC_VERSION PHP_VERSION -#if defined(HAVE_DBMAKER) || defined(PHP_WIN32) || defined(HAVE_IBMDB2) || defined(HAVE_UNIXODBC) || defined(HAVE_BIRDSTEP) || defined(HAVE_IODBC) +#if defined(HAVE_DBMAKER) || defined(PHP_WIN32) || defined(HAVE_IBMDB2) || defined(HAVE_UNIXODBC) || defined(HAVE_IODBC) # define PHP_ODBC_HAVE_FETCH_HASH 1 #endif diff --git a/ext/odbc/php_odbc_includes.h b/ext/odbc/php_odbc_includes.h index 43d3360966d17..4dbb188c41742 100644 --- a/ext/odbc/php_odbc_includes.h +++ b/ext/odbc/php_odbc_includes.h @@ -14,7 +14,7 @@ +----------------------------------------------------------------------+ | Authors: Stig Sæther Bakken | | Andreas Karajannis | - | Kevin N. Shallow (Birdstep) | + | Kevin N. Shallow | +----------------------------------------------------------------------+ */ @@ -39,9 +39,7 @@ # include # include #elif defined(HAVE_SOLID_35) -# if !defined(PHP_WIN32) -# include -# endif /* end: #if !defined(PHP_WIN32) */ +# include # include # include # include @@ -121,20 +119,6 @@ PHP_FUNCTION(solid_fetch_prev); #include #define HAVE_SQL_EXTENDED_FETCH 1 -#elif defined(HAVE_ODBC_ROUTER) /* ODBCRouter.com */ - -#ifdef CHAR -#undef CHAR -#endif - -#ifdef SQLCHAR -#undef SQLCHAR -#endif - -#define ODBC_TYPE "ODBCRouter" -#include -#undef HAVE_SQL_EXTENDED_FETCH - #elif defined(HAVE_OPENLINK) /* OpenLink ODBC drivers */ #define ODBC_TYPE "Openlink" @@ -150,23 +134,6 @@ PHP_FUNCTION(solid_fetch_prev); #define SQLUSMALLINT UWORD #endif -#elif defined(HAVE_BIRDSTEP) /* Raima Birdstep */ - -#define ODBC_TYPE "Birdstep" -#define UNIX -/* - * Extended Fetch in the Birdstep ODBC API is incapable of returning zend_long varchar (memo) fields. - * So the following line has been commented-out to accommodate. - KNS - * - * #define HAVE_SQL_EXTENDED_FETCH 1 - */ -#include -#include -#define SQLINTEGER SDWORD -#define SQLSMALLINT SWORD -#define SQLUSMALLINT UWORD - - #elif defined(HAVE_DBMAKER) /* DBMaker */ #define ODBC_TYPE "DBMaker" diff --git a/ext/opcache/Optimizer/block_pass.c b/ext/opcache/Optimizer/block_pass.c index 738e2838068d2..8d99418efdaf7 100644 --- a/ext/opcache/Optimizer/block_pass.c +++ b/ext/opcache/Optimizer/block_pass.c @@ -1750,6 +1750,8 @@ static void zend_t_usage(zend_cfg *cfg, zend_op_array *op_array, zend_bitset use switch (opline->opcode) { case ZEND_POST_INC: case ZEND_POST_DEC: + case ZEND_POST_INC_OBJ: + case ZEND_POST_DEC_OBJ: opline->opcode -= 2; opline->result_type = IS_UNUSED; break; diff --git a/ext/opcache/Optimizer/compact_vars.c b/ext/opcache/Optimizer/compact_vars.c index c5a9b79553d94..016fbfffbcafe 100644 --- a/ext/opcache/Optimizer/compact_vars.c +++ b/ext/opcache/Optimizer/compact_vars.c @@ -20,84 +20,96 @@ #include "Optimizer/zend_optimizer_internal.h" #include "zend_bitset.h" -/* This pass removes all CVs that are completely unused. It does *not* merge any CVs. +/* This pass removes all CVs and temporaries that are completely unused. It does *not* merge any CVs or TMPs. * This pass does not operate on SSA form anymore. */ void zend_optimizer_compact_vars(zend_op_array *op_array) { int i; ALLOCA_FLAG(use_heap1); ALLOCA_FLAG(use_heap2); - uint32_t used_cvs_len = zend_bitset_len(op_array->last_var); - zend_bitset used_cvs = ZEND_BITSET_ALLOCA(used_cvs_len, use_heap1); - uint32_t *cv_map = do_alloca(op_array->last_var * sizeof(uint32_t), use_heap2); - uint32_t num_cvs, tmp_offset; + uint32_t used_vars_len = zend_bitset_len(op_array->last_var + op_array->T); + zend_bitset used_vars = ZEND_BITSET_ALLOCA(used_vars_len, use_heap1); + uint32_t *vars_map = do_alloca((op_array->last_var + op_array->T) * sizeof(uint32_t), use_heap2); + uint32_t num_cvs, num_tmps; /* Determine which CVs are used */ - zend_bitset_clear(used_cvs, used_cvs_len); + zend_bitset_clear(used_vars, used_vars_len); for (i = 0; i < op_array->last; i++) { zend_op *opline = &op_array->opcodes[i]; - if (opline->op1_type == IS_CV) { - zend_bitset_incl(used_cvs, VAR_NUM(opline->op1.var)); + if (opline->op1_type & (IS_CV|IS_VAR|IS_TMP_VAR)) { + zend_bitset_incl(used_vars, VAR_NUM(opline->op1.var)); } - if (opline->op2_type == IS_CV) { - zend_bitset_incl(used_cvs, VAR_NUM(opline->op2.var)); + if (opline->op2_type & (IS_CV|IS_VAR|IS_TMP_VAR)) { + zend_bitset_incl(used_vars, VAR_NUM(opline->op2.var)); } - if (opline->result_type == IS_CV) { - zend_bitset_incl(used_cvs, VAR_NUM(opline->result.var)); + if (opline->result_type & (IS_CV|IS_VAR|IS_TMP_VAR)) { + zend_bitset_incl(used_vars, VAR_NUM(opline->result.var)); + if (opline->opcode == ZEND_ROPE_INIT) { + uint32_t num = ((opline->extended_value * sizeof(zend_string*)) + (sizeof(zval) - 1)) / sizeof(zval); + while (num > 1) { + num--; + zend_bitset_incl(used_vars, VAR_NUM(opline->result.var) + num); + } + } } } num_cvs = 0; for (i = 0; i < op_array->last_var; i++) { - if (zend_bitset_in(used_cvs, i)) { - cv_map[i] = num_cvs++; + if (zend_bitset_in(used_vars, i)) { + vars_map[i] = num_cvs++; + } else { + vars_map[i] = (uint32_t) -1; + } + } + + num_tmps = 0; + for (i = op_array->last_var; i < op_array->last_var + op_array->T; i++) { + if (zend_bitset_in(used_vars, i)) { + vars_map[i] = num_cvs + num_tmps++; } else { - cv_map[i] = (uint32_t) -1; + vars_map[i] = (uint32_t) -1; } } - free_alloca(used_cvs, use_heap1); - if (num_cvs == op_array->last_var) { - free_alloca(cv_map, use_heap2); + free_alloca(used_vars, use_heap1); + if (num_cvs == op_array->last_var && num_tmps == op_array->T) { + free_alloca(vars_map, use_heap2); return; } - ZEND_ASSERT(num_cvs < op_array->last_var); - tmp_offset = op_array->last_var - num_cvs; + ZEND_ASSERT(num_cvs <= op_array->last_var); + ZEND_ASSERT(num_tmps <= op_array->T); /* Update CV and TMP references in opcodes */ for (i = 0; i < op_array->last; i++) { zend_op *opline = &op_array->opcodes[i]; - if (opline->op1_type == IS_CV) { - opline->op1.var = NUM_VAR(cv_map[VAR_NUM(opline->op1.var)]); - } else if (opline->op1_type & (IS_VAR|IS_TMP_VAR)) { - opline->op1.var -= sizeof(zval) * tmp_offset; + if (opline->op1_type & (IS_CV|IS_VAR|IS_TMP_VAR)) { + opline->op1.var = NUM_VAR(vars_map[VAR_NUM(opline->op1.var)]); } - if (opline->op2_type == IS_CV) { - opline->op2.var = NUM_VAR(cv_map[VAR_NUM(opline->op2.var)]); - } else if (opline->op2_type & (IS_VAR|IS_TMP_VAR)) { - opline->op2.var -= sizeof(zval) * tmp_offset; + if (opline->op2_type & (IS_CV|IS_VAR|IS_TMP_VAR)) { + opline->op2.var = NUM_VAR(vars_map[VAR_NUM(opline->op2.var)]); } - if (opline->result_type == IS_CV) { - opline->result.var = NUM_VAR(cv_map[VAR_NUM(opline->result.var)]); - } else if (opline->result_type & (IS_VAR|IS_TMP_VAR)) { - opline->result.var -= sizeof(zval) * tmp_offset; + if (opline->result_type & (IS_CV|IS_VAR|IS_TMP_VAR)) { + opline->result.var = NUM_VAR(vars_map[VAR_NUM(opline->result.var)]); } } /* Update TMP references in live ranges */ if (op_array->live_range) { for (i = 0; i < op_array->last_live_range; i++) { - op_array->live_range[i].var -= sizeof(zval) * tmp_offset; + op_array->live_range[i].var = + (op_array->live_range[i].var & ZEND_LIVE_MASK) | + NUM_VAR(vars_map[VAR_NUM(op_array->live_range[i].var & ~ZEND_LIVE_MASK)]); } } /* Update CV name table */ - { + if (num_cvs != op_array->last_var) { zend_string **names = safe_emalloc(sizeof(zend_string *), num_cvs, 0); for (i = 0; i < op_array->last_var; i++) { - if (cv_map[i] != (uint32_t) -1) { - names[cv_map[i]] = op_array->vars[i]; + if (vars_map[i] != (uint32_t) -1) { + names[vars_map[i]] = op_array->vars[i]; } else { zend_string_release(op_array->vars[i]); } @@ -107,6 +119,7 @@ void zend_optimizer_compact_vars(zend_op_array *op_array) { } op_array->last_var = num_cvs; + op_array->T = num_tmps; - free_alloca(cv_map, use_heap2); + free_alloca(vars_map, use_heap2); } diff --git a/ext/opcache/Optimizer/dce.c b/ext/opcache/Optimizer/dce.c index db9a8a54bc91e..ab2bc622e210c 100644 --- a/ext/opcache/Optimizer/dce.c +++ b/ext/opcache/Optimizer/dce.c @@ -13,6 +13,7 @@ | license@php.net so we can mail you a copy immediately. | +----------------------------------------------------------------------+ | Authors: Nikita Popov | + | Dmitry Stogov | +----------------------------------------------------------------------+ */ @@ -42,6 +43,8 @@ * zend_may_throw(). * * We often cannot DCE assignments and unsets while guaranteeing that dtors run in the same * order. There is an optimization option to allow reordering of dtor effects. + * * The algorithm is able to eliminate dead modifications of non-escaping arrays + * and objects as well as dead arrays and objects allocations. */ typedef struct { @@ -120,6 +123,8 @@ static inline zend_bool may_have_side_effects( case ZEND_ISSET_ISEMPTY_VAR: case ZEND_FETCH_IS: case ZEND_IN_ARRAY: + case ZEND_FUNC_NUM_ARGS: + case ZEND_FUNC_GET_ARGS: /* No side effects */ return 0; case ZEND_JMP: @@ -166,7 +171,9 @@ static inline zend_bool may_have_side_effects( return 1; } if (!reorder_dtor_effects) { - if (opline->op2_type != IS_CONST && (OP2_INFO() & MAY_HAVE_DTOR)) { + if (opline->op2_type != IS_CONST + && (OP2_INFO() & MAY_HAVE_DTOR) + && ssa->vars[ssa_op->op2_use].escape_state != ESCAPE_STATE_NO_ESCAPE) { /* DCE might shorten lifetime */ return 1; } @@ -204,11 +211,34 @@ static inline zend_bool may_have_side_effects( case ZEND_ASSIGN_BW_AND: case ZEND_ASSIGN_BW_XOR: case ZEND_ASSIGN_POW: - if (opline->extended_value) { - /* ASSIGN_DIM has no side-effect, but we can't deal with OP_DATA anyway */ + return is_bad_mod(ssa, ssa_op->op1_use, ssa_op->op1_def) + || (opline->extended_value + && ssa->vars[ssa_op->op1_def].escape_state != ESCAPE_STATE_NO_ESCAPE); + case ZEND_ASSIGN_DIM: + case ZEND_ASSIGN_OBJ: + if (is_bad_mod(ssa, ssa_op->op1_use, ssa_op->op1_def) + || ssa->vars[ssa_op->op1_def].escape_state != ESCAPE_STATE_NO_ESCAPE) { return 1; } - return is_bad_mod(ssa, ssa_op->op1_use, ssa_op->op1_def); + if (!reorder_dtor_effects) { + opline++; + ssa_op++; + if (opline->op1_type != IS_CONST + && (OP1_INFO() & MAY_HAVE_DTOR)) { + /* DCE might shorten lifetime */ + return 1; + } + } + return 0; + case ZEND_PRE_INC_OBJ: + case ZEND_PRE_DEC_OBJ: + case ZEND_POST_INC_OBJ: + case ZEND_POST_DEC_OBJ: + if (is_bad_mod(ssa, ssa_op->op1_use, ssa_op->op1_def) + || ssa->vars[ssa_op->op1_def].escape_state != ESCAPE_STATE_NO_ESCAPE) { + return 1; + } + return 0; default: /* For everything we didn't handle, assume a side-effect */ return 1; @@ -394,112 +424,6 @@ static zend_bool dce_instr(context *ctx, zend_op *opline, zend_ssa_op *ssa_op) { return 1; } -// TODO Move this somewhere else (CFG simplification?) -static int simplify_jumps(zend_ssa *ssa, zend_op_array *op_array) { - int removed_ops = 0; - zend_basic_block *block; - FOREACH_BLOCK(block) { - int block_num = block - ssa->cfg.blocks; - zend_op *opline = &op_array->opcodes[block->start + block->len - 1]; - zend_ssa_op *ssa_op = &ssa->ops[block->start + block->len - 1]; - zval *op1; - - if (block->len == 0) { - continue; - } - - /* Convert jump-and-set into jump if result is not used */ - switch (opline->opcode) { - case ZEND_JMPZ_EX: - ZEND_ASSERT(ssa_op->result_def >= 0); - if (ssa->vars[ssa_op->result_def].use_chain < 0 - && ssa->vars[ssa_op->result_def].phi_use_chain == NULL) { - opline->opcode = ZEND_JMPZ; - opline->result_type = IS_UNUSED; - zend_ssa_remove_result_def(ssa, ssa_op); - } - break; - case ZEND_JMPNZ_EX: - case ZEND_JMP_SET: - ZEND_ASSERT(ssa_op->result_def >= 0); - if (ssa->vars[ssa_op->result_def].use_chain < 0 - && ssa->vars[ssa_op->result_def].phi_use_chain == NULL) { - opline->opcode = ZEND_JMPNZ; - opline->result_type = IS_UNUSED; - zend_ssa_remove_result_def(ssa, ssa_op); - } - break; - } - - /* Convert jump-and-set to QM_ASSIGN/BOOL if the "else" branch is not taken. */ - switch (opline->opcode) { - case ZEND_JMPZ_EX: - case ZEND_JMPNZ_EX: - if (block->successors_count == 1 && block->successors[0] != block_num + 1) { - opline->opcode = ZEND_BOOL; - } - break; - case ZEND_JMP_SET: - case ZEND_COALESCE: - if (block->successors_count == 1 && block->successors[0] != block_num + 1) { - opline->opcode = ZEND_QM_ASSIGN; - } - break; - } - - if (opline->op1_type != IS_CONST) { - continue; - } - - /* Convert constant conditional jump to unconditional jump */ - op1 = &ZEND_OP1_LITERAL(opline); - switch (opline->opcode) { - case ZEND_JMPZ: - if (!zend_is_true(op1)) { - literal_dtor(op1); - opline->op1_type = IS_UNUSED; - opline->op1.num = opline->op2.num; - opline->opcode = ZEND_JMP; - } else { - MAKE_NOP(opline); - removed_ops++; - } - break; - case ZEND_JMPNZ: - if (zend_is_true(op1)) { - literal_dtor(op1); - opline->op1_type = IS_UNUSED; - opline->op1.num = opline->op2.num; - opline->opcode = ZEND_JMP; - } else { - MAKE_NOP(opline); - removed_ops++; - } - break; - case ZEND_COALESCE: - ZEND_ASSERT(ssa_op->result_def >= 0); - if (ssa->vars[ssa_op->result_def].use_chain >= 0 - || ssa->vars[ssa_op->result_def].phi_use_chain != NULL) { - break; - } - - zend_ssa_remove_result_def(ssa, ssa_op); - if (Z_TYPE_P(op1) != IS_NULL) { - literal_dtor(op1); - opline->op1_type = IS_UNUSED; - opline->op1.num = opline->op2.num; - opline->opcode = ZEND_JMP; - opline->result_type = IS_UNUSED; - } else { - MAKE_NOP(opline); - removed_ops++; - } - break; - } - } FOREACH_BLOCK_END(); - return removed_ops; -} - static inline int get_common_phi_source(zend_ssa *ssa, zend_ssa_phi *phi) { int common_source = -1; int source; @@ -645,6 +569,8 @@ int dce_optimize_op_array(zend_op_array *op_array, zend_ssa *ssa, zend_bool reor /* Mark reacable instruction without side effects as dead */ int b = ssa->cfg.blocks_count; while (b > 0) { + int op_data = -1; + b--; zend_basic_block *block = &ssa->cfg.blocks[b]; if (!(block->flags & ZEND_BB_REACHABLE)) { @@ -654,17 +580,39 @@ int dce_optimize_op_array(zend_op_array *op_array, zend_ssa *ssa, zend_bool reor while (i > block->start) { i--; + if (op_array->opcodes[i].opcode == ZEND_OP_DATA) { + op_data = i; + continue; + } + if (zend_bitset_in(ctx.instr_worklist, i)) { zend_bitset_excl(ctx.instr_worklist, i); add_operands_to_worklists(&ctx, &op_array->opcodes[i], &ssa->ops[i], 0); + if (op_data >= 0) { + add_operands_to_worklists(&ctx, &op_array->opcodes[op_data], &ssa->ops[op_data], 0); + } } else if (may_have_side_effects(op_array, ssa, &op_array->opcodes[i], &ssa->ops[i], ctx.reorder_dtor_effects) || zend_may_throw(&op_array->opcodes[i], op_array, ssa) || (has_varargs && may_break_varargs(op_array, ssa, &ssa->ops[i]))) { - add_operands_to_worklists(&ctx, &op_array->opcodes[i], &ssa->ops[i], 0); + if (op_array->opcodes[i].opcode == ZEND_NEW + && op_array->opcodes[i+1].opcode == ZEND_DO_FCALL + && ssa->ops[i].result_def >= 0 + && ssa->vars[ssa->ops[i].result_def].escape_state == ESCAPE_STATE_NO_ESCAPE) { + zend_bitset_incl(ctx.instr_dead, i); + zend_bitset_incl(ctx.instr_dead, i+1); + } else { + add_operands_to_worklists(&ctx, &op_array->opcodes[i], &ssa->ops[i], 0); + if (op_data >= 0) { + add_operands_to_worklists(&ctx, &op_array->opcodes[op_data], &ssa->ops[op_data], 0); + } + } } else { zend_bitset_incl(ctx.instr_dead, i); + if (op_data >= 0) { + zend_bitset_incl(ctx.instr_dead, op_data); + } } - + op_data = -1; } } @@ -674,6 +622,10 @@ int dce_optimize_op_array(zend_op_array *op_array, zend_ssa *ssa, zend_bool reor while ((i = zend_bitset_pop_first(ctx.instr_worklist, ctx.instr_worklist_len)) >= 0) { zend_bitset_excl(ctx.instr_dead, i); add_operands_to_worklists(&ctx, &op_array->opcodes[i], &ssa->ops[i], 1); + if (i < op_array->last && op_array->opcodes[i+1].opcode == ZEND_OP_DATA) { + zend_bitset_excl(ctx.instr_dead, i+1); + add_operands_to_worklists(&ctx, &op_array->opcodes[i+1], &ssa->ops[i+1], 1); + } } while ((i = zend_bitset_pop_first(ctx.phi_worklist, ctx.phi_worklist_len)) >= 0) { zend_bitset_excl(ctx.phi_dead, i); @@ -715,7 +667,5 @@ int dce_optimize_op_array(zend_op_array *op_array, zend_ssa *ssa, zend_bool reor } } FOREACH_PHI_END(); - removed_ops += simplify_jumps(ssa, op_array); - return removed_ops; } diff --git a/ext/opcache/Optimizer/dfa_pass.c b/ext/opcache/Optimizer/dfa_pass.c index ca4ca15e194db..b62b35c8b6ba3 100644 --- a/ext/opcache/Optimizer/dfa_pass.c +++ b/ext/opcache/Optimizer/dfa_pass.c @@ -115,6 +115,10 @@ int zend_dfa_analyze_op_array(zend_op_array *op_array, zend_optimizer_ctx *ctx, return FAILURE; } + if (zend_ssa_escape_analysis(ctx->script, op_array, ssa) != SUCCESS) { + return FAILURE; + } + if (ctx->debug_level & ZEND_DUMP_DFA_SSA_VARS) { zend_dump_ssa_variables(op_array, ssa, 0); } @@ -387,8 +391,7 @@ int zend_dfa_optimize_calls(zend_op_array *op_array, zend_ssa *ssa) zend_ulong idx; ZVAL_TRUE(&tmp); - dst = emalloc(sizeof(HashTable)); - zend_hash_init(dst, zend_hash_num_elements(src), NULL, ZVAL_PTR_DTOR, 0); + dst = zend_new_array(zend_hash_num_elements(src)); if (strict) { ZEND_HASH_FOREACH_VAL(src, val) { if (Z_TYPE_P(val) == IS_STRING) { @@ -459,11 +462,160 @@ int zend_dfa_optimize_calls(zend_op_array *op_array, zend_ssa *ssa) return removed_ops; } +static zend_always_inline void take_successor_0(zend_ssa *ssa, int block_num, zend_basic_block *block) +{ + if (block->successors_count == 2) { + if (block->successors[1] != block->successors[0]) { + zend_ssa_remove_predecessor(ssa, block_num, block->successors[1]); + } + block->successors_count = 1; + } +} + +static zend_always_inline void take_successor_1(zend_ssa *ssa, int block_num, zend_basic_block *block) +{ + if (block->successors_count == 2) { + if (block->successors[1] != block->successors[0]) { + zend_ssa_remove_predecessor(ssa, block_num, block->successors[0]); + block->successors[0] = block->successors[1]; + } + block->successors_count = 1; + } +} + +static void compress_block(zend_op_array *op_array, zend_basic_block *block) +{ + while (block->len > 0) { + zend_op *opline = &op_array->opcodes[block->start + block->len - 1]; + + if (opline->opcode == ZEND_NOP + && (block->len == 1 || !zend_is_smart_branch(opline - 1))) { + block->len--; + } else { + break; + } + } +} + +static void zend_ssa_replace_control_link(zend_op_array *op_array, zend_ssa *ssa, int from, int to, int new_to) +{ + zend_basic_block *src = &ssa->cfg.blocks[from]; + zend_basic_block *old = &ssa->cfg.blocks[to]; + zend_basic_block *dst = &ssa->cfg.blocks[new_to]; + int *predecessors = &ssa->cfg.predecessors[dst->predecessor_offset]; + int dup = 0; + int i; + zend_op *opline; + + for (i = 0; i < src->successors_count; i++) { + if (src->successors[i] == to) { + src->successors[i] = new_to; + } + } + + if (src->len > 0) { + opline = op_array->opcodes + src->start + src->len - 1; + switch (opline->opcode) { + case ZEND_JMP: + case ZEND_FAST_CALL: + ZEND_ASSERT(ZEND_OP1_JMP_ADDR(opline) == op_array->opcodes + old->start); + ZEND_SET_OP_JMP_ADDR(opline, opline->op1, op_array->opcodes + dst->start); + break; + case ZEND_JMPZNZ: + if (ZEND_OFFSET_TO_OPLINE_NUM(op_array, opline, opline->extended_value) == old->start) { + opline->extended_value = ZEND_OPLINE_NUM_TO_OFFSET(op_array, opline, dst->start); + } + /* break missing intentionally */ + case ZEND_JMPZ: + case ZEND_JMPNZ: + case ZEND_JMPZ_EX: + case ZEND_JMPNZ_EX: + case ZEND_FE_RESET_R: + case ZEND_FE_RESET_RW: + case ZEND_JMP_SET: + case ZEND_COALESCE: + case ZEND_ASSERT_CHECK: + if (ZEND_OP2_JMP_ADDR(opline) == op_array->opcodes + old->start) { + ZEND_SET_OP_JMP_ADDR(opline, opline->op2, op_array->opcodes + dst->start); + } + break; + case ZEND_CATCH: + if (!opline->result.num) { + if (ZEND_OFFSET_TO_OPLINE_NUM(op_array, opline, opline->extended_value) == old->start) { + opline->extended_value = ZEND_OPLINE_NUM_TO_OFFSET(op_array, opline, dst->start); + } + } + break; + case ZEND_DECLARE_ANON_CLASS: + case ZEND_DECLARE_ANON_INHERITED_CLASS: + case ZEND_FE_FETCH_R: + case ZEND_FE_FETCH_RW: + if (ZEND_OFFSET_TO_OPLINE_NUM(op_array, opline, opline->extended_value) == old->start) { + opline->extended_value = ZEND_OPLINE_NUM_TO_OFFSET(op_array, opline, dst->start); + } + break; + case ZEND_SWITCH_LONG: + case ZEND_SWITCH_STRING: + { + HashTable *jumptable = Z_ARRVAL(ZEND_OP2_LITERAL(opline)); + zval *zv; + ZEND_HASH_FOREACH_VAL(jumptable, zv) { + if (ZEND_OFFSET_TO_OPLINE_NUM(op_array, opline, Z_LVAL_P(zv)) == old->start) { + Z_LVAL_P(zv) = ZEND_OPLINE_NUM_TO_OFFSET(op_array, opline, dst->start); + } + } ZEND_HASH_FOREACH_END(); + if (ZEND_OFFSET_TO_OPLINE_NUM(op_array, opline, opline->extended_value) == old->start) { + opline->extended_value = ZEND_OPLINE_NUM_TO_OFFSET(op_array, opline, dst->start); + } + break; + } + } + } + + for (i = 0; i < dst->predecessors_count; i++) { + if (dup) { + predecessors[i] = predecessors[i+1]; + } else if (predecessors[i] == to) { + predecessors[i] = from; + } else if (predecessors[i] == from) { + dup = 1; + dst->predecessors_count--; + } + } +} + +static void zend_ssa_unlink_block(zend_op_array *op_array, zend_ssa *ssa, zend_basic_block *block, int block_num) +{ + if (block->predecessors_count == 1 && ssa->blocks[block_num].phis == NULL) { + int *predecessors, i; + + ZEND_ASSERT(block->successors_count == 1); + predecessors = &ssa->cfg.predecessors[block->predecessor_offset]; + for (i = 0; i < block->predecessors_count; i++) { + zend_ssa_replace_control_link(op_array, ssa, predecessors[i], block_num, block->successors[0]); + } + zend_ssa_remove_block(op_array, ssa, block_num); + } +} + static int zend_dfa_optimize_jmps(zend_op_array *op_array, zend_ssa *ssa) { int removed_ops = 0; int block_num = 0; + for (block_num = 1; block_num < ssa->cfg.blocks_count; block_num++) { + zend_basic_block *block = &ssa->cfg.blocks[block_num]; + + if (!(block->flags & ZEND_BB_REACHABLE)) { + continue; + } + compress_block(op_array, block); + if (block->len == 0) { + zend_ssa_unlink_block(op_array, ssa, block, block_num); + } + } + + block_num = 0; while (block_num < ssa->cfg.blocks_count && !(ssa->cfg.blocks[block_num].flags & ZEND_BB_REACHABLE)) { block_num++; @@ -473,7 +625,7 @@ static int zend_dfa_optimize_jmps(zend_op_array *op_array, zend_ssa *ssa) zend_basic_block *block = &ssa->cfg.blocks[block_num]; uint32_t op_num; zend_op *opline; - zend_ssa_op *op; + zend_ssa_op *ssa_op; while (next_block_num < ssa->cfg.blocks_count && !(ssa->cfg.blocks[next_block_num].flags & ZEND_BB_REACHABLE)) { @@ -481,54 +633,215 @@ static int zend_dfa_optimize_jmps(zend_op_array *op_array, zend_ssa *ssa) } if (block->len) { - if (block->successors_count == 2) { - if (block->successors[0] == block->successors[1]) { - op_num = block->start + block->len - 1; - opline = op_array->opcodes + op_num; - switch (opline->opcode) { - case ZEND_JMPZ: - case ZEND_JMPNZ: - case ZEND_JMPZNZ: - op = ssa->ops + op_num; + op_num = block->start + block->len - 1; + opline = op_array->opcodes + op_num; + ssa_op = ssa->ops + op_num; + + switch (opline->opcode) { + case ZEND_JMP: +optimize_jmp: + if (block->successors[0] == next_block_num) { + MAKE_NOP(opline); + removed_ops++; + goto optimize_nop; + } + break; + case ZEND_JMPZ: +optimize_jmpz: + if (opline->op1_type == IS_CONST) { + if (zend_is_true(CT_CONSTANT_EX(op_array, opline->op1.constant))) { + MAKE_NOP(opline); + removed_ops++; + take_successor_1(ssa, block_num, block); + goto optimize_nop; + } else { + opline->opcode = ZEND_JMP; + COPY_NODE(opline->op1, opline->op2); + take_successor_0(ssa, block_num, block); + goto optimize_jmp; + } + } else { + if (block->successors[0] == next_block_num) { + take_successor_0(ssa, block_num, block); + if (opline->op1_type == IS_CV && (OP1_INFO() & MAY_BE_UNDEF)) { + opline->opcode = ZEND_CHECK_VAR; + opline->op2.num = 0; + } else if (opline->op1_type == IS_CV || !(OP1_INFO() & (MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE|MAY_BE_REF))) { + zend_ssa_remove_instr(ssa, opline, ssa_op); + removed_ops++; + goto optimize_nop; + } else { + opline->opcode = ZEND_FREE; + opline->op2.num = 0; + } + } + } + break; + case ZEND_JMPNZ: +optimize_jmpnz: + if (opline->op1_type == IS_CONST) { + if (zend_is_true(CT_CONSTANT_EX(op_array, opline->op1.constant))) { + opline->opcode = ZEND_JMP; + COPY_NODE(opline->op1, opline->op2); + take_successor_0(ssa, block_num, block); + goto optimize_jmp; + } else { + MAKE_NOP(opline); + removed_ops++; + take_successor_1(ssa, block_num, block); + goto optimize_nop; + } + } else { + ZEND_ASSERT(block->successors_count == 2); + if (block->successors[0] == next_block_num) { + take_successor_0(ssa, block_num, block); + if (opline->op1_type == IS_CV && (OP1_INFO() & MAY_BE_UNDEF)) { + opline->opcode = ZEND_CHECK_VAR; + opline->op2.num = 0; + } else if (opline->op1_type == IS_CV || !(OP1_INFO() & (MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE|MAY_BE_REF))) { + zend_ssa_remove_instr(ssa, opline, ssa_op); + removed_ops++; + goto optimize_nop; + } else { + opline->opcode = ZEND_FREE; + opline->op2.num = 0; + } + } + } + break; + case ZEND_JMPZNZ: + if (opline->op1_type == IS_CONST) { + if (zend_is_true(CT_CONSTANT_EX(op_array, opline->op1.constant))) { + zend_op *target_opline = ZEND_OFFSET_TO_OPLINE(opline, opline->extended_value); + ZEND_SET_OP_JMP_ADDR(opline, opline->op1, target_opline); + take_successor_1(ssa, block_num, block); + } else { + zend_op *target_opline = ZEND_OP2_JMP_ADDR(opline); + ZEND_SET_OP_JMP_ADDR(opline, opline->op1, target_opline); + take_successor_0(ssa, block_num, block); + } + opline->op1_type = IS_UNUSED; + opline->extended_value = 0; + opline->opcode = ZEND_JMP; + goto optimize_jmp; + } else { + ZEND_ASSERT(block->successors_count == 2); + if (block->successors[0] == block->successors[1]) { + take_successor_0(ssa, block_num, block); if (block->successors[0] == next_block_num) { - if (opline->op1_type & (IS_CV|IS_CONST)) { - zend_ssa_remove_instr(ssa, opline, op); - if (op->op1_use >= 0) { - zend_ssa_unlink_use_chain(ssa, op_num, op->op1_use); - op->op1_use = -1; - op->op1_use_chain = -1; - } - MAKE_NOP(opline); + if (opline->op1_type == IS_CV && (OP1_INFO() & MAY_BE_UNDEF)) { + opline->opcode = ZEND_CHECK_VAR; + opline->op2.num = 0; + } else if (opline->op1_type == IS_CV || !(OP1_INFO() & (MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE|MAY_BE_REF))) { + zend_ssa_remove_instr(ssa, opline, ssa_op); removed_ops++; + goto optimize_nop; } else { opline->opcode = ZEND_FREE; opline->op2.num = 0; } - } else { - if (opline->op1_type & (IS_CV|IS_CONST)) { - if (op->op1_use >= 0) { - zend_ssa_unlink_use_chain(ssa, op_num, op->op1_use); - op->op1_use = -1; - op->op1_use_chain = -1; - } - opline->opcode = ZEND_JMP; - opline->op1_type = IS_UNUSED; - opline->op1.num = opline->op2.num; + } else if ((opline->op1_type == IS_CV && !(OP1_INFO() & MAY_BE_UNDEF)) || !(OP1_INFO() & (MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE|MAY_BE_REF))) { + ZEND_ASSERT(ssa_op->op1_use >= 0); + zend_ssa_unlink_use_chain(ssa, op_num, ssa_op->op1_use); + ssa_op->op1_use = -1; + ssa_op->op1_use_chain = -1; + opline->opcode = ZEND_JMP; + opline->op1_type = IS_UNUSED; + opline->op1.num = opline->op2.num; + goto optimize_jmp; + } + } + } + break; + case ZEND_JMPZ_EX: + if (ssa->vars[ssa_op->result_def].use_chain < 0 + && ssa->vars[ssa_op->result_def].phi_use_chain == NULL) { + opline->opcode = ZEND_JMPZ; + opline->result_type = IS_UNUSED; + zend_ssa_remove_result_def(ssa, ssa_op); + goto optimize_jmpz; + } else if (opline->op1_type == IS_CONST) { + if (zend_is_true(CT_CONSTANT_EX(op_array, opline->op1.constant))) { + opline->opcode = ZEND_QM_ASSIGN; + take_successor_1(ssa, block_num, block); + } + } + break; + case ZEND_JMPNZ_EX: + if (ssa->vars[ssa_op->result_def].use_chain < 0 + && ssa->vars[ssa_op->result_def].phi_use_chain == NULL) { + opline->opcode = ZEND_JMPNZ; + opline->result_type = IS_UNUSED; + zend_ssa_remove_result_def(ssa, ssa_op); + goto optimize_jmpnz; + } else if (opline->op1_type == IS_CONST) { + if (!zend_is_true(CT_CONSTANT_EX(op_array, opline->op1.constant))) { + opline->opcode = ZEND_QM_ASSIGN; + take_successor_1(ssa, block_num, block); + } + } + break; + case ZEND_JMP_SET: + if (ssa->vars[ssa_op->result_def].use_chain < 0 + && ssa->vars[ssa_op->result_def].phi_use_chain == NULL) { + opline->opcode = ZEND_JMPNZ; + opline->result_type = IS_UNUSED; + zend_ssa_remove_result_def(ssa, ssa_op); + goto optimize_jmpnz; + } else if (opline->op1_type == IS_CONST) { + if (!zend_is_true(CT_CONSTANT_EX(op_array, opline->op1.constant))) { + MAKE_NOP(opline); + removed_ops++; + take_successor_1(ssa, block_num, block); + goto optimize_nop; + } + } + break; + case ZEND_COALESCE: + if (opline->op1_type == IS_CONST) { + if (Z_TYPE_P(CT_CONSTANT_EX(op_array, opline->op1.constant)) == IS_NULL) { + MAKE_NOP(opline); + removed_ops++; + take_successor_1(ssa, block_num, block); + goto optimize_nop; + } else { + zend_ssa_var *var = &ssa->vars[ssa_op->result_def]; + if (var->use_chain < 0 && var->phi_use_chain == NULL) { + ssa_op->result_def = -1; + if (opline->result_type & (IS_TMP_VAR|IS_VAR)) { + zend_optimizer_remove_live_range_ex(op_array, opline->result.var, var->definition); } + zend_ssa_unlink_use_chain(ssa, opline - op_array->opcodes, ssa_op->op1_use); + ssa_op->op1_use = -1; + ssa_op->op1_use_chain = -1; + opline->opcode = ZEND_JMP; + COPY_NODE(opline->op1, opline->op2); + take_successor_0(ssa, block_num, block); + goto optimize_jmp; } - break; - default: - break; + } } - } - } else if (block->successors_count == 1 && block->successors[0] == next_block_num) { - op_num = block->start + block->len - 1; - opline = op_array->opcodes + op_num; - if (opline->opcode == ZEND_JMP) { - MAKE_NOP(opline); - removed_ops++; - } - } + break; + case ZEND_NOP: +optimize_nop: + compress_block(op_array, block); + if (block->len == 0) { + if (block_num > 0) { + zend_ssa_unlink_block(op_array, ssa, block, block_num); + /* backtrack to previous basic block */ + do { + block_num--; + } while (block_num >= 0 + && !(ssa->cfg.blocks[block_num].flags & ZEND_BB_REACHABLE)); + if (block_num >= 0) { + continue; + } + } + } + break; + default: + break; + } } block_num = next_block_num; @@ -579,6 +892,9 @@ void zend_dfa_optimize_op_array(zend_op_array *op_array, zend_optimizer_ctx *ctx if (dce_optimize_op_array(op_array, ssa, 0)) { remove_nops = 1; } + if (zend_dfa_optimize_jmps(op_array, ssa)) { + remove_nops = 1; + } if (ctx->debug_level & ZEND_DUMP_AFTER_PASS_14) { zend_dump_op_array(op_array, ZEND_DUMP_SSA, "after dce pass", ssa); } diff --git a/ext/opcache/Optimizer/escape_analysis.c b/ext/opcache/Optimizer/escape_analysis.c new file mode 100644 index 0000000000000..c4e847d06f2d0 --- /dev/null +++ b/ext/opcache/Optimizer/escape_analysis.c @@ -0,0 +1,566 @@ +/* + +----------------------------------------------------------------------+ + | Zend OPcache, Escape Analysis | + +----------------------------------------------------------------------+ + | Copyright (c) 1998-2017 The PHP Group | + +----------------------------------------------------------------------+ + | This source file is subject to version 3.01 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | + | http://www.php.net/license/3_01.txt | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Authors: Dmitry Stogov | + +----------------------------------------------------------------------+ +*/ + +#include "php.h" +#include "Optimizer/zend_optimizer.h" +#include "Optimizer/zend_optimizer_internal.h" +#include "zend_bitset.h" +#include "zend_cfg.h" +#include "zend_ssa.h" +#include "zend_inference.h" +#include "zend_dump.h" + +/* + * T. Kotzmann and H. Mossenbock. Escape analysis in the context of dynamic + * compilation and deoptimization. In Proceedings of the International + * Conference on Virtual Execution Environments, pages 111-120, Chicago, + * June 2005 + */ + +static zend_always_inline void union_find_init(int *parent, int *size, int count) /* {{{ */ +{ + int i; + + for (i = 0; i < count; i++) { + parent[i] = i; + size[i] = 1; + } +} +/* }}} */ + +static zend_always_inline int union_find_root(int *parent, int i) /* {{{ */ +{ + int p = parent[i]; + + while (i != p) { + p = parent[p]; + parent[i] = p; + i = p; + p = parent[i]; + } + return i; +} +/* }}} */ + +static zend_always_inline void union_find_unite(int *parent, int *size, int i, int j) /* {{{ */ +{ + int r1 = union_find_root(parent, i); + int r2 = union_find_root(parent, j); + + if (r1 != r2) { + if (size[r1] < size[r2]) { + parent[r1] = r2; + size[r2] += size[r1]; + } else { + parent[r2] = r1; + size[r1] += size[r2]; + } + } +} +/* }}} */ + +static int zend_build_equi_escape_sets(int *parent, zend_op_array *op_array, zend_ssa *ssa) /* {{{ */ +{ + zend_ssa_var *ssa_vars = ssa->vars; + int ssa_vars_count = ssa->vars_count; + zend_ssa_phi *p; + int i, j; + int *size; + ALLOCA_FLAG(use_heap) + + size = do_alloca(sizeof(int) * ssa_vars_count, use_heap); + if (!size) { + return FAILURE; + } + union_find_init(parent, size, ssa_vars_count); + + for (i = 0; i < ssa_vars_count; i++) { + if (ssa_vars[i].definition_phi) { + p = ssa_vars[i].definition_phi; + if (p->pi >= 0) { + union_find_unite(parent, size, i, p->sources[0]); + } else { + for (j = 0; j < ssa->cfg.blocks[p->block].predecessors_count; j++) { + union_find_unite(parent, size, i, p->sources[j]); + } + } + } else if (ssa_vars[i].definition >= 0) { + int def = ssa_vars[i].definition; + zend_ssa_op *op = ssa->ops + def; + zend_op *opline = op_array->opcodes + def; + + if (op->op1_def >= 0) { + if (op->op1_use >= 0) { + if (opline->opcode != ZEND_ASSIGN) { + union_find_unite(parent, size, op->op1_def, op->op1_use); + } + } + if (opline->opcode == ZEND_ASSIGN && op->op2_use >= 0) { + union_find_unite(parent, size, op->op1_def, op->op2_use); + } + } + if (op->op2_def >= 0) { + if (op->op2_use >= 0) { + union_find_unite(parent, size, op->op2_def, op->op2_use); + } + } + if (op->result_def >= 0) { + if (op->result_use >= 0) { + if (opline->opcode != ZEND_QM_ASSIGN) { + union_find_unite(parent, size, op->result_def, op->result_use); + } + } + if (opline->opcode == ZEND_QM_ASSIGN && op->op1_use >= 0) { + union_find_unite(parent, size, op->result_def, op->op1_use); + } + if (opline->opcode == ZEND_ASSIGN && op->op2_use >= 0) { + union_find_unite(parent, size, op->result_def, op->op2_use); + } + if (opline->opcode == ZEND_ASSIGN && op->op1_def >= 0) { + union_find_unite(parent, size, op->result_def, op->op1_def); + } + } + } + } + + for (i = 0; i < ssa_vars_count; i++) { + parent[i] = union_find_root(parent, i); + } + + free_alloca(size, use_heap); + + return SUCCESS; +} +/* }}} */ + +static inline zend_class_entry *get_class_entry(const zend_script *script, zend_string *lcname) /* {{{ */ +{ + zend_class_entry *ce = script ? zend_hash_find_ptr(&script->class_table, lcname) : NULL; + if (ce) { + return ce; + } + + ce = zend_hash_find_ptr(CG(class_table), lcname); + if (ce && ce->type == ZEND_INTERNAL_CLASS) { + return ce; + } + + return NULL; +} +/* }}} */ + +static int is_allocation_def(zend_op_array *op_array, zend_ssa *ssa, int def, int var, const zend_script *script) /* {{{ */ +{ + zend_ssa_op *op = ssa->ops + def; + zend_op *opline = op_array->opcodes + def; + + if (op->result_def == var) { + switch (opline->opcode) { + case ZEND_INIT_ARRAY: + return 1; + case ZEND_NEW: + /* objects with destructors should escape */ + if (opline->op1_type == IS_CONST) { + zend_class_entry *ce = get_class_entry(script, Z_STR_P(CRT_CONSTANT_EX(op_array, opline->op1, ssa->rt_constants)+1)); + if (ce && !ce->create_object && !ce->constructor && + !ce->destructor && !ce->__get && !ce->__set && + !(ce->ce_flags & ZEND_ACC_INHERITED)) { + return 1; + } + } + break; + case ZEND_QM_ASSIGN: + if (opline->op1_type == IS_CONST + && Z_TYPE_P(CRT_CONSTANT_EX(op_array, opline->op1, ssa->rt_constants)) == IS_ARRAY) { + return 1; + } + if (opline->op1_type == IS_CV && (OP1_INFO() & MAY_BE_ARRAY)) { + return 1; + } + break; + case ZEND_ASSIGN: + if (opline->op1_type == IS_CV && (OP1_INFO() & MAY_BE_ARRAY)) { + return 1; + } + break; + } + } else if (op->op1_def == var) { + switch (opline->opcode) { + case ZEND_ASSIGN: + if (opline->op2_type == IS_CONST + && Z_TYPE_P(CRT_CONSTANT_EX(op_array, opline->op2, ssa->rt_constants)) == IS_ARRAY) { + return 1; + } + if (opline->op2_type == IS_CV && (OP2_INFO() & MAY_BE_ARRAY)) { + return 1; + } + break; + case ZEND_ASSIGN_DIM: + case ZEND_ASSIGN_OBJ: + if (OP1_INFO() & (MAY_BE_UNDEF | MAY_BE_NULL | MAY_BE_FALSE)) { + /* implicit object/array allocation */ + return 1; + } + break; + } + } + + return 0; +} +/* }}} */ + +static int is_local_def(zend_op_array *op_array, zend_ssa *ssa, int def, int var, const zend_script *script) /* {{{ */ +{ + zend_ssa_op *op = ssa->ops + def; + zend_op *opline = op_array->opcodes + def; + + if (op->result_def == var) { + switch (opline->opcode) { + case ZEND_INIT_ARRAY: + case ZEND_ADD_ARRAY_ELEMENT: + case ZEND_QM_ASSIGN: + case ZEND_ASSIGN: + return 1; + case ZEND_NEW: + /* objects with destructors should escape */ + if (opline->op1_type == IS_CONST) { + zend_class_entry *ce = get_class_entry(script, Z_STR_P(CRT_CONSTANT_EX(op_array, opline->op1, ssa->rt_constants)+1)); + if (ce && !ce->create_object && !ce->constructor && + !ce->destructor && !ce->__get && !ce->__set && + !(ce->ce_flags & ZEND_ACC_INHERITED)) { + return 1; + } + } + break; + } + } else if (op->op1_def == var) { + switch (opline->opcode) { + case ZEND_ASSIGN: + return 1; + case ZEND_ASSIGN_DIM: + case ZEND_ASSIGN_OBJ: + return 1; + case ZEND_ASSIGN_ADD: + case ZEND_ASSIGN_SUB: + case ZEND_ASSIGN_MUL: + case ZEND_ASSIGN_DIV: + case ZEND_ASSIGN_MOD: + case ZEND_ASSIGN_SL: + case ZEND_ASSIGN_SR: + case ZEND_ASSIGN_CONCAT: + case ZEND_ASSIGN_BW_OR: + case ZEND_ASSIGN_BW_AND: + case ZEND_ASSIGN_BW_XOR: + case ZEND_ASSIGN_POW: + return (opline->extended_value != 0); + case ZEND_PRE_INC_OBJ: + case ZEND_PRE_DEC_OBJ: + case ZEND_POST_INC_OBJ: + case ZEND_POST_DEC_OBJ: + return 1; + } + } + + return 0; +} +/* }}} */ + +static int is_escape_use(zend_op_array *op_array, zend_ssa *ssa, int use, int var) /* {{{ */ +{ + zend_ssa_op *op = ssa->ops + use; + zend_op *opline = op_array->opcodes + use; + + if (op->op1_use == var) { + switch (opline->opcode) { + case ZEND_ASSIGN: + /* no_val */ + break; + case ZEND_QM_ASSIGN: + if (opline->op1_type == IS_CV) { + if (OP1_INFO() & MAY_BE_OBJECT) { + /* object aliasing */ + return 1; + } + } + break; + case ZEND_ISSET_ISEMPTY_DIM_OBJ: + case ZEND_ISSET_ISEMPTY_PROP_OBJ: + case ZEND_FETCH_DIM_R: + case ZEND_FETCH_OBJ_R: + case ZEND_FETCH_DIM_IS: + case ZEND_FETCH_OBJ_IS: + break; + case ZEND_ASSIGN_ADD: + case ZEND_ASSIGN_SUB: + case ZEND_ASSIGN_MUL: + case ZEND_ASSIGN_DIV: + case ZEND_ASSIGN_MOD: + case ZEND_ASSIGN_SL: + case ZEND_ASSIGN_SR: + case ZEND_ASSIGN_CONCAT: + case ZEND_ASSIGN_BW_OR: + case ZEND_ASSIGN_BW_AND: + case ZEND_ASSIGN_BW_XOR: + case ZEND_ASSIGN_POW: + if (!opline->extended_value) { + return 1; + } + /* break missing intentionally */ + case ZEND_ASSIGN_DIM: + case ZEND_ASSIGN_OBJ: + break; + case ZEND_PRE_INC_OBJ: + case ZEND_PRE_DEC_OBJ: + case ZEND_POST_INC_OBJ: + case ZEND_POST_DEC_OBJ: + break; + case ZEND_INIT_ARRAY: + case ZEND_ADD_ARRAY_ELEMENT: + if (opline->extended_value & ZEND_ARRAY_ELEMENT_REF) { + return 1; + } + if (OP1_INFO() & MAY_BE_OBJECT) { + /* object aliasing */ + return 1; + } + /* reference dependencies processed separately */ + break; + case ZEND_OP_DATA: + if ((opline-1)->opcode != ZEND_ASSIGN_DIM + && (opline-1)->opcode != ZEND_ASSIGN_OBJ) { + return 1; + } + if (OP1_INFO() & MAY_BE_OBJECT) { + /* object aliasing */ + return 1; + } + opline--; + op--; + if (opline->op1_type != IS_CV + || (OP1_INFO() & MAY_BE_REF) + || (op->op1_def >= 0 && ssa->vars[op->op1_def].alias)) { + /* asignment into escaping structure */ + return 1; + } + /* reference dependencies processed separately */ + break; + default: + return 1; + } + } + + if (op->op2_use == var) { + switch (opline->opcode) { + case ZEND_ASSIGN: + if (opline->op1_type != IS_CV + || (OP1_INFO() & MAY_BE_REF) + || (op->op1_def >= 0 && ssa->vars[op->op1_def].alias)) { + /* asignment into escaping variable */ + return 1; + } + if (opline->op2_type == IS_CV || opline->result_type != IS_UNUSED) { + if (OP2_INFO() & MAY_BE_OBJECT) { + /* object aliasing */ + return 1; + } + } + break; + default: + return 1; + } + } + + if (op->result_use == var) { + switch (opline->opcode) { + case ZEND_ASSIGN: + case ZEND_QM_ASSIGN: + case ZEND_INIT_ARRAY: + case ZEND_ADD_ARRAY_ELEMENT: + break; + default: + return 1; + } + } + + return 0; +} +/* }}} */ + +int zend_ssa_escape_analysis(const zend_script *script, zend_op_array *op_array, zend_ssa *ssa) /* {{{ */ +{ + zend_ssa_var *ssa_vars = ssa->vars; + int ssa_vars_count = ssa->vars_count; + int i, root, use; + int *ees; + zend_bool has_allocations; + int num_non_escaped; + ALLOCA_FLAG(use_heap) + + if (!ssa_vars) { + return SUCCESS; + } + + has_allocations = 0; + for (i = op_array->last_var; i < ssa_vars_count; i++) { + if (ssa_vars[i].definition >= 0 + && (ssa->var_info[i].type & (MAY_BE_ARRAY|MAY_BE_OBJECT)) + && is_allocation_def(op_array, ssa, ssa_vars[i].definition, i, script)) { + has_allocations = 1; + break; + } + } + if (!has_allocations) { + return SUCCESS; + } + + + /* 1. Build EES (Equi-Esape Sets) */ + ees = do_alloca(sizeof(int) * ssa_vars_count, use_heap); + if (!ees) { + return FAILURE; + } + + if (zend_build_equi_escape_sets(ees, op_array, ssa) != SUCCESS) { + return FAILURE; + } + + /* 2. Identify Allocations */ + num_non_escaped = 0; + for (i = op_array->last_var; i < ssa_vars_count; i++) { + root = ees[i]; + if (ssa_vars[root].escape_state > ESCAPE_STATE_NO_ESCAPE) { + /* already escape. skip */ + } else if (ssa_vars[i].alias && (ssa->var_info[i].type & MAY_BE_REF)) { + if (ssa_vars[root].escape_state == ESCAPE_STATE_NO_ESCAPE) { + num_non_escaped--; + } + ssa_vars[root].escape_state = ESCAPE_STATE_GLOBAL_ESCAPE; + } else if (ssa_vars[i].definition >= 0 + && (ssa->var_info[i].type & (MAY_BE_ARRAY|MAY_BE_OBJECT))) { + if (!is_local_def(op_array, ssa, ssa_vars[i].definition, i, script)) { + if (ssa_vars[root].escape_state == ESCAPE_STATE_NO_ESCAPE) { + num_non_escaped--; + } + ssa_vars[root].escape_state = ESCAPE_STATE_GLOBAL_ESCAPE; + } else if (ssa_vars[root].escape_state == ESCAPE_STATE_UNKNOWN + && is_allocation_def(op_array, ssa, ssa_vars[i].definition, i, script)) { + ssa_vars[root].escape_state = ESCAPE_STATE_NO_ESCAPE; + num_non_escaped++; + } + } + } + + /* 3. Mark escaped EES */ + if (num_non_escaped) { + for (i = 0; i < ssa_vars_count; i++) { + if (ssa_vars[i].use_chain >= 0) { + root = ees[i]; + if (ssa_vars[root].escape_state == ESCAPE_STATE_NO_ESCAPE) { + FOREACH_USE(ssa_vars + i, use) { + if (is_escape_use(op_array, ssa, use, i)) { + ssa_vars[root].escape_state = ESCAPE_STATE_GLOBAL_ESCAPE; + num_non_escaped--; + if (num_non_escaped == 0) { + i = ssa_vars_count; + } + break; + } + } FOREACH_USE_END(); + } + } + } + } + + /* 4. Process referential dependencies */ + if (num_non_escaped) { + zend_bool changed; + + do { + changed = 0; + for (i = 0; i < ssa_vars_count; i++) { + if (ssa_vars[i].use_chain >= 0) { + root = ees[i]; + if (ssa_vars[root].escape_state == ESCAPE_STATE_NO_ESCAPE) { + FOREACH_USE(ssa_vars + i, use) { + zend_ssa_op *op = ssa->ops + use; + zend_op *opline = op_array->opcodes + use; + int enclosing_root; + + if (opline->opcode == ZEND_OP_DATA && + ((opline-1)->opcode == ZEND_ASSIGN_DIM || + (opline-1)->opcode == ZEND_ASSIGN_OBJ) && + op->op1_use == i && + (op-1)->op1_use >= 0) { + enclosing_root = ees[(op-1)->op1_use]; + } else if ((opline->opcode == ZEND_INIT_ARRAY || + opline->opcode == ZEND_ADD_ARRAY_ELEMENT) && + op->op1_use == i && + op->result_def >= 0) { + enclosing_root = ees[op->result_def]; + } else { + continue; + } + + if (ssa_vars[enclosing_root].escape_state == ESCAPE_STATE_UNKNOWN || + ssa_vars[enclosing_root].escape_state > ssa_vars[root].escape_state) { + if (ssa_vars[enclosing_root].escape_state == ESCAPE_STATE_UNKNOWN) { + ssa_vars[root].escape_state = ESCAPE_STATE_GLOBAL_ESCAPE; + } else { + ssa_vars[root].escape_state = ssa_vars[enclosing_root].escape_state; + } + if (ssa_vars[root].escape_state == ESCAPE_STATE_GLOBAL_ESCAPE) { + num_non_escaped--; + if (num_non_escaped == 0) { + i = ssa_vars_count; + changed = 0; + } else { + changed = 1; + } + break; + } else { + changed = 1; + } + } + } FOREACH_USE_END(); + } + } + } + } while (changed); + } + + /* 5. Propagate values of escape sets to variables */ + for (i = 0; i < ssa_vars_count; i++) { + root = ees[i]; + if (i != root) { + ssa_vars[i].escape_state = ssa_vars[root].escape_state; + } + } + + free_alloca(ees, use_heap); + + return SUCCESS; +} +/* }}} */ + +/* + * Local variables: + * tab-width: 4 + * c-basic-offset: 4 + * indent-tabs-mode: t + * End: + */ diff --git a/ext/opcache/Optimizer/pass3.c b/ext/opcache/Optimizer/pass3.c index 975a9ebebbbea..0461ed943415f 100644 --- a/ext/opcache/Optimizer/pass3.c +++ b/ext/opcache/Optimizer/pass3.c @@ -427,6 +427,8 @@ void zend_optimizer_pass3(zend_op_array *op_array) } break; + case ZEND_POST_INC_OBJ: + case ZEND_POST_DEC_OBJ: case ZEND_POST_INC: case ZEND_POST_DEC: { /* POST_INC, FREE => PRE_INC */ diff --git a/ext/opcache/Optimizer/sccp.c b/ext/opcache/Optimizer/sccp.c index e061e209c7752..1ece45d80c393 100644 --- a/ext/opcache/Optimizer/sccp.c +++ b/ext/opcache/Optimizer/sccp.c @@ -13,6 +13,7 @@ | license@php.net so we can mail you a copy immediately. | +----------------------------------------------------------------------+ | Authors: Nikita Popov | + | Dmitry Stogov | +----------------------------------------------------------------------+ */ @@ -21,6 +22,7 @@ #include "ZendAccelerator.h" #include "Optimizer/zend_optimizer_internal.h" #include "Optimizer/zend_call_graph.h" +#include "Optimizer/zend_inference.h" #include "Optimizer/scdf.h" #include "Optimizer/zend_dump.h" #include "ext/standard/php_string.h" @@ -64,6 +66,12 @@ * b) Otherwise, if we branch on TOP none of the successors are feasible. * c) Otherwise (we branch on a constant), the feasible successors are marked based on the constant * (usually only one successor will be feasible). + * + * The original SCCP algorithm is extended with ability to propagate constant array + * elements and object properties. The extension is based on a variation of Array + * SSA form and its application to Spare Constant Propagation, described at + * "Array SSA Form" by Vivek Sarkar, Kathleen Knobe and Stephen Fink in chapter + * 16 of the SSA book. */ #if 0 @@ -80,14 +88,42 @@ typedef struct _sccp_ctx { zval bot; } sccp_ctx; -#define TOP ((zend_uchar)-1) +#define TOP ((zend_uchar)-1) #define BOT ((zend_uchar)-2) +#define PARTIAL_ARRAY ((zend_uchar)-3) +#define PARTIAL_OBJECT ((zend_uchar)-4) #define IS_TOP(zv) (Z_TYPE_P(zv) == TOP) #define IS_BOT(zv) (Z_TYPE_P(zv) == BOT) +#define IS_PARTIAL_ARRAY(zv) (Z_TYPE_P(zv) == PARTIAL_ARRAY) +#define IS_PARTIAL_OBJECT(zv) (Z_TYPE_P(zv) == PARTIAL_OBJECT) #define MAKE_TOP(zv) (Z_TYPE_INFO_P(zv) = TOP) #define MAKE_BOT(zv) (Z_TYPE_INFO_P(zv) = BOT) +static void empty_partial_array(zval *zv) +{ + Z_TYPE_INFO_P(zv) = PARTIAL_ARRAY | (IS_TYPE_REFCOUNTED << Z_TYPE_FLAGS_SHIFT); + Z_ARR_P(zv) = zend_new_array(8); +} + +static void dup_partial_array(zval *dst, zval *src) +{ + Z_TYPE_INFO_P(dst) = PARTIAL_ARRAY | (IS_TYPE_REFCOUNTED << Z_TYPE_FLAGS_SHIFT); + Z_ARR_P(dst) = zend_array_dup(Z_ARR_P(src)); +} + +static void empty_partial_object(zval *zv) +{ + Z_TYPE_INFO_P(zv) = PARTIAL_OBJECT | (IS_TYPE_REFCOUNTED << Z_TYPE_FLAGS_SHIFT); + Z_ARR_P(zv) = zend_new_array(8); +} + +static void dup_partial_object(zval *dst, zval *src) +{ + Z_TYPE_INFO_P(dst) = PARTIAL_OBJECT | (IS_TYPE_REFCOUNTED << Z_TYPE_FLAGS_SHIFT); + Z_ARR_P(dst) = zend_array_dup(Z_ARR_P(src)); +} + static inline zend_bool value_known(zval *zv) { return !IS_TOP(zv) && !IS_BOT(zv); } @@ -102,7 +138,7 @@ static void set_value(scdf_ctx *scdf, sccp_ctx *ctx, int var, zval *new) { if (IS_BOT(new)) { SCP_DEBUG("Lowering var %d to BOT\n", var); - } else { + } else if (!IS_PARTIAL_ARRAY(new) && !IS_PARTIAL_OBJECT(new)) { SCP_DEBUG("Lowering var %d to %Z\n", var, new); } @@ -113,6 +149,17 @@ static void set_value(scdf_ctx *scdf, sccp_ctx *ctx, int var, zval *new) { return; } + /* Always replace PARTIAL_(ARRAY|OBJECT), as new maybe changed by join_partial_(arrays|object) */ + if (IS_PARTIAL_ARRAY(new) || IS_PARTIAL_OBJECT(new)) { + if (Z_TYPE_P(value) != Z_TYPE_P(new) + || zend_hash_num_elements(Z_ARR_P(new)) != zend_hash_num_elements(Z_ARR_P(value))) { + zval_ptr_dtor_nogc(value); + ZVAL_COPY(value, new); + scdf_add_to_worklist(scdf, var); + } + return; + } + #if ZEND_DEBUG ZEND_ASSERT(zend_is_identical(value, new)); #endif @@ -234,93 +281,6 @@ static zend_bool try_replace_op1( zval zv; ZVAL_COPY(&zv, value); if (zend_optimizer_update_op1_const(ctx->scdf.op_array, opline, &zv)) { - /* Reconstruct SSA */ - int num; - zend_basic_block *block; - - switch (opline->opcode) { - case ZEND_JMPZ: - if (zend_is_true(&zv)) { - MAKE_NOP(opline); - num = ctx->scdf.ssa->cfg.map[opline - ctx->scdf.op_array->opcodes]; - block = &ctx->scdf.ssa->cfg.blocks[num]; - if (block->successors_count == 2) { - if (block->successors[1] != block->successors[0]) { - zend_ssa_remove_predecessor(ctx->scdf.ssa, num, block->successors[0]); - } - block->successors_count = 1; - block->successors[0] = block->successors[1]; - } - } else { - opline->opcode = ZEND_JMP; - COPY_NODE(opline->op1, opline->op2); - num = ctx->scdf.ssa->cfg.map[opline - ctx->scdf.op_array->opcodes]; - block = &ctx->scdf.ssa->cfg.blocks[num]; - if (block->successors_count == 2) { - if (block->successors[1] != block->successors[0]) { - zend_ssa_remove_predecessor(ctx->scdf.ssa, num, block->successors[1]); - } - block->successors_count = 1; - } - } - break; - case ZEND_JMPNZ: - if (zend_is_true(&zv)) { - opline->opcode = ZEND_JMP; - COPY_NODE(opline->op1, opline->op2); - num = ctx->scdf.ssa->cfg.map[opline - ctx->scdf.op_array->opcodes]; - block = &ctx->scdf.ssa->cfg.blocks[num]; - if (block->successors_count == 2) { - if (block->successors[1] != block->successors[0]) { - zend_ssa_remove_predecessor(ctx->scdf.ssa, num, block->successors[1]); - } - block->successors_count = 1; - } - } else { - MAKE_NOP(opline); - num = ctx->scdf.ssa->cfg.map[opline - ctx->scdf.op_array->opcodes]; - block = &ctx->scdf.ssa->cfg.blocks[num]; - if (block->successors_count == 2) { - if (block->successors[1] != block->successors[0]) { - zend_ssa_remove_predecessor(ctx->scdf.ssa, num, block->successors[0]); - } - block->successors_count = 1; - block->successors[0] = block->successors[1]; - } - } - break; - case ZEND_JMPZNZ: - if (zend_is_true(&zv)) { - zend_op *target_opline = ZEND_OFFSET_TO_OPLINE(opline, opline->extended_value); - ZEND_SET_OP_JMP_ADDR(opline, opline->op1, target_opline); - num = ctx->scdf.ssa->cfg.map[opline - ctx->scdf.op_array->opcodes]; - block = &ctx->scdf.ssa->cfg.blocks[num]; - if (block->successors_count == 2) { - if (block->successors[1] != block->successors[0]) { - zend_ssa_remove_predecessor(ctx->scdf.ssa, num, block->successors[0]); - } - block->successors_count = 1; - block->successors[0] = block->successors[1]; - } - } else { - zend_op *target_opline = ZEND_OP2_JMP_ADDR(opline); - ZEND_SET_OP_JMP_ADDR(opline, opline->op1, target_opline); - num = ctx->scdf.ssa->cfg.map[opline - ctx->scdf.op_array->opcodes]; - block = &ctx->scdf.ssa->cfg.blocks[num]; - if (block->successors_count == 2) { - if (block->successors[1] != block->successors[0]) { - zend_ssa_remove_predecessor(ctx->scdf.ssa, num, block->successors[1]); - } - block->successors_count = 1; - } - } - opline->op1_type = IS_UNUSED; - opline->extended_value = 0; - opline->opcode = ZEND_JMP; - break; - default: - break; - } return 1; } else { // TODO: check the following special cases ??? @@ -398,9 +358,9 @@ static inline int fetch_array_elem(zval **result, zval *op1, zval *op2) { } static inline int ct_eval_fetch_dim(zval *result, zval *op1, zval *op2, int support_strings) { - if (Z_TYPE_P(op1) == IS_ARRAY) { + if (Z_TYPE_P(op1) == IS_ARRAY || IS_PARTIAL_ARRAY(op1)) { zval *value; - if (fetch_array_elem(&value, op1, op2) == SUCCESS && value) { + if (fetch_array_elem(&value, op1, op2) == SUCCESS && value && !IS_BOT(value)) { ZVAL_COPY(result, value); return SUCCESS; } @@ -418,11 +378,14 @@ static inline int ct_eval_fetch_dim(zval *result, zval *op1, zval *op2, int supp } static inline int ct_eval_isset_dim(zval *result, uint32_t extended_value, zval *op1, zval *op2) { - if (Z_TYPE_P(op1) == IS_ARRAY) { + if (Z_TYPE_P(op1) == IS_ARRAY || IS_PARTIAL_ARRAY(op1)) { zval *value; if (fetch_array_elem(&value, op1, op2) == FAILURE) { return FAILURE; } + if (IS_PARTIAL_ARRAY(op1) && (!value || IS_BOT(value))) { + return FAILURE; + } if (extended_value & ZEND_ISSET) { ZVAL_BOOL(result, value && Z_TYPE_P(value) != IS_NULL); } else { @@ -439,6 +402,35 @@ static inline int ct_eval_isset_dim(zval *result, uint32_t extended_value, zval } } +static inline int ct_eval_del_array_elem(zval *result, zval *key) { + ZEND_ASSERT(IS_PARTIAL_ARRAY(result)); + + switch (Z_TYPE_P(key)) { + case IS_NULL: + zend_hash_del(Z_ARR_P(result), ZSTR_EMPTY_ALLOC()); + break; + case IS_FALSE: + zend_hash_index_del(Z_ARR_P(result), 0); + break; + case IS_TRUE: + zend_hash_index_del(Z_ARR_P(result), 1); + break; + case IS_LONG: + zend_hash_index_del(Z_ARR_P(result), Z_LVAL_P(key)); + break; + case IS_DOUBLE: + zend_hash_index_del(Z_ARR_P(result), zend_dval_to_lval(Z_DVAL_P(key))); + break; + case IS_STRING: + zend_symtable_del(Z_ARR_P(result), Z_STR_P(key)); + break; + default: + return FAILURE; + } + + return SUCCESS; +} + static inline int ct_eval_add_array_elem(zval *result, zval *value, zval *key) { if (!key) { if ((value = zend_hash_next_index_insert(Z_ARR_P(result), value))) { @@ -483,6 +475,7 @@ static inline int ct_eval_assign_dim(zval *result, zval *value, zval *key) { array_init(result); /* break missing intentionally */ case IS_ARRAY: + case PARTIAL_ARRAY: return ct_eval_add_array_elem(result, value, key); case IS_STRING: // TODO Before enabling this case, make sure ARRAY_DIM result op is correct @@ -514,9 +507,95 @@ static inline int ct_eval_assign_dim(zval *result, zval *value, zval *key) { } } +static inline int fetch_obj_prop(zval **result, zval *op1, zval *op2) { + switch (Z_TYPE_P(op2)) { + case IS_STRING: + *result = zend_symtable_find(Z_ARR_P(op1), Z_STR_P(op2)); + return SUCCESS; + default: + return FAILURE; + } +} + +static inline int ct_eval_fetch_obj(zval *result, zval *op1, zval *op2) { + if (IS_PARTIAL_OBJECT(op1)) { + zval *value; + if (fetch_obj_prop(&value, op1, op2) == SUCCESS && value && !IS_BOT(value)) { + ZVAL_COPY(result, value); + return SUCCESS; + } + } + return FAILURE; +} + +static inline int ct_eval_isset_obj(zval *result, uint32_t extended_value, zval *op1, zval *op2) { + if (IS_PARTIAL_OBJECT(op1)) { + zval *value; + if (fetch_obj_prop(&value, op1, op2) == FAILURE) { + return FAILURE; + } + if (!value || IS_BOT(value)) { + return FAILURE; + } + if (extended_value & ZEND_ISSET) { + ZVAL_BOOL(result, value && Z_TYPE_P(value) != IS_NULL); + } else { + ZEND_ASSERT(extended_value & ZEND_ISEMPTY); + ZVAL_BOOL(result, !value || !zend_is_true(value)); + } + return SUCCESS; + } else { + ZVAL_BOOL(result, extended_value != ZEND_ISSET); + return SUCCESS; + } +} + +static inline int ct_eval_del_obj_prop(zval *result, zval *key) { + ZEND_ASSERT(IS_PARTIAL_OBJECT(result)); + + switch (Z_TYPE_P(key)) { + case IS_STRING: + zend_symtable_del(Z_ARR_P(result), Z_STR_P(key)); + break; + default: + return FAILURE; + } + + return SUCCESS; +} + +static inline int ct_eval_add_obj_prop(zval *result, zval *value, zval *key) { + switch (Z_TYPE_P(key)) { + case IS_STRING: + value = zend_symtable_update(Z_ARR_P(result), Z_STR_P(key), value); + break; + default: + return FAILURE; + } + + Z_TRY_ADDREF_P(value); + return SUCCESS; +} + +static inline int ct_eval_assign_obj(zval *result, zval *value, zval *key) { + switch (Z_TYPE_P(result)) { + case IS_NULL: + case IS_FALSE: + empty_partial_object(result); + /* break missing intentionally */ + case PARTIAL_OBJECT: + return ct_eval_add_obj_prop(result, value, key); + default: + return FAILURE; + } +} + static inline int ct_eval_incdec(zval *result, zend_uchar opcode, zval *op1) { ZVAL_COPY(result, op1); - if (opcode == ZEND_PRE_INC || opcode == ZEND_POST_INC) { + if (opcode == ZEND_PRE_INC + || opcode == ZEND_POST_INC + || opcode == ZEND_PRE_INC_OBJ + || opcode == ZEND_POST_INC_OBJ) { increment_function(result); } else { decrement_function(result); @@ -856,7 +935,7 @@ static inline int ct_eval_func_call( #define SET_RESULT_BOT(op) SET_RESULT(op, &ctx->bot) #define SET_RESULT_TOP(op) SET_RESULT(op, &ctx->top) -#define SKIP_IF_TOP(op) if (IS_TOP(op)) break; +#define SKIP_IF_TOP(op) if (IS_TOP(op)) return; static void sccp_visit_instr(scdf_ctx *scdf, zend_op *opline, zend_ssa_op *ssa_op) { sccp_ctx *ctx = (sccp_ctx *) scdf; @@ -897,11 +976,170 @@ static void sccp_visit_instr(scdf_ctx *scdf, zend_op *opline, zend_ssa_op *ssa_o } break; case ZEND_ASSIGN_DIM: + { + zval *data = get_op1_value(ctx, opline+1, ssa_op+1); + /* If $a in $a[$b]=$c is UNDEF, treat it like NULL. There is no warning. */ if ((ctx->scdf.ssa->var_info[ssa_op->op1_use].type & MAY_BE_ANY) == 0) { op1 = &EG(uninitialized_zval); } - break; + + if (IS_BOT(op1)) { + SET_RESULT_BOT(result); + SET_RESULT_BOT(op1); + return; + } + + SKIP_IF_TOP(op1); + SKIP_IF_TOP(data); + if (op2) { + SKIP_IF_TOP(op2); + } + + if (op2 && IS_BOT(op2)) { + /* Update of unknown index */ + SET_RESULT_BOT(result); + if (ssa_op->op1_def >= 0 + && ctx->scdf.ssa->vars[ssa_op->op1_def].escape_state == ESCAPE_STATE_NO_ESCAPE) { + empty_partial_array(&zv); + SET_RESULT(op1, &zv); + zval_ptr_dtor_nogc(&zv); + } else { + SET_RESULT_BOT(op1); + } + return; + } + + if (IS_BOT(data)) { + + SET_RESULT_BOT(result); + if ((IS_PARTIAL_ARRAY(op1) + || Z_TYPE_P(op1) == IS_NULL + || Z_TYPE_P(op1) == IS_FALSE + || Z_TYPE_P(op1) == IS_ARRAY) + && ssa_op->op1_def >= 0 + && ctx->scdf.ssa->vars[ssa_op->op1_def].escape_state == ESCAPE_STATE_NO_ESCAPE) { + + if (Z_TYPE_P(op1) == IS_NULL || Z_TYPE_P(op1) == IS_FALSE) { + empty_partial_array(&zv); + } else { + dup_partial_array(&zv, op1); + } + + if (!op2) { + /* We can't add NEXT element into partial array (skip it) */ + SET_RESULT(op1, &zv); + } else if (ct_eval_del_array_elem(&zv, op2) == SUCCESS) { + SET_RESULT(op1, &zv); + } else { + SET_RESULT_BOT(op1); + } + + zval_ptr_dtor_nogc(&zv); + } else { + SET_RESULT_BOT(op1); + } + + } else { + + if (IS_PARTIAL_ARRAY(op1)) { + dup_partial_array(&zv, op1); + } else { + ZVAL_DUP(&zv, op1); + } + + if (!op2 && IS_PARTIAL_ARRAY(&zv)) { + /* We can't add NEXT element into partial array (skip it) */ + SET_RESULT(result, data); + SET_RESULT(op1, &zv); + } else if (ct_eval_assign_dim(&zv, data, op2) == SUCCESS) { + SET_RESULT(result, data); + SET_RESULT(op1, &zv); + } else { + SET_RESULT_BOT(result); + SET_RESULT_BOT(op1); + } + + zval_ptr_dtor_nogc(&zv); + } + return; + } + + case ZEND_ASSIGN_OBJ: + if (ssa_op->op1_def >= 0 + && ctx->scdf.ssa->vars[ssa_op->op1_def].escape_state == ESCAPE_STATE_NO_ESCAPE) { + zval *data = get_op1_value(ctx, opline+1, ssa_op+1); + + /* If $a in $a->foo=$c is UNDEF, treat it like NULL. There is no warning. */ + if ((ctx->scdf.ssa->var_info[ssa_op->op1_use].type & MAY_BE_ANY) == 0) { + op1 = &EG(uninitialized_zval); + } + + if (IS_BOT(op1)) { + SET_RESULT_BOT(result); + SET_RESULT_BOT(op1); + return; + } + + SKIP_IF_TOP(op1); + SKIP_IF_TOP(data); + SKIP_IF_TOP(op2); + + if (IS_BOT(op2)) { + /* Update of unknown property */ + SET_RESULT_BOT(result); + empty_partial_object(&zv); + SET_RESULT(op1, &zv); + zval_ptr_dtor_nogc(&zv); + return; + } + + if (IS_BOT(data)) { + SET_RESULT_BOT(result); + if (IS_PARTIAL_OBJECT(op1) + || Z_TYPE_P(op1) == IS_NULL + || Z_TYPE_P(op1) == IS_FALSE) { + + if (Z_TYPE_P(op1) == IS_NULL || Z_TYPE_P(op1) == IS_FALSE) { + empty_partial_object(&zv); + } else { + dup_partial_object(&zv, op1); + } + + if (ct_eval_del_obj_prop(&zv, op2) == SUCCESS) { + SET_RESULT(op1, &zv); + } else { + SET_RESULT_BOT(op1); + } + zval_ptr_dtor_nogc(&zv); + } else { + SET_RESULT_BOT(op1); + } + + } else { + + if (IS_PARTIAL_OBJECT(op1)) { + dup_partial_object(&zv, op1); + } else { + ZVAL_COPY(&zv, op1); + } + + if (ct_eval_assign_obj(&zv, data, op2) == SUCCESS) { + SET_RESULT(result, data); + SET_RESULT(op1, &zv); + } else { + SET_RESULT_BOT(result); + SET_RESULT_BOT(op1); + } + + zval_ptr_dtor_nogc(&zv); + } + } else { + SET_RESULT_BOT(result); + SET_RESULT_BOT(op1); + } + return; + case ZEND_SEND_VAL: case ZEND_SEND_VAR: { @@ -921,33 +1159,140 @@ static void sccp_visit_instr(scdf_ctx *scdf, zend_op *opline, zend_ssa_op *ssa_o ssa_op = &ctx->scdf.ssa->ops[opline - ctx->scdf.op_array->opcodes]; break; } - } + case ZEND_INIT_ARRAY: + case ZEND_ADD_ARRAY_ELEMENT: + { + zval *result = NULL; - if ((op1 && IS_BOT(op1)) || (op2 && IS_BOT(op2))) { - /* If any operand is BOT, mark the result as BOT right away. - * Exceptions to this rule are handled above. */ - SET_RESULT_BOT(result); - SET_RESULT_BOT(op1); - SET_RESULT_BOT(op2); - return; - } + if (opline->opcode == ZEND_ADD_ARRAY_ELEMENT) { + result = &ctx->values[ssa_op->result_use]; + if (IS_BOT(result)) { + SET_RESULT_BOT(result); + SET_RESULT_BOT(op1); + return; + } + SKIP_IF_TOP(result); + } - switch (opline->opcode) { - case ZEND_ADD: - case ZEND_SUB: - case ZEND_MUL: - case ZEND_DIV: - case ZEND_MOD: - case ZEND_POW: - case ZEND_SL: - case ZEND_SR: - case ZEND_CONCAT: - case ZEND_FAST_CONCAT: - case ZEND_IS_EQUAL: - case ZEND_IS_NOT_EQUAL: - case ZEND_IS_SMALLER: - case ZEND_IS_SMALLER_OR_EQUAL: - case ZEND_IS_IDENTICAL: + if (op1) { + SKIP_IF_TOP(op1); + } + + if (op2) { + SKIP_IF_TOP(op2); + } + + /* We want to avoid keeping around intermediate arrays for each SSA variable in the + * ADD_ARRAY_ELEMENT chain. We do this by only keeping the array on the last opcode + * and use a NULL value everywhere else. */ + if (Z_TYPE(ctx->values[ssa_op->result_def]) == IS_NULL) { + return; + } + + if (op2 && IS_BOT(op2)) { + /* Update of unknown index */ + SET_RESULT_BOT(op1); + if (ssa_op->result_def >= 0 + && ctx->scdf.ssa->vars[ssa_op->result_def].escape_state == ESCAPE_STATE_NO_ESCAPE) { + empty_partial_array(&zv); + SET_RESULT(result, &zv); + zval_ptr_dtor_nogc(&zv); + } else { + SET_RESULT_BOT(result); + } + return; + } + + if ((op1 && IS_BOT(op1)) + || (opline->extended_value & ZEND_ARRAY_ELEMENT_REF)) { + + SET_RESULT_BOT(op1); + if (ssa_op->result_def >= 0 + && ctx->scdf.ssa->vars[ssa_op->result_def].escape_state == ESCAPE_STATE_NO_ESCAPE) { + if (!result) { + empty_partial_array(&zv); + } else { + Z_TYPE_INFO_P(result) = PARTIAL_ARRAY | (IS_TYPE_REFCOUNTED << Z_TYPE_FLAGS_SHIFT); + ZVAL_COPY_VALUE(&zv, result); + ZVAL_NULL(result); + } + if (!op2) { + /* We can't add NEXT element into partial array (skip it) */ + SET_RESULT(result, &zv); + } else if (ct_eval_del_array_elem(&zv, op2) == SUCCESS) { + SET_RESULT(result, &zv); + } else { + SET_RESULT_BOT(result); + } + zval_ptr_dtor_nogc(&zv); + } else { + /* If any operand is BOT, mark the result as BOT right away. + * Exceptions to this rule are handled above. */ + SET_RESULT_BOT(result); + } + + } else { + if (result) { + ZVAL_COPY_VALUE(&zv, result); + ZVAL_NULL(result); + } else { + array_init(&zv); + } + + if (op1) { + if (!op2 && IS_PARTIAL_ARRAY(&zv)) { + /* We can't add NEXT element into partial array (skip it) */ + SET_RESULT(result, &zv); + } else if (ct_eval_add_array_elem(&zv, op1, op2) == SUCCESS) { + SET_RESULT(result, &zv); + } else { + SET_RESULT_BOT(result); + } + } else { + SET_RESULT(result, &zv); + } + + zval_ptr_dtor_nogc(&zv); + } + return; + } + case ZEND_NEW: + if (ssa_op->result_def >= 0 + && ctx->scdf.ssa->vars[ssa_op->result_def].escape_state == ESCAPE_STATE_NO_ESCAPE) { + empty_partial_object(&zv); + SET_RESULT(result, &zv); + zval_ptr_dtor_nogc(&zv); + } else { + SET_RESULT_BOT(result); + } + return; + } + + if ((op1 && IS_BOT(op1)) || (op2 && IS_BOT(op2))) { + /* If any operand is BOT, mark the result as BOT right away. + * Exceptions to this rule are handled above. */ + SET_RESULT_BOT(result); + SET_RESULT_BOT(op1); + SET_RESULT_BOT(op2); + return; + } + + switch (opline->opcode) { + case ZEND_ADD: + case ZEND_SUB: + case ZEND_MUL: + case ZEND_DIV: + case ZEND_MOD: + case ZEND_POW: + case ZEND_SL: + case ZEND_SR: + case ZEND_CONCAT: + case ZEND_FAST_CONCAT: + case ZEND_IS_EQUAL: + case ZEND_IS_NOT_EQUAL: + case ZEND_IS_SMALLER: + case ZEND_IS_SMALLER_OR_EQUAL: + case ZEND_IS_IDENTICAL: case ZEND_IS_NOT_IDENTICAL: case ZEND_BW_OR: case ZEND_BW_AND: @@ -976,21 +1321,126 @@ static void sccp_visit_instr(scdf_ctx *scdf, zend_op *opline, zend_ssa_op *ssa_o case ZEND_ASSIGN_BW_AND: case ZEND_ASSIGN_BW_XOR: case ZEND_ASSIGN_POW: - /* Obj/dim compound assign */ - if (opline->extended_value) { - SET_RESULT_BOT(op1); - SET_RESULT_BOT(result); - break; + if (op1) { + SKIP_IF_TOP(op1); + } + if (op2) { + SKIP_IF_TOP(op2); } + if (!opline->extended_value) { + if (zend_optimizer_eval_binary_op(&zv, zend_compound_assign_to_binary_op(opline->opcode), op1, op2) == SUCCESS) { + SET_RESULT(op1, &zv); + SET_RESULT(result, &zv); + zval_ptr_dtor_nogc(&zv); + break; + } + } else if (opline->extended_value == ZEND_ASSIGN_DIM) { + if ((IS_PARTIAL_ARRAY(op1) || Z_TYPE_P(op1) == IS_ARRAY) + && ssa_op->op1_def >= 0 + && ctx->scdf.ssa->vars[ssa_op->op1_def].escape_state == ESCAPE_STATE_NO_ESCAPE + && op2) { + zval tmp; + zval *data = get_op1_value(ctx, opline+1, ssa_op+1); + + SKIP_IF_TOP(data); + + if (ct_eval_fetch_dim(&tmp, op1, op2, 0) == SUCCESS) { + if (IS_BOT(data)) { + dup_partial_array(&zv, op1); + ct_eval_del_array_elem(&zv, op2); + } else { + if (zend_optimizer_eval_binary_op(&tmp, zend_compound_assign_to_binary_op(opline->opcode), &tmp, data) != SUCCESS) { + SET_RESULT_BOT(result); + SET_RESULT_BOT(op1); + zval_ptr_dtor_nogc(&tmp); + break; + } - SKIP_IF_TOP(op1); - SKIP_IF_TOP(op2); + if (IS_PARTIAL_ARRAY(op1)) { + dup_partial_array(&zv, op1); + } else { + ZVAL_DUP(&zv, op1); + } + } - if (zend_optimizer_eval_binary_op(&zv, zend_compound_assign_to_binary_op(opline->opcode), op1, op2) == SUCCESS) { - SET_RESULT(op1, &zv); - SET_RESULT(result, &zv); - zval_ptr_dtor_nogc(&zv); - break; + if (ct_eval_assign_dim(&zv, &tmp, op2) == SUCCESS) { + SET_RESULT(result, &tmp); + SET_RESULT(op1, &zv); + zval_ptr_dtor_nogc(&tmp); + zval_ptr_dtor_nogc(&zv); + break; + } + zval_ptr_dtor_nogc(&tmp); + zval_ptr_dtor_nogc(&zv); + } + } + } else if (opline->extended_value == ZEND_ASSIGN_OBJ) { + if (op1 && IS_PARTIAL_OBJECT(op1) + && ssa_op->op1_def >= 0 + && ctx->scdf.ssa->vars[ssa_op->op1_def].escape_state == ESCAPE_STATE_NO_ESCAPE) { + zval tmp; + zval *data = get_op1_value(ctx, opline+1, ssa_op+1); + + SKIP_IF_TOP(data); + + if (ct_eval_fetch_obj(&tmp, op1, op2) == SUCCESS) { + if (IS_BOT(data)) { + dup_partial_object(&zv, op1); + ct_eval_del_obj_prop(&zv, op2); + } else { + if (zend_optimizer_eval_binary_op(&tmp, zend_compound_assign_to_binary_op(opline->opcode), &tmp, data) != SUCCESS) { + SET_RESULT_BOT(result); + SET_RESULT_BOT(op1); + zval_ptr_dtor_nogc(&tmp); + break; + } + + dup_partial_object(&zv, op1); + } + + if (ct_eval_assign_obj(&zv, &tmp, op2) == SUCCESS) { + SET_RESULT(result, &tmp); + SET_RESULT(op1, &zv); + zval_ptr_dtor_nogc(&tmp); + zval_ptr_dtor_nogc(&zv); + break; + } + zval_ptr_dtor_nogc(&tmp); + zval_ptr_dtor_nogc(&zv); + } + } + } + SET_RESULT_BOT(result); + SET_RESULT_BOT(op1); + break; + case ZEND_PRE_INC_OBJ: + case ZEND_PRE_DEC_OBJ: + case ZEND_POST_INC_OBJ: + case ZEND_POST_DEC_OBJ: + if (op1) { + SKIP_IF_TOP(op1); + SKIP_IF_TOP(op2); + if (IS_PARTIAL_OBJECT(op1) + && ssa_op->op1_def >= 0 + && ctx->scdf.ssa->vars[ssa_op->op1_def].escape_state == ESCAPE_STATE_NO_ESCAPE) { + zval tmp1, tmp2; + + if (ct_eval_fetch_obj(&tmp1, op1, op2) == SUCCESS + && ct_eval_incdec(&tmp2, opline->opcode, &tmp1) == SUCCESS) { + + dup_partial_object(&zv, op1); + ct_eval_assign_obj(&zv, &tmp2, op2); + if (opline->opcode == ZEND_PRE_INC_OBJ + || opline->opcode == ZEND_PRE_DEC_OBJ) { + SET_RESULT(result, &tmp2); + } else { + SET_RESULT(result, &tmp1); + } + SET_RESULT(op1, &zv); + zval_ptr_dtor_nogc(&zv); + break; + } + } } SET_RESULT_BOT(op1); SET_RESULT_BOT(result); @@ -1097,6 +1547,33 @@ static void sccp_visit_instr(scdf_ctx *scdf, zend_op *opline, zend_ssa_op *ssa_o } SET_RESULT_BOT(result); break; + case ZEND_FETCH_OBJ_R: + case ZEND_FETCH_OBJ_IS: + if (op1) { + SKIP_IF_TOP(op1); + SKIP_IF_TOP(op2); + + if (ct_eval_fetch_obj(&zv, op1, op2) == SUCCESS) { + SET_RESULT(result, &zv); + zval_ptr_dtor_nogc(&zv); + break; + } + } + SET_RESULT_BOT(result); + break; + case ZEND_ISSET_ISEMPTY_PROP_OBJ: + if (op1) { + SKIP_IF_TOP(op1); + SKIP_IF_TOP(op2); + + if (ct_eval_isset_obj(&zv, opline->extended_value, op1, op2) == SUCCESS) { + SET_RESULT(result, &zv); + zval_ptr_dtor_nogc(&zv); + break; + } + } + SET_RESULT_BOT(result); + break; case ZEND_QM_ASSIGN: case ZEND_JMP_SET: case ZEND_COALESCE: @@ -1152,80 +1629,6 @@ static void sccp_visit_instr(scdf_ctx *scdf, zend_op *opline, zend_ssa_op *ssa_o } SET_RESULT_BOT(result); break; - case ZEND_INIT_ARRAY: - case ZEND_ADD_ARRAY_ELEMENT: - { - zval *result = NULL; - if (opline->extended_value & ZEND_ARRAY_ELEMENT_REF) { - SET_RESULT_BOT(result); - SET_RESULT_BOT(op1); - break; - } - - if (opline->opcode == ZEND_ADD_ARRAY_ELEMENT) { - result = &ctx->values[ssa_op->result_use]; - if (IS_BOT(result)) { - SET_RESULT_BOT(result); - break; - } - SKIP_IF_TOP(result); - } - - SKIP_IF_TOP(op1); - if (op2) { - SKIP_IF_TOP(op2); - } - - /* We want to avoid keeping around intermediate arrays for each SSA variable in the - * ADD_ARRAY_ELEMENT chain. We do this by only keeping the array on the last opcode - * and use a NULL value everywhere else. */ - if (Z_TYPE(ctx->values[ssa_op->result_def]) == IS_NULL) { - break; - } - - if (result) { - ZVAL_COPY_VALUE(&zv, result); - ZVAL_NULL(result); - } else { - array_init(&zv); - } - - if (ct_eval_add_array_elem(&zv, op1, op2) == SUCCESS) { - SET_RESULT(result, &zv); - zval_ptr_dtor_nogc(&zv); - break; - } - SET_RESULT_BOT(result); - zval_ptr_dtor_nogc(&zv); - break; - } - case ZEND_ASSIGN_DIM: - { - zval *data = get_op1_value(ctx, opline+1, ssa_op+1); - if (IS_BOT(data)) { - SET_RESULT_BOT(op1); - SET_RESULT_BOT(result); - break; - } - - SKIP_IF_TOP(data); - SKIP_IF_TOP(op1); - if (op2) { - SKIP_IF_TOP(op2); - } - - ZVAL_DUP(&zv, op1); - if (ct_eval_assign_dim(&zv, data, op2) == SUCCESS) { - SET_RESULT(result, data); - SET_RESULT(op1, &zv); - zval_ptr_dtor_nogc(&zv); - break; - } - SET_RESULT_BOT(result); - SET_RESULT_BOT(op1); - zval_ptr_dtor_nogc(&zv); - break; - } case ZEND_DO_ICALL: { zend_call_info *call; @@ -1358,7 +1761,7 @@ static void sccp_mark_feasible_successors( break; case ZEND_FE_RESET_R: case ZEND_FE_RESET_RW: - if (Z_TYPE_P(op1) != IS_ARRAY) { + if (Z_TYPE_P(op1) != IS_ARRAY && !IS_PARTIAL_ARRAY(op1)) { scdf_mark_edge_feasible(scdf, block_num, block->successors[0]); scdf_mark_edge_feasible(scdf, block_num, block->successors[1]); return; @@ -1374,7 +1777,63 @@ static void sccp_mark_feasible_successors( scdf_mark_edge_feasible(scdf, block_num, block->successors[s]); } -static void join_phi_values(zval *a, zval *b) { +static void join_hash_tables(HashTable *ret, HashTable *ht1, HashTable *ht2) +{ + zend_ulong index; + zend_string *key; + zval *val1, *val2; + + ZEND_HASH_FOREACH_KEY_VAL(ht1, index, key, val1) { + if (key) { + val2 = zend_hash_find(ht2, key); + } else { + val2 = zend_hash_index_find(ht2, index); + } + if (val2 && zend_is_identical(val1, val2)) { + if (key) { + val1 = zend_hash_add_new(ret, key, val1); + } else { + val1 = zend_hash_index_add_new(ret, index, val1); + } + Z_TRY_ADDREF_P(val1); + } + } ZEND_HASH_FOREACH_END(); +} + +static int join_partial_arrays(zval *a, zval *b) +{ + zval ret; + + if ((Z_TYPE_P(a) != IS_ARRAY && !IS_PARTIAL_ARRAY(a)) + || (Z_TYPE_P(b) != IS_ARRAY && !IS_PARTIAL_ARRAY(b))) { + return FAILURE; + } + + empty_partial_array(&ret); + join_hash_tables(Z_ARRVAL(ret), Z_ARRVAL_P(a), Z_ARRVAL_P(b)); + zval_ptr_dtor_nogc(a); + ZVAL_COPY_VALUE(a, &ret); + + return SUCCESS; +} + +static int join_partial_objects(zval *a, zval *b) +{ + zval ret; + + if (!IS_PARTIAL_OBJECT(a) || !IS_PARTIAL_OBJECT(b)) { + return FAILURE; + } + + empty_partial_object(&ret); + join_hash_tables(Z_ARRVAL(ret), Z_ARRVAL_P(a), Z_ARRVAL_P(b)); + zval_ptr_dtor_nogc(a); + ZVAL_COPY_VALUE(a, &ret); + + return SUCCESS; +} + +static void join_phi_values(zval *a, zval *b, zend_bool escape) { if (IS_BOT(a) || IS_TOP(b)) { return; } @@ -1383,9 +1842,26 @@ static void join_phi_values(zval *a, zval *b) { ZVAL_COPY(a, b); return; } - if (IS_BOT(b) || !zend_is_identical(a, b)) { + if (IS_BOT(b)) { zval_ptr_dtor_nogc(a); MAKE_BOT(a); + return; + } + if (IS_PARTIAL_ARRAY(a) || IS_PARTIAL_ARRAY(b)) { + if (escape || join_partial_arrays(a, b) != SUCCESS) { + zval_ptr_dtor_nogc(a); + MAKE_BOT(a); + } + } else if (IS_PARTIAL_OBJECT(a) || IS_PARTIAL_OBJECT(b)) { + if (escape || join_partial_objects(a, b) != SUCCESS) { + zval_ptr_dtor_nogc(a); + MAKE_BOT(a); + } + } else if (!zend_is_identical(a, b)) { + if (escape || join_partial_arrays(a, b) != SUCCESS) { + zval_ptr_dtor_nogc(a); + MAKE_BOT(a); + } } } @@ -1404,14 +1880,14 @@ static void sccp_visit_phi(scdf_ctx *scdf, zend_ssa_phi *phi) { if (phi->pi >= 0) { ZEND_ASSERT(phi->sources[0] >= 0); if (scdf_is_edge_feasible(scdf, phi->pi, phi->block)) { - join_phi_values(&result, &ctx->values[phi->sources[0]]); + join_phi_values(&result, &ctx->values[phi->sources[0]], ssa->vars[phi->ssa_var].escape_state != ESCAPE_STATE_NO_ESCAPE); } } else { for (i = 0; i < block->predecessors_count; i++) { ZEND_ASSERT(phi->sources[i] >= 0); if (scdf_is_edge_feasible(scdf, predecessors[i], phi->block)) { SCP_DEBUG("val, "); - join_phi_values(&result, &ctx->values[phi->sources[i]]); + join_phi_values(&result, &ctx->values[phi->sources[i]], ssa->vars[phi->ssa_var].escape_state != ESCAPE_STATE_NO_ESCAPE); } else { SCP_DEBUG("--, "); } @@ -1461,6 +1937,237 @@ static zval *value_from_type_and_range(sccp_ctx *ctx, int var_num, zval *tmp) { return NULL; } +/* Call instruction -> remove opcodes that are part of the call */ +static int remove_call(sccp_ctx *ctx, zend_op *opline, zend_ssa_op *ssa_op) +{ + zend_ssa *ssa = ctx->scdf.ssa; + zend_op_array *op_array = ctx->scdf.op_array; + zend_call_info *call; + int i; + + ZEND_ASSERT(ctx->call_map); + call = ctx->call_map[opline - op_array->opcodes]; + ZEND_ASSERT(call); + ZEND_ASSERT(call->caller_call_opline == opline); + zend_ssa_remove_instr(ssa, opline, ssa_op); + zend_ssa_remove_instr(ssa, call->caller_init_opline, + &ssa->ops[call->caller_init_opline - op_array->opcodes]); + + for (i = 0; i < call->num_args; i++) { + zend_ssa_remove_instr(ssa, call->arg_info[i].opline, + &ssa->ops[call->arg_info[i].opline - op_array->opcodes]); + } + + // TODO: remove call_info completely??? + call->callee_func = NULL; + + return call->num_args + 2; +} + +/* This is a basic DCE pass we run after SCCP. It only works on those instructions those result + * value(s) were determined by SCCP. It removes dead computational instructions and converts + * CV-affecting instructions into CONST ASSIGNs. This basic DCE is performed for multiple reasons: + * a) During operand replacement we eliminate FREEs. The corresponding computational instructions + * must be removed to avoid leaks. This way SCCP can run independently of the full DCE pass. + * b) The main DCE pass relies on type analysis to determine whether instructions have side-effects + * and can't be DCEd. This means that it will not be able collect all instructions rendered dead + * by SCCP, because they may have potentially side-effecting types, but the actual values are + * not. As such doing DCE here will allow us to eliminate more dead code in combination. + * c) The ordinary DCE pass cannot collect dead calls. However SCCP can result in dead calls, which + * we need to collect. + * d) The ordinary DCE pass cannot collect construction of dead non-escaping arrays and objects. + */ +static int try_remove_definition(sccp_ctx *ctx, int var_num, zend_ssa_var *var, zval *value) +{ + zend_ssa *ssa = ctx->scdf.ssa; + zend_op_array *op_array = ctx->scdf.op_array; + int removed_ops = 0; + + if (var->definition >= 0) { + zend_op *opline = &op_array->opcodes[var->definition]; + zend_ssa_op *ssa_op = &ssa->ops[var->definition]; + + if (opline->opcode == ZEND_ASSIGN) { + /* Leave assigns to DCE (due to dtor effects) */ + return 0; + } + + if (ssa_op->result_def == var_num) { + if (ssa_op->op1_def >= 0 + || ssa_op->op2_def >= 0) { + /* we cannot remove instruction that defines other varibales */ + return 0; + } else if (opline->opcode == ZEND_JMPZ_EX + || opline->opcode == ZEND_JMPNZ_EX + || opline->opcode == ZEND_JMP_SET + || opline->opcode == ZEND_COALESCE + || opline->opcode == ZEND_FE_RESET_R + || opline->opcode == ZEND_FE_RESET_RW + || opline->opcode == ZEND_FE_FETCH_R + || opline->opcode == ZEND_FE_FETCH_RW + || opline->opcode == ZEND_NEW) { + /* we cannot simple remove jump instructions */ + return 0; + } else if (var->use_chain >= 0 + || var->phi_use_chain != NULL) { + if (value + && opline->result_type & (IS_VAR|IS_TMP_VAR) + && opline->opcode != ZEND_QM_ASSIGN + && opline->opcode != ZEND_ROPE_INIT + && opline->opcode != ZEND_ROPE_ADD + && opline->opcode != ZEND_INIT_ARRAY + && opline->opcode != ZEND_ADD_ARRAY_ELEMENT) { + /* Replace with QM_ASSIGN */ + zend_uchar old_type = opline->result_type; + zend_uchar old_var = opline->result.var; + + ssa_op->result_def = -1; + zend_optimizer_remove_live_range_ex(op_array, opline->result.var, var->definition); + if (opline->opcode == ZEND_DO_ICALL) { + removed_ops = remove_call(ctx, opline, ssa_op) - 1; + } else { + zend_ssa_remove_instr(ssa, opline, ssa_op); + } + ssa_op->result_def = var_num; + opline->opcode = ZEND_QM_ASSIGN; + opline->result_type = old_type; + opline->result.var = old_var; + Z_TRY_ADDREF_P(value); + zend_optimizer_update_op1_const(ctx->scdf.op_array, opline, value); + } + return 0; + } else { + if (opline->result_type & (IS_TMP_VAR|IS_VAR)) { + zend_optimizer_remove_live_range_ex(op_array, opline->result.var, var->definition); + } + zend_ssa_remove_result_def(ssa, ssa_op); + if (opline->opcode == ZEND_DO_ICALL) { + removed_ops = remove_call(ctx, opline, ssa_op); + } else { + zend_ssa_remove_instr(ssa, opline, ssa_op); + removed_ops++; + } + } + } else if (ssa_op->op1_def == var_num) { + /* Compound assign or incdec -> convert to direct ASSIGN */ + + if (!value) { + /* In some cases zend_may_throw() may be avoided */ + switch (opline->opcode) { + case ZEND_ASSIGN_DIM: + case ZEND_ASSIGN_OBJ: + case ZEND_ASSIGN_ADD: + case ZEND_ASSIGN_SUB: + case ZEND_ASSIGN_MUL: + case ZEND_ASSIGN_DIV: + case ZEND_ASSIGN_MOD: + case ZEND_ASSIGN_SL: + case ZEND_ASSIGN_SR: + case ZEND_ASSIGN_CONCAT: + case ZEND_ASSIGN_BW_OR: + case ZEND_ASSIGN_BW_AND: + case ZEND_ASSIGN_BW_XOR: + case ZEND_ASSIGN_POW: + if ((ssa_op->op2_use >= 0 && !value_known(&ctx->values[ssa_op->op2_use])) + || ((ssa_op+1)->op1_use >= 0 &&!value_known(&ctx->values[(ssa_op+1)->op1_use]))) { + return 0; + } + break; + case ZEND_PRE_INC_OBJ: + case ZEND_PRE_DEC_OBJ: + case ZEND_POST_INC_OBJ: + case ZEND_POST_DEC_OBJ: + if (ssa_op->op2_use >= 0 && !value_known(&ctx->values[ssa_op->op2_use])) { + return 0; + } + break; + default: + if (zend_may_throw(opline, op_array, ssa)) { + return 0; + } + break; + } + } + + /* Mark result unused, if possible */ + if (ssa_op->result_def >= 0) { + if (ssa->vars[ssa_op->result_def].use_chain < 0 + && ssa->vars[ssa_op->result_def].phi_use_chain == NULL) { + if (opline->result_type & (IS_TMP_VAR|IS_VAR)) { + zend_optimizer_remove_live_range_ex(op_array, opline->result.var, var->definition); + } + zend_ssa_remove_result_def(ssa, ssa_op); + opline->result_type = IS_UNUSED; + } else if (opline->opcode != ZEND_PRE_INC && + opline->opcode != ZEND_PRE_DEC) { + /* op1_def and result_def are different */ + return removed_ops; + } + } + + /* Destroy previous op2 */ + if (opline->op2_type == IS_CONST) { + literal_dtor(&ZEND_OP2_LITERAL(opline)); + } else if (ssa_op->op2_use >= 0) { + if (ssa_op->op2_use != ssa_op->op1_use) { + zend_ssa_unlink_use_chain(ssa, var->definition, ssa_op->op2_use); + } + ssa_op->op2_use = -1; + ssa_op->op2_use_chain = -1; + } + + /* Remove OP_DATA opcode */ + switch (opline->opcode) { + case ZEND_ASSIGN_DIM: + case ZEND_ASSIGN_OBJ: + removed_ops++; + zend_ssa_remove_instr(ssa, opline + 1, ssa_op + 1); + break; + case ZEND_ASSIGN_ADD: + case ZEND_ASSIGN_SUB: + case ZEND_ASSIGN_MUL: + case ZEND_ASSIGN_DIV: + case ZEND_ASSIGN_MOD: + case ZEND_ASSIGN_SL: + case ZEND_ASSIGN_SR: + case ZEND_ASSIGN_CONCAT: + case ZEND_ASSIGN_BW_OR: + case ZEND_ASSIGN_BW_AND: + case ZEND_ASSIGN_BW_XOR: + case ZEND_ASSIGN_POW: + if (opline->extended_value) { + removed_ops++; + zend_ssa_remove_instr(ssa, opline + 1, ssa_op + 1); + } + break; + default: + break; + } + + if (value) { + /* Convert to ASSIGN */ + opline->opcode = ZEND_ASSIGN; + opline->op2_type = IS_CONST; + opline->op2.constant = zend_optimizer_add_literal(op_array, value); + Z_TRY_ADDREF_P(value); + } else { + /* Remove dead array or object construction */ + removed_ops++; + if (var->use_chain >= 0 || var->phi_use_chain != NULL) { + zend_ssa_rename_var_uses(ssa, ssa_op->op1_def, ssa_op->op1_use, 1); + } + zend_ssa_remove_op1_def(ssa, ssa_op); + zend_ssa_remove_instr(ssa, opline, ssa_op); + } + } + } else if (var->definition_phi + && var->use_chain < 0 + && var->phi_use_chain == NULL) { + zend_ssa_remove_phi(ssa, var->definition_phi); + } + return removed_ops; +} + /* This will try to replace uses of SSA variables we have determined to be constant. Not all uses * can be replaced, because some instructions don't accept constant operands or only accept them * if they have a certain type. */ @@ -1478,7 +2185,17 @@ static int replace_constant_operands(sccp_ctx *ctx) { zval *value; int use; - if (value_known(&ctx->values[i])) { + if (IS_PARTIAL_ARRAY(&ctx->values[i]) + || IS_PARTIAL_OBJECT(&ctx->values[i])) { + if (!Z_DELREF(ctx->values[i])) { + zend_array_destroy(Z_ARR(ctx->values[i])); + } + MAKE_BOT(&ctx->values[i]); + if ((var->use_chain < 0 && var->phi_use_chain == NULL) || var->no_val) { + removed_ops += try_remove_definition(ctx, i, var, NULL); + } + continue; + } else if (value_known(&ctx->values[i])) { value = &ctx->values[i]; } else { value = value_from_type_and_range(ctx, i, &tmp); @@ -1511,108 +2228,8 @@ static int replace_constant_operands(sccp_ctx *ctx) { } } FOREACH_USE_END(); - /* This is a basic DCE pass we run after SCCP. It only works on those instructions those result - * value(s) were determined by SCCP. It removes dead computational instructions and converts - * CV-affecting instructions into CONST ASSIGNs. This basic DCE is performed for multiple reasons: - * a) During operand replacement we eliminate FREEs. The corresponding computational instructions - * must be removed to avoid leaks. This way SCCP can run independently of the full DCE pass. - * b) The main DCE pass relies on type analysis to determine whether instructions have side-effects - * and can't be DCEd. This means that it will not be able collect all instructions rendered dead - * by SCCP, because they may have potentially side-effecting types, but the actual values are - * not. As such doing DCE here will allow us to eliminate more dead code in combination. - * c) The ordinary DCE pass cannot collect dead calls. However SCCP can result in dead calls, which - * we need to collect. */ - - if (var->definition >= 0 && value_known(&ctx->values[i])) { - zend_op *opline = &op_array->opcodes[var->definition]; - zend_ssa_op *ssa_op = &ssa->ops[var->definition]; - if (opline->opcode == ZEND_ASSIGN) { - /* Leave assigns to DCE (due to dtor effects) */ - continue; - } - - if (ssa_op->result_def == i - && ssa_op->op1_def < 0 - && ssa_op->op2_def < 0 - && var->use_chain < 0 - && var->phi_use_chain == NULL) { - if (opline->opcode == ZEND_DO_ICALL) { - /* Call instruction -> remove opcodes that are part of the call */ - zend_call_info *call; - int i; - - ZEND_ASSERT(ctx->call_map); - call = ctx->call_map[var->definition]; - ZEND_ASSERT(call); - ZEND_ASSERT(call->caller_call_opline == opline); - if (opline->result_type & (IS_TMP_VAR|IS_VAR)) { - zend_optimizer_remove_live_range_ex(op_array, opline->result.var, var->definition); - } - zend_ssa_remove_result_def(ssa, ssa_op); - zend_ssa_remove_instr(ssa, opline, ssa_op); - zend_ssa_remove_instr(ssa, call->caller_init_opline, - &ssa->ops[call->caller_init_opline - op_array->opcodes]); - - for (i = 0; i < call->num_args; i++) { - zend_ssa_remove_instr(ssa, call->arg_info[i].opline, - &ssa->ops[call->arg_info[i].opline - op_array->opcodes]); - } - removed_ops = call->num_args + 2; - - // TODO: remove call_info completely??? - call->callee_func = NULL; - } else { - /* Ordinary computational instruction -> remove it */ - if (opline->result_type & (IS_TMP_VAR|IS_VAR)) { - zend_optimizer_remove_live_range_ex(op_array, opline->result.var, var->definition); - } - zend_ssa_remove_result_def(ssa, ssa_op); - zend_ssa_remove_instr(ssa, opline, ssa_op); - removed_ops++; - } - } else if (ssa_op->op1_def == i) { - /* Compound assign or incdec -> convert to direct ASSIGN */ - - /* Destroy previous op2 */ - if (opline->op2_type == IS_CONST) { - literal_dtor(&ZEND_OP2_LITERAL(opline)); - } else if (ssa_op->op2_use >= 0) { - if (ssa_op->op2_use != ssa_op->op1_use) { - zend_ssa_unlink_use_chain(ssa, var->definition, ssa_op->op2_use); - } - ssa_op->op2_use = -1; - ssa_op->op2_use_chain = -1; - } - - /* Mark result unused, if possible */ - if (ssa_op->result_def >= 0 - && ssa->vars[ssa_op->result_def].use_chain < 0 - && ssa->vars[ssa_op->result_def].phi_use_chain == NULL) { - if (opline->result_type & (IS_TMP_VAR|IS_VAR)) { - zend_optimizer_remove_live_range_ex(op_array, opline->result.var, var->definition); - } - zend_ssa_remove_result_def(ssa, ssa_op); - opline->result_type = IS_UNUSED; - } - - /* Remove OP_DATA opcode */ - if (opline->opcode == ZEND_ASSIGN_DIM) { - removed_ops++; - zend_ssa_remove_instr(ssa, opline + 1, ssa_op + 1); - } - - /* Convert to ASSIGN */ - opline->opcode = ZEND_ASSIGN; - opline->op2_type = IS_CONST; - opline->op2.constant = zend_optimizer_add_literal(op_array, value); - Z_TRY_ADDREF_P(value); - } - } - if (var->definition_phi - && value_known(&ctx->values[i]) - && var->use_chain < 0 - && var->phi_use_chain == NULL) { - zend_ssa_remove_phi(ssa, var->definition_phi); + if (value_known(&ctx->values[i])) { + removed_ops += try_remove_definition(ctx, i, var, value); } } @@ -1665,6 +2282,39 @@ int sccp_optimize_op_array(zend_optimizer_ctx *ctx, zend_op_array *op_array, zen scdf_init(ctx, &sccp.scdf, op_array, ssa); scdf_solve(&sccp.scdf, "SCCP"); + if (ctx->debug_level & ZEND_DUMP_SCCP) { + int i, first = 1; + + for (i = op_array->last_var; i < ssa->vars_count; i++) { + zval *zv = &sccp.values[i]; + + if (IS_TOP(zv) || IS_BOT(zv)) { + continue; + } + if (first) { + first = 0; + fprintf(stderr, "\nSCCP Values for \""); + zend_dump_op_array_name(op_array); + fprintf(stderr, "\":\n"); + } + fprintf(stderr, " #%d.", i); + zend_dump_var(op_array, IS_CV, ssa->vars[i].var); + if (IS_PARTIAL_ARRAY(zv)) { + fprintf(stderr, " = ["); + zend_dump_ht(Z_ARRVAL_P(zv)); + fprintf(stderr, "]"); + } else if (IS_PARTIAL_OBJECT(zv)) { + fprintf(stderr, " = {"); + zend_dump_ht(Z_ARRVAL_P(zv)); + fprintf(stderr, "}"); + } else { + fprintf(stderr, " ="); + zend_dump_const(zv); + } + fprintf(stderr, "\n"); + } + } + removed_ops += scdf_remove_unreachable_blocks(&sccp.scdf); removed_ops += replace_constant_operands(&sccp); diff --git a/ext/opcache/Optimizer/zend_cfg.c b/ext/opcache/Optimizer/zend_cfg.c index 8276bec0518b6..2c1c0a7185341 100644 --- a/ext/opcache/Optimizer/zend_cfg.c +++ b/ext/opcache/Optimizer/zend_cfg.c @@ -296,7 +296,7 @@ int zend_build_cfg(zend_arena **arena, const zend_op_array *op_array, uint32_t b cfg->split_at_live_ranges = (build_flags & ZEND_CFG_SPLIT_AT_LIVE_RANGES) != 0; cfg->split_at_calls = (build_flags & ZEND_CFG_STACKLESS) != 0; - cfg->split_at_recv = (build_flags & ZEND_CFG_RECV_ENTRY) != 0 && (op_array->fn_flags & ZEND_ACC_HAS_TYPE_HINTS) == 0; + cfg->split_at_recv = (build_flags & ZEND_CFG_RECV_ENTRY) != 0; cfg->map = block_map = zend_arena_calloc(arena, op_array->last, sizeof(uint32_t)); diff --git a/ext/opcache/Optimizer/zend_dfg.c b/ext/opcache/Optimizer/zend_dfg.c index 3b4c9bb478ab5..49be85c6b87af 100644 --- a/ext/opcache/Optimizer/zend_dfg.c +++ b/ext/opcache/Optimizer/zend_dfg.c @@ -128,6 +128,10 @@ int zend_build_dfg(const zend_op_array *op_array, const zend_cfg *cfg, zend_dfg case ZEND_FETCH_OBJ_FUNC_ARG: case ZEND_FETCH_OBJ_UNSET: case ZEND_VERIFY_RETURN_TYPE: + case ZEND_PRE_INC_OBJ: + case ZEND_PRE_DEC_OBJ: + case ZEND_POST_INC_OBJ: + case ZEND_POST_DEC_OBJ: op1_def: /* `def` always come along with dtor or separation, * thus the origin var info might be also `use`d in the feature(CG) */ diff --git a/ext/opcache/Optimizer/zend_dump.c b/ext/opcache/Optimizer/zend_dump.c index 364c7b1980c7b..a28a12d9659b1 100644 --- a/ext/opcache/Optimizer/zend_dump.c +++ b/ext/opcache/Optimizer/zend_dump.c @@ -25,7 +25,30 @@ #include "zend_call_graph.h" #include "zend_dump.h" -static void zend_dump_const(const zval *zv) +void zend_dump_ht(HashTable *ht) +{ + zend_ulong index; + zend_string *key; + zval *val; + int first = 1; + + ZEND_HASH_FOREACH_KEY_VAL(ht, index, key, val) { + if (first) { + first = 0; + } else { + fprintf(stderr, ", "); + } + if (key) { + fprintf(stderr, "\"%s\"", ZSTR_VAL(key)); + } else { + fprintf(stderr, ZEND_LONG_FMT, index); + } + fprintf(stderr, " =>"); + zend_dump_const(val); + } ZEND_HASH_FOREACH_END(); +} + +void zend_dump_const(const zval *zv) { switch (Z_TYPE_P(zv)) { case IS_NULL: @@ -320,9 +343,12 @@ static void zend_dump_ssa_var(const zend_op_array *op_array, const zend_ssa *ssa zend_dump_var(op_array, (var_num < op_array->last_var ? IS_CV : var_type), var_num); if (ssa_var_num >= 0 && ssa->vars) { - if (ssa_var_num >= 0 && ssa->vars[ssa_var_num].no_val) { + if (ssa->vars[ssa_var_num].no_val) { fprintf(stderr, " NOVAL"); } + if (ssa->vars[ssa_var_num].escape_state == ESCAPE_STATE_NO_ESCAPE) { + fprintf(stderr, " NOESC"); + } if (ssa->var_info) { zend_dump_ssa_var_info(ssa, ssa_var_num, dump_flags); if (ssa->var_info[ssa_var_num].has_range) { @@ -800,7 +826,7 @@ static void zend_dump_block_header(const zend_cfg *cfg, const zend_op_array *op_ } } -static void zend_dump_op_array_name(const zend_op_array *op_array) +void zend_dump_op_array_name(const zend_op_array *op_array) { zend_func_info *func_info = NULL; diff --git a/ext/opcache/Optimizer/zend_dump.h b/ext/opcache/Optimizer/zend_dump.h index 11646d9a829a4..ff159a9dc978c 100644 --- a/ext/opcache/Optimizer/zend_dump.h +++ b/ext/opcache/Optimizer/zend_dump.h @@ -37,6 +37,9 @@ void zend_dump_phi_placement(const zend_op_array *op_array, const zend_ssa *ssa) void zend_dump_variables(const zend_op_array *op_array); void zend_dump_ssa_variables(const zend_op_array *op_array, const zend_ssa *ssa, uint32_t dump_flags); void zend_dump_var(const zend_op_array *op_array, zend_uchar var_type, int var_num); +void zend_dump_op_array_name(const zend_op_array *op_array); +void zend_dump_const(const zval *zv); +void zend_dump_ht(HashTable *ht); END_EXTERN_C() diff --git a/ext/opcache/Optimizer/zend_func_info.c b/ext/opcache/Optimizer/zend_func_info.c index 5fdb61e84f734..de80711065bcc 100644 --- a/ext/opcache/Optimizer/zend_func_info.c +++ b/ext/opcache/Optimizer/zend_func_info.c @@ -13,6 +13,7 @@ | license@php.net so we can mail you a copy immediately. | +----------------------------------------------------------------------+ | Authors: Dmitry Stogov | + | Xinchen Hui | +----------------------------------------------------------------------+ */ @@ -61,9 +62,8 @@ typedef struct _func_info_t { static uint32_t zend_strlen_info(const zend_call_info *call_info, const zend_ssa *ssa) { - if (call_info->caller_init_opline->extended_value == (uint32_t)call_info->num_args && - call_info->num_args == 1) { - + ZEND_ASSERT(call_info->caller_init_opline->extended_value == (uint32_t)call_info->num_args); + if (call_info->num_args == 1) { uint32_t tmp = 0; if (call_info->arg_info[0].opline) { uint32_t arg_info = _ssa_op1_info(call_info->caller_op_array, ssa, call_info->arg_info[0].opline); @@ -87,8 +87,8 @@ static uint32_t zend_strlen_info(const zend_call_info *call_info, const zend_ssa static uint32_t zend_dechex_info(const zend_call_info *call_info, const zend_ssa *ssa) { - if (call_info->caller_init_opline->extended_value == (uint32_t)call_info->num_args && - call_info->num_args == 1) { + ZEND_ASSERT(call_info->caller_init_opline->extended_value == (uint32_t)call_info->num_args); + if (call_info->num_args == 1) { return MAY_BE_RC1 | MAY_BE_STRING; } else { /* warning, and returns NULL */ @@ -98,8 +98,8 @@ static uint32_t zend_dechex_info(const zend_call_info *call_info, const zend_ssa static uint32_t zend_range_info(const zend_call_info *call_info, const zend_ssa *ssa) { - if (call_info->caller_init_opline->extended_value == (uint32_t)call_info->num_args && - (call_info->num_args == 2 || call_info->num_args == 3)) { + ZEND_ASSERT(call_info->caller_init_opline->extended_value == (uint32_t)call_info->num_args); + if (call_info->num_args == 2 || call_info->num_args == 3) { uint32_t t1 = _ssa_op1_info(call_info->caller_op_array, ssa, call_info->arg_info[0].opline); uint32_t t2 = _ssa_op1_info(call_info->caller_op_array, ssa, call_info->arg_info[1].opline); @@ -131,8 +131,8 @@ static uint32_t zend_range_info(const zend_call_info *call_info, const zend_ssa static uint32_t zend_is_type_info(const zend_call_info *call_info, const zend_ssa *ssa) { - if (call_info->caller_init_opline->extended_value == (uint32_t)call_info->num_args && - call_info->num_args == 1) { + ZEND_ASSERT(call_info->caller_init_opline->extended_value == (uint32_t)call_info->num_args); + if (call_info->num_args == 1) { return MAY_BE_FALSE | MAY_BE_TRUE; } else { return MAY_BE_FALSE | MAY_BE_TRUE | FUNC_MAY_WARN; @@ -141,8 +141,8 @@ static uint32_t zend_is_type_info(const zend_call_info *call_info, const zend_ss static uint32_t zend_l_ss_info(const zend_call_info *call_info, const zend_ssa *ssa) { - if (call_info->caller_init_opline->extended_value == (uint32_t)call_info->num_args && - call_info->num_args == 2) { + ZEND_ASSERT(call_info->caller_init_opline->extended_value == (uint32_t)call_info->num_args); + if (call_info->num_args == 2) { uint32_t arg1_info = _ssa_op1_info(call_info->caller_op_array, ssa, call_info->arg_info[0].opline); uint32_t arg2_info = _ssa_op1_info(call_info->caller_op_array, ssa, call_info->arg_info[1].opline); @@ -166,8 +166,8 @@ static uint32_t zend_l_ss_info(const zend_call_info *call_info, const zend_ssa * static uint32_t zend_lb_ssn_info(const zend_call_info *call_info, const zend_ssa *ssa) { - if (call_info->caller_init_opline->extended_value == (uint32_t)call_info->num_args && - call_info->num_args == 3) { + ZEND_ASSERT(call_info->caller_init_opline->extended_value == (uint32_t)call_info->num_args); + if (call_info->num_args == 3) { uint32_t arg1_info = _ssa_op1_info(call_info->caller_op_array, ssa, call_info->arg_info[0].opline); uint32_t arg2_info = _ssa_op1_info(call_info->caller_op_array, ssa, call_info->arg_info[1].opline); uint32_t arg3_info = _ssa_op1_info(call_info->caller_op_array, ssa, call_info->arg_info[2].opline); @@ -193,8 +193,8 @@ static uint32_t zend_lb_ssn_info(const zend_call_info *call_info, const zend_ssa static uint32_t zend_b_s_info(const zend_call_info *call_info, const zend_ssa *ssa) { - if (call_info->caller_init_opline->extended_value == (uint32_t)call_info->num_args && - call_info->num_args == 1) { + ZEND_ASSERT(call_info->caller_init_opline->extended_value == (uint32_t)call_info->num_args); + if (call_info->num_args == 1) { uint32_t arg1_info = _ssa_op1_info(call_info->caller_op_array, ssa, call_info->arg_info[0].opline); uint32_t tmp = 0; @@ -249,14 +249,15 @@ static const func_info_t func_infos[] = { F0("trait_exists", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE), FC("function_exists", zend_b_s_info), // TODO: inline F0("class_alias", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE), - F1("get_included_files", MAY_BE_NULL | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING), + I1("get_included_files", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING), F0("trigger_error", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE), F0("user_error", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE), FN("set_error_handler", MAY_BE_NULL | MAY_BE_STRING | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING | MAY_BE_ARRAY_OF_OBJECT | MAY_BE_OBJECT), - I0("restore_error_handler", MAY_BE_NULL | MAY_BE_TRUE), - F1("get_declared_traits", MAY_BE_NULL | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING), - F1("get_declared_classes", MAY_BE_NULL | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING), - F1("get_declared_interfaces", MAY_BE_NULL | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING), + I0("restore_error_handler", MAY_BE_TRUE), + I0("restore_exception_handler", MAY_BE_TRUE), + I1("get_declared_traits", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING), + I1("get_declared_classes", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING), + I1("get_declared_interfaces", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING), F1("get_defined_functions", MAY_BE_NULL | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_ARRAY), I1("get_defined_vars", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_ANY | MAY_BE_ARRAY_OF_REF), FN("create_function", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE | MAY_BE_STRING), @@ -302,10 +303,10 @@ static const func_info_t func_infos[] = { F0("phpinfo", MAY_BE_NULL | MAY_BE_TRUE), F1("phpversion", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING), F0("phpcredits", MAY_BE_NULL | MAY_BE_TRUE), - F1("php_sapi_name", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING), + I1("php_sapi_name", MAY_BE_FALSE | MAY_BE_STRING), F1("php_uname", MAY_BE_NULL | MAY_BE_STRING), - F1("php_ini_scanned_files", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING), - F1("php_ini_loaded_file", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING), + I1("php_ini_scanned_files", MAY_BE_FALSE | MAY_BE_STRING), + I1("php_ini_loaded_file", MAY_BE_FALSE | MAY_BE_STRING), F0("strnatcmp", MAY_BE_NULL | MAY_BE_LONG), F0("strnatcasecmp", MAY_BE_NULL | MAY_BE_LONG), F0("substr_count", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG), @@ -364,7 +365,7 @@ static const func_info_t func_infos[] = { FN("implode", MAY_BE_NULL | MAY_BE_STRING), FN("join", MAY_BE_NULL | MAY_BE_STRING), FN("setlocale", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING), - F1("localeconv", MAY_BE_NULL | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_LONG | MAY_BE_ARRAY_OF_STRING | MAY_BE_ARRAY_OF_ARRAY), + F1("localeconv", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_LONG | MAY_BE_ARRAY_OF_STRING | MAY_BE_ARRAY_OF_ARRAY), #if HAVE_NL_LANGINFO F1("nl_langinfo", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING), #endif @@ -418,7 +419,7 @@ static const func_info_t func_infos[] = { F0("getrandmax", MAY_BE_NULL | MAY_BE_LONG), F0("mt_rand", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG), F0("mt_srand", MAY_BE_NULL), - F0("mt_getrandmax", MAY_BE_NULL | MAY_BE_LONG), + I0("mt_getrandmax", MAY_BE_LONG), #if HAVE_GETSERVBYNAME F0("getservbyname", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG), #endif @@ -431,11 +432,11 @@ static const func_info_t func_infos[] = { #if HAVE_GETPROTOBYNUMBER F1("getprotobynumber", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING), #endif - F0("getmyuid", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG), - F0("getmygid", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG), - F0("getmypid", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG), - F0("getmyinode", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG), - F0("getlastmod", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG), + F0("getmyuid", MAY_BE_FALSE | MAY_BE_LONG), + F0("getmygid", MAY_BE_FALSE | MAY_BE_LONG), + F0("getmypid", MAY_BE_FALSE | MAY_BE_LONG), + F0("getmyinode", MAY_BE_FALSE | MAY_BE_LONG), + F0("getlastmod", MAY_BE_FALSE | MAY_BE_LONG), F1("base64_decode", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING), F1("base64_encode", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING), F1("password_hash", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING), @@ -498,7 +499,7 @@ static const func_info_t func_infos[] = { #endif F1("getopt", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_FALSE | MAY_BE_ARRAY_OF_TRUE | MAY_BE_ARRAY_OF_STRING | MAY_BE_ARRAY_OF_ARRAY), #ifdef HAVE_GETLOADAVG - F1("sys_getloadavg", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_DOUBLE), + F1("sys_getloadavg", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_DOUBLE), #endif #ifdef HAVE_GETTIMEOFDAY F1("microtime", MAY_BE_NULL | MAY_BE_DOUBLE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_LONG | MAY_BE_STRING), @@ -513,16 +514,16 @@ static const func_info_t func_infos[] = { F1("quoted_printable_decode", MAY_BE_NULL | MAY_BE_STRING), F1("quoted_printable_encode", MAY_BE_NULL | MAY_BE_STRING), F1("convert_cyr_string", MAY_BE_NULL | MAY_BE_STRING), - F1("get_current_user", MAY_BE_NULL | MAY_BE_STRING), + I1("get_current_user", MAY_BE_STRING), F0("set_time_limit", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE), F0("header_register_callback", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE), F1("get_cfg_var", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_STRING | MAY_BE_ARRAY_OF_ARRAY), - F0("magic_quotes_runtime", MAY_BE_NULL | MAY_BE_FALSE), - F0("set_magic_quotes_runtime", MAY_BE_NULL | MAY_BE_FALSE), - F0("get_magic_quotes_gpc", MAY_BE_NULL | MAY_BE_FALSE), - F0("get_magic_quotes_runtime", MAY_BE_NULL | MAY_BE_FALSE), + I0("magic_quotes_runtime", MAY_BE_FALSE), + I0("set_magic_quotes_runtime", MAY_BE_FALSE), + I0("get_magic_quotes_gpc", MAY_BE_FALSE), + I0("get_magic_quotes_runtime", MAY_BE_FALSE), F0("error_log", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE), - F1("error_get_last", MAY_BE_NULL | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_LONG | MAY_BE_ARRAY_OF_STRING), + I1("error_get_last", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_LONG | MAY_BE_ARRAY_OF_STRING), FN("call_user_func", UNKNOWN_INFO), FN("call_user_func_array", UNKNOWN_INFO), FN("call_user_method", UNKNOWN_INFO), @@ -549,7 +550,7 @@ static const func_info_t func_infos[] = { FN("ini_set", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING), F1("ini_alter", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING), F0("ini_restore", MAY_BE_NULL), - F1("get_include_path", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING), + I1("get_include_path", MAY_BE_FALSE | MAY_BE_STRING), F1("set_include_path", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING), F0("restore_include_path", MAY_BE_NULL), F0("setcookie", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE), @@ -557,7 +558,7 @@ static const func_info_t func_infos[] = { F0("header", MAY_BE_NULL), F0("header_remove", MAY_BE_NULL), F0("headers_sent", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE), - F1("headers_list", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING), + F1("headers_list", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING), F0("http_response_code", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG), F0("connection_aborted", MAY_BE_LONG), F0("connection_status", MAY_BE_LONG), @@ -573,9 +574,9 @@ static const func_info_t func_infos[] = { F1("gethostbyname", MAY_BE_NULL | MAY_BE_STRING), F1("gethostbynamel", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING), #ifdef HAVE_GETHOSTNAME - F1("gethostname", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING), + F1("gethostname", MAY_BE_FALSE | MAY_BE_STRING), #endif -#if defined(PHP_WIN32) || (HAVE_DNS_SEARCH_FUNC && !(defined(__BEOS__))) +#if defined(PHP_WIN32) || HAVE_DNS_SEARCH_FUNC F0("dns_check_record", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE), F0("checkdnsrr", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE), # if defined(PHP_WIN32) || HAVE_FULL_DNS_FUNCS @@ -631,7 +632,7 @@ static const func_info_t func_infos[] = { F0("rename", MAY_BE_FALSE | MAY_BE_TRUE), F0("copy", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE), F1("tempnam", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING), - F1("tmpfile", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_RESOURCE), + F1("tmpfile", MAY_BE_FALSE | MAY_BE_RESOURCE), F1("file", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING), F1("file_get_contents", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING), F0("file_put_contents", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG), @@ -679,8 +680,8 @@ static const func_info_t func_infos[] = { F0("stream_register_wrapper", MAY_BE_FALSE | MAY_BE_TRUE), F0("stream_wrapper_unregister", MAY_BE_FALSE | MAY_BE_TRUE), F0("stream_wrapper_restore", MAY_BE_FALSE | MAY_BE_TRUE), - F1("stream_get_wrappers", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING), - F1("stream_get_transports", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING), + F1("stream_get_wrappers", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING), + F1("stream_get_transports", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING), F1("stream_resolve_include_path", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING), F0("stream_is_local", MAY_BE_FALSE | MAY_BE_TRUE), F1("get_headers", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING | MAY_BE_ARRAY_OF_ARRAY), @@ -689,7 +690,7 @@ static const func_info_t func_infos[] = { F0("socket_set_timeout", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE), #endif F1("socket_get_status", MAY_BE_NULL | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_ANY), -#if (!defined(__BEOS__) && HAVE_REALPATH) || defined(ZTS) +#if HAVE_REALPATH || defined(ZTS) F1("realpath", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING), #endif #ifdef HAVE_FNMATCH @@ -707,7 +708,7 @@ static const func_info_t func_infos[] = { #if defined(HAVE_CHROOT) && !defined(ZTS) && ENABLE_CHROOT_FUNC F0("chroot", MAY_BE_FALSE | MAY_BE_TRUE), #endif - F1("getcwd", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING), + F1("getcwd", MAY_BE_FALSE | MAY_BE_STRING), F0("rewinddir", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE), F1("readdir", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING), F1("dir", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_OBJECT), @@ -750,14 +751,14 @@ static const func_info_t func_infos[] = { F0("disk_total_space", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_DOUBLE), F0("disk_free_space", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_DOUBLE), F0("diskfreespace", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_DOUBLE), - F0("realpath_cache_size", MAY_BE_NULL | MAY_BE_LONG), - F1("realpath_cache_get", MAY_BE_NULL | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_ARRAY), + I0("realpath_cache_size", MAY_BE_LONG), + I1("realpath_cache_get", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_ARRAY), F0("mail", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE), F0("ezmlm_hash", MAY_BE_NULL | MAY_BE_LONG), #ifdef HAVE_SYSLOG_H F0("openlog", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE), F0("syslog", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE), - F0("closelog", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE), + F0("closelog", MAY_BE_TRUE), #endif F0("lcg_value", MAY_BE_DOUBLE), F1("metaphone", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING), @@ -859,7 +860,7 @@ static const func_info_t func_infos[] = { F0("ftok", MAY_BE_NULL | MAY_BE_LONG), #endif F1("str_rot13", MAY_BE_NULL | MAY_BE_STRING), - F1("stream_get_filters", MAY_BE_NULL | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING), + I1("stream_get_filters", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING), F0("stream_filter_register", MAY_BE_FALSE | MAY_BE_TRUE), F1("stream_bucket_make_writeable", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_OBJECT), F1("stream_bucket_prepend", MAY_BE_FALSE | MAY_BE_OBJECT), @@ -867,7 +868,7 @@ static const func_info_t func_infos[] = { F1("stream_bucket_new", MAY_BE_FALSE | MAY_BE_OBJECT), F0("output_add_rewrite_var", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE), F0("output_reset_rewrite_vars", MAY_BE_FALSE), - F1("sys_get_temp_dir", MAY_BE_NULL | MAY_BE_STRING), + I1("sys_get_temp_dir", MAY_BE_STRING), /* ext/date */ F0("strtotime", MAY_BE_FALSE | MAY_BE_LONG), @@ -1008,6 +1009,107 @@ static const func_info_t func_infos[] = { F1("mysql_tablename", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING), F1("mysql_table_name", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING), + /* ext/mysqli */ + F1("mysqli_connect", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_RESOURCE), + F0("mysqli_close", MAY_BE_NULL | MAY_BE_TRUE), + I1("mysqli_connect_error", MAY_BE_NULL | MAY_BE_STRING), + I0("mysqli_connect_errno", MAY_BE_LONG), + F1("mysqli_get_client_stats", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_STRING), + F1("mysqli_error_list", MAY_BE_NULL | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_ARRAY), + F1("mysqli_get_links_stats", MAY_BE_NULL | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_LONG), + F1("mysqli_query", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE | MAY_BE_RESOURCE), + F0("mysqli_multi_query", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE), + F0("mysqli_set_charset", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE), + F1("mysqli_get_charset", MAY_BE_NULL | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_ANY), + F0("mysqli_begin_transaction", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE), + F0("mysqli_savepoint", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE), + F0("mysqli_release_savepoint", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE), + F1("mysqli_fetch_array", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_ANY), + F1("mysqli_fetch_assoc", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_ANY), + F1("mysqli_fetch_all", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_ANY), + F1("mysqli_fetch_object", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_OBJECT), + F0("mysqli_free_result", MAY_BE_NULL), + F0("mysqli_affected_rows", MAY_BE_NULL | MAY_BE_LONG), + F0("mysqli_autocommit", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE), + F0("mysqli_stmt_bind_param", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE), + F0("mysqli_stmt_bind_result", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE), + F0("mysqli_change_user", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE), + F1("mysqli_character_set_name", MAY_BE_NULL | MAY_BE_STRING), + F0("mysqli_commit", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE), + F0("mysqli_data_seek", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE), + F0("mysqli_debug", MAY_BE_NULL | MAY_BE_TRUE), + F0("mysqli_dump_debug_info", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE), + F0("mysqli_errno", MAY_BE_NULL | MAY_BE_LONG), + F1("mysqli_error", MAY_BE_NULL | MAY_BE_STRING), + F0("mysqli_stmt_execute", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE), + F0("mysqli_poll", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG), + F1("mysqli_reap_async_query", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE | MAY_BE_RESOURCE), + F1("mysqli_stmt_get_result", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_RESOURCE), + F1("mysqli_get_warnings", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_RESOURCE), + F1("mysqli_stmt_error_list", MAY_BE_NULL | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_ARRAY), + F1("mysqli_stmt_get_warnings", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_RESOURCE), + F0("mysqli_stmt_fetch", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE), + F1("mysqli_fetch_field", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_OBJECT), + F1("mysqli_fetch_fields", MAY_BE_NULL | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_OBJECT), + F1("mysqli_fetch_field_direct", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_OBJECT), + F1("mysqli_fetch_lengths", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_LONG), + F1("mysqli_fetch_row", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_ANY), + F0("mysqli_field_count", MAY_BE_NULL | MAY_BE_LONG), + F0("mysqli_field_seek", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE), + F0("mysqli_field_tell", MAY_BE_NULL | MAY_BE_LONG), + I1("mysqli_get_client_info", MAY_BE_STRING), + I0("mysqli_get_client_version", MAY_BE_LONG), + F1("mysqli_get_host_info", MAY_BE_NULL | MAY_BE_STRING), + F0("mysqli_get_proto_info", MAY_BE_NULL | MAY_BE_LONG), + F1("mysqli_get_server_info", MAY_BE_NULL | MAY_BE_STRING), + F0("mysqli_get_server_version", MAY_BE_NULL | MAY_BE_LONG), + F1("mysqli_info", MAY_BE_NULL | MAY_BE_STRING), + F1("mysqli_init", MAY_BE_FALSE | MAY_BE_RESOURCE), + F0("mysqli_insert_id", MAY_BE_NULL | MAY_BE_LONG), + F0("mysqli_kill", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE), + F0("mysqli_more_results", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE), + F0("mysqli_next_result", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE), + F0("mysqli_stmt_more_results", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE), + F0("mysqli_stmt_next_result", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE), + F0("mysqli_num_fields", MAY_BE_NULL | MAY_BE_LONG), + F0("mysqli_num_rows", MAY_BE_NULL | MAY_BE_LONG), + F0("mysqli_options", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE), + F0("mysqli_ping", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE), + F1("mysqli_prepare", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_RESOURCE), + F0("mysqli_real_connect", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE), + F0("mysqli_real_query", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE), + F1("mysqli_real_escape_string", MAY_BE_NULL | MAY_BE_STRING), + F0("mysqli_rollback", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE), + F0("mysqli_stmt_send_long_data", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE), + F0("mysqli_stmt_affected_rows", MAY_BE_NULL | MAY_BE_LONG), + F0("mysqli_stmt_close", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE), + F0("mysqli_stmt_data_seek", MAY_BE_NULL | MAY_BE_FALSE), + F0("mysqli_stmt_field_count", MAY_BE_NULL | MAY_BE_LONG), + F0("mysqli_stmt_free_result", MAY_BE_NULL), + F0("mysqli_stmt_insert_id", MAY_BE_NULL | MAY_BE_LONG), + F0("mysqli_stmt_param_count", MAY_BE_NULL | MAY_BE_LONG), + F0("mysqli_stmt_reset", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE), + F0("mysqli_stmt_num_rows", MAY_BE_NULL | MAY_BE_LONG), + F0("mysqli_select_db", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE), + F1("mysqli_sqlstate", MAY_BE_NULL | MAY_BE_STRING), + F0("mysqli_ssl_set", MAY_BE_NULL | MAY_BE_TRUE), + F1("mysqli_stat", MAY_BE_NULL | MAY_BE_STRING), + F0("mysqli_refresh", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE), + F0("mysqli_stmt_attr_set", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE), + F0("mysqli_stmt_attr_get", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG), + F0("mysqli_stmt_errno", MAY_BE_NULL | MAY_BE_LONG), + F1("mysqli_stmt_error", MAY_BE_NULL | MAY_BE_STRING), + F1("mysqli_stmt_init", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_RESOURCE), + F0("mysqli_stmt_prepare", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE), + F1("mysqli_stmt_result_metadata", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_RESOURCE), + F0("mysqli_stmt_store_result", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE), + F1("mysqli_stmt_sqlstate", MAY_BE_NULL | MAY_BE_STRING), + F1("mysqli_store_result", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_RESOURCE), + F0("mysqli_thread_id", MAY_BE_NULL | MAY_BE_LONG), + I0("mysqli_thread_safe", MAY_BE_FALSE | MAY_BE_TRUE), + F1("mysqli_use_result", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_RESOURCE), + F0("mysqli_warning_count", MAY_BE_NULL | MAY_BE_LONG), + /* ext/curl */ F1("curl_init", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_RESOURCE), F1("curl_copy_handle", MAY_BE_NULL | MAY_BE_RESOURCE), @@ -1025,7 +1127,7 @@ static const func_info_t func_infos[] = { F1("curl_escape", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING), F1("curl_unescape", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING), F0("curl_pause", MAY_BE_NULL | MAY_BE_LONG), - F1("curl_multi_init", MAY_BE_NULL | MAY_BE_RESOURCE), + F1("curl_multi_init", MAY_BE_RESOURCE), F0("curl_multi_add_handle", MAY_BE_NULL | MAY_BE_LONG), F0("curl_multi_remove_handle", MAY_BE_NULL | MAY_BE_LONG), F0("curl_multi_select", MAY_BE_NULL | MAY_BE_LONG), @@ -1034,7 +1136,7 @@ static const func_info_t func_infos[] = { F1("curl_multi_info_read", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_LONG | MAY_BE_ARRAY_OF_RESOURCE), F0("curl_multi_close", MAY_BE_NULL), F0("curl_multi_setopt", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE), - F1("curl_share_init", MAY_BE_NULL | MAY_BE_RESOURCE), + I1("curl_share_init", MAY_BE_RESOURCE), F0("curl_share_close", MAY_BE_NULL), F0("curl_share_setopt", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE), F1("curl_file_create", MAY_BE_OBJECT), @@ -1068,7 +1170,7 @@ static const func_info_t func_infos[] = { F1("mb_strimwidth", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING), F1("mb_convert_encoding", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_ANY), F1("mb_detect_encoding", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING), - F1("mb_list_encodings", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING), + I1("mb_list_encodings", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING), F1("mb_encoding_aliases", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING), F1("mb_convert_kana", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING), F1("mb_encode_mimeheader", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING), @@ -1127,8 +1229,8 @@ static const func_info_t func_infos[] = { /* ext/json */ F1("json_encode", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING), F1("json_decode", MAY_BE_ANY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_ANY), - F0("json_last_error", MAY_BE_NULL | MAY_BE_LONG), - F1("json_last_error_msg", MAY_BE_NULL | MAY_BE_STRING), + I0("json_last_error", MAY_BE_LONG), + I1("json_last_error_msg", MAY_BE_STRING), /* ext/xml */ FN("xml_parser_create", MAY_BE_FALSE | MAY_BE_RESOURCE), @@ -1180,7 +1282,7 @@ static const func_info_t func_infos[] = { F1("gzdecode", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING), F1("zlib_encode", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING), F1("zlib_decode", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING), - F1("zlib_get_coding_type", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING), + I1("zlib_get_coding_type", MAY_BE_FALSE | MAY_BE_STRING), F1("ob_gzhandler", MAY_BE_FALSE | MAY_BE_STRING), /* ext/hash */ @@ -1199,8 +1301,386 @@ static const func_info_t func_infos[] = { F1("mhash_keygen_s2k", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING), F0("mhash_get_block_size", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG), F1("mhash_get_hash_name", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING), - F0("mhash_count", MAY_BE_NULL | MAY_BE_LONG), + I0("mhash_count", MAY_BE_LONG), F1("mhash", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING), + + /* ext/sodium */ + F0("sodium_memzero", MAY_BE_NULL), + F0("sodium_increment", MAY_BE_NULL), + F0("sodium_add", MAY_BE_NULL), + F0("sodium_memcmp", MAY_BE_NULL | MAY_BE_LONG), + F1("sodium_crypto_shorthash", MAY_BE_NULL | MAY_BE_STRING), + F1("sodium_crypto_secretbox", MAY_BE_NULL | MAY_BE_STRING), + F1("sodium_crypto_secretbox_open", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING), + F1("sodium_crypto_generichash", MAY_BE_NULL | MAY_BE_STRING), + F1("sodium_crypto_generichash_init", MAY_BE_NULL | MAY_BE_STRING), + F0("sodium_crypto_generichash_update", MAY_BE_NULL | MAY_BE_TRUE), + F1("sodium_crypto_generichash_final", MAY_BE_NULL | MAY_BE_STRING), + F1("sodium_crypto_box_keypair", MAY_BE_STRING), + F1("sodium_crypto_box_seed_keypair", MAY_BE_NULL | MAY_BE_STRING), + F1("sodium_crypto_box_secretkey", MAY_BE_NULL | MAY_BE_STRING), + F1("sodium_crypto_box_publickey", MAY_BE_NULL | MAY_BE_STRING), + F1("sodium_crypto_box", MAY_BE_NULL | MAY_BE_STRING), + F1("sodium_crypto_box_open", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING), + F1("sodium_crypto_box_seal", MAY_BE_NULL | MAY_BE_STRING), + F1("sodium_crypto_box_seal_open", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING), + F1("sodium_crypto_sign_keypair", MAY_BE_STRING), + F1("sodium_crypto_sign_seed_keypair", MAY_BE_NULL | MAY_BE_STRING), + F1("sodium_crypto_sign_secretkey", MAY_BE_NULL | MAY_BE_STRING), + F1("sodium_crypto_sign_publickey", MAY_BE_NULL | MAY_BE_STRING), + F1("sodium_crypto_sign", MAY_BE_NULL | MAY_BE_STRING), + F1("sodium_crypto_sign_open", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING), + F1("sodium_crypto_sign_detached", MAY_BE_NULL | MAY_BE_STRING), + F0("sodium_crypto_sign_verify_detached", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE), + F1("sodium_crypto_stream", MAY_BE_NULL | MAY_BE_STRING), + F1("sodium_crypto_stream_xor", MAY_BE_NULL | MAY_BE_STRING), + F1("sodium_crypto_pwhash", MAY_BE_NULL | MAY_BE_STRING), + F1("sodium_crypto_pwhash_str", MAY_BE_NULL | MAY_BE_STRING), + F0("sodium_crypto_pwhash_str_verify", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE), + F1("sodium_crypto_aead_aes256gcm_encrypt", MAY_BE_NULL | MAY_BE_STRING), + F1("sodium_crypto_aead_aes256gcm_decrypt", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING), + F1("sodium_bin2hex", MAY_BE_NULL | MAY_BE_STRING), + F1("sodium_hex2bin", MAY_BE_NULL | MAY_BE_STRING), + F1("sodium_crypto_scalarmult", MAY_BE_NULL | MAY_BE_STRING), + F1("sodium_crypto_kx_seed_keypair", MAY_BE_NULL | MAY_BE_STRING), + F1("sodium_crypto_kx_keypair", MAY_BE_STRING), + F1("sodium_crypto_kx_secretkey", MAY_BE_NULL | MAY_BE_STRING), + F1("sodium_crypto_kx_publickey", MAY_BE_NULL | MAY_BE_STRING), + F1("sodium_crypto_kx_client_session_keys", MAY_BE_NULL | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING), + F1("sodium_crypto_kx_server_session_keys", MAY_BE_NULL | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING), + F1("sodium_crypto_auth", MAY_BE_NULL | MAY_BE_STRING), + F0("sodium_crypto_auth_verify", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE), + F0("sodium_compare", MAY_BE_NULL | MAY_BE_LONG), + F1("sodium_crypto_aead_aes256gcm_keygen", MAY_BE_STRING), + F1("sodium_crypto_auth_keygen", MAY_BE_STRING), + F1("sodium_crypto_generichash_keygen", MAY_BE_STRING), + F1("sodium_crypto_kdf_keygen", MAY_BE_STRING), + F1("sodium_crypto_secretbox_keygen", MAY_BE_STRING), + F1("sodium_crypto_shorthash_keygen", MAY_BE_STRING), + F1("sodium_crypto_stream_keygen", MAY_BE_STRING), + F1("sodium_crypto_kdf_derive_from_key", MAY_BE_NULL | MAY_BE_STRING), + F1("sodium_pad", MAY_BE_NULL | MAY_BE_STRING), + F1("sodium_unpad", MAY_BE_NULL | MAY_BE_STRING), + + F1("sodium_crypto_box_keypair_from_secretkey_and_publickey", MAY_BE_NULL | MAY_BE_STRING), + F1("sodium_crypto_box_publickey_from_secretkey", MAY_BE_NULL | MAY_BE_STRING), + F1("sodium_crypto_sign_keypair_from_secretkey_and_publickey", MAY_BE_NULL | MAY_BE_STRING), + F1("sodium_crypto_sign_publickey_from_secretkey", MAY_BE_NULL | MAY_BE_STRING), + F1("sodium_crypto_pwhash_scryptsalsa208sha256", MAY_BE_NULL | MAY_BE_STRING), + F1("sodium_crypto_pwhash_scryptsalsa208sha256_str", MAY_BE_NULL | MAY_BE_STRING), + F0("sodium_crypto_pwhash_scryptsalsa208sha256_str_verify", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE), + F0("sodium_crypto_aead_aes256gcm_is_available", MAY_BE_FALSE | MAY_BE_TRUE), + F1("sodium_crypto_sign_ed25519_sk_to_curve25519", MAY_BE_NULL | MAY_BE_STRING), + F1("sodium_crypto_sign_ed25519_pk_to_curve25519", MAY_BE_NULL | MAY_BE_STRING), + F1("sodium_crypto_aead_chacha20poly1305_encrypt", MAY_BE_NULL | MAY_BE_STRING), + F1("sodium_crypto_aead_chacha20poly1305_decrypt", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING), + F1("sodium_crypto_aead_chacha20poly1305_ietf_encrypt", MAY_BE_NULL | MAY_BE_STRING), + F1("sodium_crypto_aead_chacha20poly1305_ietf_decrypt", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING), + F1("sodium_crypto_aead_xchacha20poly1305_ietf_encrypt", MAY_BE_NULL | MAY_BE_STRING), + F1("sodium_crypto_aead_xchacha20poly1305_ietf_decrypt", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING), + F1("sodium_crypto_aead_chacha20poly1305_keygen", MAY_BE_STRING), + F1("sodium_crypto_aead_chacha20poly1305_ietf_keygen", MAY_BE_STRING), + F1("sodium_crypto_aead_xchacha20poly1305_ietf_keygen", MAY_BE_STRING), + + /* ext/session */ + F0("session_set_cookie_params", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE), + I1("session_get_cookie_params", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_ANY), + F1("session_name", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING), + F1("session_module_name", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING), + F0("session_set_save_handler", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE), + F1("session_save_path", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING), + FN("session_id", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING), + F0("session_regenerate_id", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE), + F1("session_create_id", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING), + F1("session_cache_limiter", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING), + F0("session_cache_expire", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG), + I1("session_encode", MAY_BE_FALSE | MAY_BE_STRING), + F0("session_decode", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE), + F0("session_start", MAY_BE_FALSE | MAY_BE_TRUE), + I0("session_destroy", MAY_BE_FALSE | MAY_BE_TRUE), + I0("session_unset", MAY_BE_FALSE | MAY_BE_TRUE), + F0("session_gc", MAY_BE_FALSE | MAY_BE_LONG), + F0("session_write_close", MAY_BE_FALSE | MAY_BE_TRUE), + F0("session_abort", MAY_BE_FALSE | MAY_BE_TRUE), + F0("session_reset", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE), + F0("session_status", MAY_BE_NULL | MAY_BE_LONG), + I0("session_register_shutdown", MAY_BE_NULL), + + /* ext/pgsql */ + F1("pg_connect", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_RESOURCE), + F1("pg_pconnect", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_RESOURCE), + F0("pg_connect_poll", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG), + F0("pg_close", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE), + F1("pg_dbname", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING), + F1("pg_last_error", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING), + F1("pg_options", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING), + F1("pg_port", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING), + F1("pg_tty", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING), + F1("pg_host", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING), + F1("pg_version", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_STRING), + F1("pg_parameter_status", MAY_BE_FALSE | MAY_BE_STRING), + F0("pg_ping", MAY_BE_FALSE | MAY_BE_TRUE), + F1("pg_query", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_RESOURCE), + F1("pg_query_params", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_RESOURCE), + F1("pg_prepare", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_RESOURCE), + F1("pg_execute", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_RESOURCE), + F0("pg_num_rows", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG), + F0("pg_num_fields", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG), + F0("pg_affected_rows", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG), + FN("pg_last_notice", UNKNOWN_INFO), + F1("pg_field_table", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG | MAY_BE_STRING), + F1("pg_field_name", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING), + F0("pg_field_size", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG), + F1("pg_field_type", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING), + F1("pg_field_type_oid", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG | MAY_BE_STRING), + F0("pg_field_num", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG), + F1("pg_fetch_result", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING), + F1("pg_fetch_row", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_NULL | MAY_BE_ARRAY_OF_STRING), + F1("pg_fetch_assoc", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_NULL | MAY_BE_ARRAY_OF_STRING), + F1("pg_fetch_array", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_NULL | MAY_BE_ARRAY_OF_STRING), + F1("pg_fetch_object", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_OBJECT), + F1("pg_fetch_all", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_ARRAY), + F1("pg_fetch_all_columns", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_NULL | MAY_BE_ARRAY_OF_STRING), + F0("pg_result_seek", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE), + F0("pg_field_prtlen", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG), + F0("pg_field_is_null", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG), + F0("pg_free_result", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE), + F1("pg_last_oid", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG | MAY_BE_STRING), + F0("pg_trace", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE), + F0("pg_untrace", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE), + F1("pg_lo_create", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG | MAY_BE_STRING), + F0("pg_lo_unlink", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE), + F1("pg_lo_open", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_RESOURCE), + F1("pg_lo_read", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING), + F0("pg_lo_write", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG), + F0("pg_lo_read_all", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG), + F1("pg_lo_import", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG | MAY_BE_STRING), + F0("pg_lo_export", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE), + F0("pg_lo_seek", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE), + F0("pg_lo_tell", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG), + F0("pg_lo_truncate", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE), + F0("pg_set_error_verbosity", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG), + F0("pg_set_client_encoding", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG), + F0("pg_end_copy", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE), + F0("pg_put_line", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE), + F1("pg_copy_to", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING), + F0("pg_copy_from", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE), + F1("pg_escape_string", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING), + F1("pg_escape_bytea", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING), + F1("pg_unescape_bytea", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING), + F1("pg_escape_literal", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING), + F1("pg_escape_identifier", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING), + F1("pg_result_error", MAY_BE_FALSE | MAY_BE_STRING), + F1("pg_result_error_field", MAY_BE_FALSE | MAY_BE_STRING), + F0("pg_connection_status", MAY_BE_FALSE | MAY_BE_LONG), + F0("pg_transaction_status", MAY_BE_FALSE | MAY_BE_LONG), + F0("pg_connection_reset", MAY_BE_FALSE | MAY_BE_TRUE), + F0("pg_cancel_query", MAY_BE_FALSE | MAY_BE_TRUE), + F0("pg_connection_busy", MAY_BE_FALSE | MAY_BE_TRUE), + F0("pg_send_query", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE | MAY_BE_LONG), + F0("pg_send_query_params", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE | MAY_BE_LONG), + F0("pg_send_prepare", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE | MAY_BE_LONG), + F0("pg_send_execute", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE | MAY_BE_LONG), + F1("pg_get_result", MAY_BE_FALSE | MAY_BE_RESOURCE), + F1("pg_result_status", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG | MAY_BE_STRING), + F1("pg_get_notify", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_ANY), + F0("pg_get_pid", MAY_BE_FALSE | MAY_BE_LONG), + F1("pg_socket", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_RESOURCE), + F0("pg_consume_input", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE), + F0("pg_flush", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE | MAY_BE_LONG), + F1("pg_meta_data", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_ARRAY), + F1("pg_convert", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_ANY), + F1("pg_insert", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE | MAY_BE_RESOURCE | MAY_BE_STRING), + F1("pg_update", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE | MAY_BE_STRING), + F1("pg_delete", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE | MAY_BE_STRING), + F1("pg_select", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE | MAY_BE_STRING), + + /* ext/bcmath */ + F1("bcadd", MAY_BE_NULL | MAY_BE_STRING), + F1("bcsub", MAY_BE_NULL | MAY_BE_STRING), + F1("bcmul", MAY_BE_NULL | MAY_BE_STRING), + F1("bcdiv", MAY_BE_NULL | MAY_BE_STRING), + F1("bcmod", MAY_BE_NULL | MAY_BE_STRING), + F1("bcpowmod", MAY_BE_NULL | MAY_BE_STRING), + F1("bcpow", MAY_BE_NULL | MAY_BE_STRING), + F1("bcsqrt", MAY_BE_NULL | MAY_BE_STRING), + F0("bccomp", MAY_BE_NULL | MAY_BE_LONG), + F0("bcscale", MAY_BE_NULL | MAY_BE_TRUE), + + /* ext/exif */ + F1("exif_tagname", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING), + F1("exif_read_data", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_ANY), + F1("exif_thumbnail", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING), + F0("exif_imagetype", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG), + + /* ext/filter */ + F0("filter_has_var", MAY_BE_FALSE | MAY_BE_TRUE), + FN("filter_input", UNKNOWN_INFO), + FN("filter_var", UNKNOWN_INFO), + F1("filter_input_array", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_ANY), + F1("filter_var_array", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_ANY), + I1("filter_list", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING), + F0("filter_id", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG), + + /* ext/gettext */ + F1("textdomain", MAY_BE_NULL | MAY_BE_STRING), + F1("gettext", MAY_BE_NULL | MAY_BE_STRING), + F1("_", MAY_BE_NULL | MAY_BE_STRING), + F1("dgettext", MAY_BE_NULL | MAY_BE_STRING), + F1("dcgettext", MAY_BE_NULL | MAY_BE_STRING), + F1("bindtextdomain", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING), +#if HAVE_NGETTEXT + F1("ngettext", MAY_BE_NULL | MAY_BE_STRING), +#endif +#if HAVE_DNGETTEXT + F1("dcngettext", MAY_BE_NULL | MAY_BE_STRING), +#endif +#if HAVE_BIND_TEXTDOMAIN_CODESET + F1("bind_textdomain_codeset", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING), +#endif + + /* ext/ctype */ + F0("ctype_alnum", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE), + F0("ctype_alpha", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE), + F0("ctype_cntrl", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE), + F0("ctype_digit", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE), + F0("ctype_lower", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE), + F0("ctype_graph", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE), + F0("ctype_print", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE), + F0("ctype_punct", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE), + F0("ctype_space", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE), + F0("ctype_upper", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE), + F0("ctype_xdigit", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE), + + /* ext/fileinfo */ + F1("finfo_open", MAY_BE_FALSE | MAY_BE_RESOURCE), + F0("finfo_close", MAY_BE_FALSE | MAY_BE_TRUE), + F0("finfo_set_flags", MAY_BE_FALSE | MAY_BE_TRUE), + F1("finfo_file", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING), + F1("finfo_buffer", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING), + F1("mime_content_type", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING), + + /* ext/gd */ + F1("gd_info", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_STRING | MAY_BE_ARRAY_OF_FALSE | MAY_BE_ARRAY_OF_TRUE), + F0("imageloadfont", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG), + F0("imagesetstyle", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE), + F1("imagecreatetruecolor", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_RESOURCE), + F0("imageistruecolor", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE), + F0("imagetruecolortopalette", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE), + F0("imagepalettetotruecolor", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE), + F0("imagecolormatch", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE), + F0("imagesetthickness", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE), + F0("imagefilledellipse", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE), + F0("imagefilledarc", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE), + F0("imagealphablending", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE), + F0("imagesavealpha", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE), + F0("imagelayereffect", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE), + F0("imagecolorallocatealpha", MAY_BE_FALSE | MAY_BE_LONG), + F0("imagecolorresolvealpha", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG), + F0("imagecolorclosestalpha", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG), + F0("imagecolorexactalpha", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG), + F0("imagecopyresampled", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE), +#ifdef PHP_WIN32 + F1("imagegrabwindow", MAY_BE_FALSE | MAY_BE_RESOURCE), + F1("imagegrabscreen", MAY_BE_FALSE | MAY_BE_RESOURCE), +#endif + F1("imagerotate", MAY_BE_FALSE | MAY_BE_RESOURCE), + F0("imagesettile", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE), + F0("imagesetbrush", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE), + F1("imagecreate", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_RESOURCE), + I0("imagetypes", MAY_BE_LONG), + F1("imagecreatefromstring", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_RESOURCE), + F1("imagecreatefromgif", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_RESOURCE), +#ifdef HAVE_GD_JPG + F1("imagecreatefromjpeg", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_RESOURCE), + F0("imagejpeg", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE), + F0("jpeg2wbmp", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE), +#endif +#ifdef HAVE_GD_PNG + F1("imagecreatefrompng", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_RESOURCE), + F0("imagepng", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE), + F0("png2wbmp", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE), +#endif +#ifdef HAVE_GD_WEBP + F1("imagecreatefromwebp", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_RESOURCE), + F0("imagewebp", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE), +#endif + F1("imagecreatefromxbm", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_RESOURCE), +#if defined(HAVE_GD_XPM) + F1("imagecreatefromxpm", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_RESOURCE), +#endif + F1("imagecreatefromwbmp", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_RESOURCE), + F1("imagecreatefromgd", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_RESOURCE), + F1("imagecreatefromgd2", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_RESOURCE), + F1("imagecreatefromgd2part", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_RESOURCE), +#if defined(HAVE_GD_BMP) + F1("imagecreatefrombmp", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_RESOURCE), + F0("imagebmp", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE), +#endif + F0("imagexbm", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE), + F0("imagegif", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE), + F0("imagewbmp", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE), + F0("imagegd", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE), + F0("imagegd2", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE), + F0("imagedestroy", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE), + F0("magecolorallocate", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG), + F0("imagepalettecopy", MAY_BE_NULL | MAY_BE_FALSE), + F0("imagecolorat", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG), + F0("imagecolorclosest", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG), + F0("imagecolorclosesthwb", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG), + F0("imagecolordeallocate", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE), + F0("imagecolorresolve", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG), + F0("imagecolorexact", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG), + F0("imagecolorset", MAY_BE_NULL | MAY_BE_FALSE), + F1("imagecolorsforindex", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_LONG), + F0("imagegammacorrect", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE), + F0("imagesetpixel", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE), + F0("imageline", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE), + F0("imagedashedline", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE), + F0("imagerectangle", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE), + F0("imagefilledrectangle", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE), + F0("imagearc", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE), + F0("imageellipse", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE), + F0("imagefilltoborder", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE), + F0("imagefill", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE), + F0("imagecolorstotal", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG), + F0("imagecolortransparent", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG), + F0("imageinterlace", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG), + F0("imagepolygon", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE), + F0("imageopenpolygon", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE), + F0("imagefilledpolygon", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE), + F0("imagefontwidth", MAY_BE_NULL | MAY_BE_LONG), + F0("imagefontheight", MAY_BE_NULL | MAY_BE_LONG), + F0("imagechar", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE), + F0("imagecharup", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE), + F0("imagestring", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE), + F0("imagestringup", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE), + F0("imagecopy", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE), + F0("imagecopymerge", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE), + F0("imagecopymergegray", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE), + F0("imagecopyresized", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE), + F0("imagesx", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG), + F0("imagesy", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG), + F0("imagesetclip", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE), + F1("imagegetclip", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_LONG), + F1("imageftbbox", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_LONG), + F1("imagefttext", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_LONG), + F1("imagettfbbox", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_LONG), + F1("imagettftext", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_LONG), + F0("image2wbmp", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE), + F0("imagefilter", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE), + F0("imageconvolution", MAY_BE_FALSE | MAY_BE_TRUE), + F0("imageflip", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE), + F0("imageantialias", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE), + F1("imagecrop", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_RESOURCE), + F1("imagecropauto", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_RESOURCE), + F1("imagescale", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_RESOURCE), + F1("imageaffine", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_RESOURCE), + F1("imageaffinematrixget", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_DOUBLE), + F1("imageaffinematrixconcat", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_DOUBLE), + F0("imagesetinterpolation", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE), + F1("imageresolution", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_LONG), + }; static HashTable func_info; @@ -1218,6 +1698,14 @@ uint32_t zend_get_func_info(const zend_call_info *call_info, const zend_ssa *ssa ret = MAY_BE_NULL; } else if (info->info_func) { ret = info->info_func(call_info, ssa); + } else if (/*call_info->callee_func->common.arg_info && */ + call_info->callee_func->common.num_args == 0 && + call_info->callee_func->common.required_num_args == 0) { + if (call_info->num_args == 0) { + ret = info->info; + } else { + ret = FUNC_MAY_WARN | MAY_BE_NULL; + } } else { ret = info->info; } diff --git a/ext/opcache/Optimizer/zend_inference.c b/ext/opcache/Optimizer/zend_inference.c index e108b7a4dd8f3..3ee336481da6f 100644 --- a/ext/opcache/Optimizer/zend_inference.c +++ b/ext/opcache/Optimizer/zend_inference.c @@ -2565,6 +2565,28 @@ static int zend_update_type_info(const zend_op_array *op_array, UPDATE_SSA_TYPE(tmp, ssa_ops[i].op1_def); } break; + case ZEND_PRE_INC_OBJ: + case ZEND_PRE_DEC_OBJ: + case ZEND_POST_INC_OBJ: + case ZEND_POST_DEC_OBJ: + if (opline->op1_type == IS_CV) { + tmp = t1; + if (t1 & (MAY_BE_UNDEF|MAY_BE_NULL|MAY_BE_FALSE)) { + tmp &= ~(MAY_BE_UNDEF|MAY_BE_NULL|MAY_BE_FALSE); + tmp |= MAY_BE_OBJECT | MAY_BE_RC1 | MAY_BE_RCN; + } + if (tmp & MAY_BE_OBJECT) { + tmp |= MAY_BE_RC1 | MAY_BE_RCN; + } + UPDATE_SSA_TYPE(tmp, ssa_ops[i].op1_def); + COPY_SSA_OBJ_TYPE(ssa_ops[i].op1_use, ssa_ops[i].op1_def); + } + if (ssa_ops[i].result_def >= 0) { + // TODO: ??? + tmp = MAY_BE_RC1 | MAY_BE_RCN | MAY_BE_ANY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_ANY | MAY_BE_ARRAY_OF_REF; + UPDATE_SSA_TYPE(tmp, ssa_ops[i].result_def); + } + break; case ZEND_ASSIGN: if (opline->op2_type == IS_CV && ssa_ops[i].op2_def >= 0) { tmp = t2; @@ -4044,6 +4066,8 @@ int zend_may_throw(const zend_op *opline, zend_op_array *op_array, zend_ssa *ssa case ZEND_SWITCH_STRING: case ZEND_ISSET_ISEMPTY_VAR: case ZEND_ISSET_ISEMPTY_CV: + case ZEND_FUNC_NUM_ARGS: + case ZEND_FUNC_GET_ARGS: return 0; case ZEND_INIT_FCALL: /* can't throw, because call is resolved at compile time */ @@ -4180,8 +4204,50 @@ int zend_may_throw(const zend_op *opline, zend_op_array *op_array, zend_ssa *ssa case ZEND_UNSET_VAR: return (t1 & (MAY_BE_OBJECT|MAY_BE_RESOURCE|MAY_BE_ARRAY_OF_OBJECT|MAY_BE_ARRAY_OF_RESOURCE|MAY_BE_ARRAY_OF_ARRAY)); case ZEND_ASSIGN_DIM: + if ((opline+1)->op1_type == IS_CV) { + if (_ssa_op1_info(op_array, ssa, opline+1) & MAY_BE_UNDEF) { + return 1; + } + } return (t1 & (MAY_BE_OBJECT|MAY_BE_RESOURCE|MAY_BE_TRUE|MAY_BE_STRING|MAY_BE_LONG|MAY_BE_DOUBLE)) || opline->op2_type == IS_UNUSED || (t2 & (MAY_BE_UNDEF|MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE)); + case ZEND_ASSIGN_OBJ: + if (t1 & (MAY_BE_ANY-(MAY_BE_NULL|MAY_BE_FALSE|MAY_BE_OBJECT))) { + return 1; + } + if (ssa->ops[opline - op_array->opcodes].op1_use) { + zend_ssa_var_info *var_info = ssa->var_info + ssa->ops[opline - op_array->opcodes].op1_use; + zend_class_entry *ce = var_info->ce; + + if (var_info->is_instanceof || + !ce || ce->create_object || ce->__get || ce->__set || + (ce->ce_flags & ZEND_ACC_INHERITED)) { + return 1; + } + + if (op_array->scope != ce && ce->default_properties_count) { + zend_property_info *prop_info; + + if (opline->op2_type == IS_CONST) { + prop_info = zend_hash_find_ptr(&ce->properties_info, + Z_STR_P(CRT_CONSTANT_EX(op_array, opline->op2, ssa->rt_constants))); + if (prop_info && !(prop_info->flags & ZEND_ACC_PUBLIC)) { + return 1; + } + } else { + if (t2 & (MAY_BE_ANY-MAY_BE_STRING)) { + return 1; + } + ZEND_HASH_FOREACH_PTR(&ce->properties_info, prop_info) { + if (!(prop_info->flags & ZEND_ACC_PUBLIC)) { + return 1; + } + } ZEND_HASH_FOREACH_END(); + } + } + return 0; + } + return 1; case ZEND_ROPE_INIT: case ZEND_ROPE_ADD: case ZEND_ROPE_END: diff --git a/ext/opcache/Optimizer/zend_optimizer.h b/ext/opcache/Optimizer/zend_optimizer.h index 93354448ef58b..b471274fe6798 100644 --- a/ext/opcache/Optimizer/zend_optimizer.h +++ b/ext/opcache/Optimizer/zend_optimizer.h @@ -77,6 +77,7 @@ #define ZEND_DUMP_DFA_PHI (1<<26) #define ZEND_DUMP_DFA_SSA (1<<27) #define ZEND_DUMP_DFA_SSA_VARS (1<<28) +#define ZEND_DUMP_SCCP (1<<29) typedef struct _zend_script { zend_string *filename; diff --git a/ext/opcache/Optimizer/zend_optimizer_internal.h b/ext/opcache/Optimizer/zend_optimizer_internal.h index aa37456b2bf5c..1ab0fb5c04097 100644 --- a/ext/opcache/Optimizer/zend_optimizer_internal.h +++ b/ext/opcache/Optimizer/zend_optimizer_internal.h @@ -114,5 +114,6 @@ void zend_optimizer_shift_jump(zend_op_array *op_array, zend_op *opline, uint32_ zend_uchar zend_compound_assign_to_binary_op(zend_uchar opcode); int sccp_optimize_op_array(zend_optimizer_ctx *ctx, zend_op_array *op_arrya, zend_ssa *ssa, zend_call_info **call_map); int dce_optimize_op_array(zend_op_array *op_array, zend_ssa *ssa, zend_bool reorder_dtor_effects); +int zend_ssa_escape_analysis(const zend_script *script, zend_op_array *op_array, zend_ssa *ssa); #endif diff --git a/ext/opcache/Optimizer/zend_ssa.c b/ext/opcache/Optimizer/zend_ssa.c index 422813f0e806d..182c2a2b77134 100644 --- a/ext/opcache/Optimizer/zend_ssa.c +++ b/ext/opcache/Optimizer/zend_ssa.c @@ -644,6 +644,17 @@ static int zend_ssa_rename(const zend_op_array *op_array, uint32_t build_flags, //NEW_SSA_VAR(next->op1.var) } break; + case ZEND_PRE_INC_OBJ: + case ZEND_PRE_DEC_OBJ: + case ZEND_POST_INC_OBJ: + case ZEND_POST_DEC_OBJ: + if (opline->op1_type == IS_CV) { + ssa_ops[k].op1_def = ssa_vars_count; + var[EX_VAR_TO_NUM(opline->op1.var)] = ssa_vars_count; + ssa_vars_count++; + //NEW_SSA_VAR(opline->op1.var) + } + break; case ZEND_ADD_ARRAY_ELEMENT: ssa_ops[k].result_use = var[EX_VAR_TO_NUM(opline->result.var)]; case ZEND_INIT_ARRAY: diff --git a/ext/opcache/Optimizer/zend_ssa.h b/ext/opcache/Optimizer/zend_ssa.h index 61c4e38c6be86..97be2b93b0b29 100644 --- a/ext/opcache/Optimizer/zend_ssa.h +++ b/ext/opcache/Optimizer/zend_ssa.h @@ -99,6 +99,13 @@ typedef enum _zend_ssa_alias_kind { HTTP_RESPONSE_HEADER_ALIAS } zend_ssa_alias_kind; +typedef enum _zend_ssa_escape_state { + ESCAPE_STATE_UNKNOWN, + ESCAPE_STATE_NO_ESCAPE, + ESCAPE_STATE_FUNCTION_ESCAPE, + ESCAPE_STATE_GLOBAL_ESCAPE +} zend_ssa_escape_state; + typedef struct _zend_ssa_var { int var; /* original var number; op.var for CVs and following numbers for VARs and TMP_VARs */ int scc; /* strongly connected component */ @@ -110,6 +117,7 @@ typedef struct _zend_ssa_var { unsigned int no_val : 1; /* value doesn't mater (used as op1 in ZEND_ASSIGN) */ unsigned int scc_entry : 1; unsigned int alias : 2; /* value may be changed indirectly */ + unsigned int escape_state : 2; } zend_ssa_var; typedef struct _zend_ssa_var_info { diff --git a/ext/opcache/ZendAccelerator.c b/ext/opcache/ZendAccelerator.c index 32db2ca9e9405..a407c88281e62 100644 --- a/ext/opcache/ZendAccelerator.c +++ b/ext/opcache/ZendAccelerator.c @@ -114,7 +114,7 @@ zend_bool fallback_process = 0; /* process uses file cache fallback */ static zend_op_array *(*accelerator_orig_compile_file)(zend_file_handle *file_handle, int type); static int (*accelerator_orig_zend_stream_open_function)(const char *filename, zend_file_handle *handle ); -static zend_string *(*accelerator_orig_zend_resolve_path)(const char *filename, int filename_len); +static zend_string *(*accelerator_orig_zend_resolve_path)(const char *filename, size_t filename_len); static zif_handler orig_chdir = NULL; static ZEND_INI_MH((*orig_include_path_on_modify)) = NULL; @@ -1015,7 +1015,7 @@ int validate_timestamp_and_record_ex(zend_persistent_script *persistent_script, /* Instead of resolving full real path name each time we need to identify file, * we create a key that consist from requested file name, current working * directory, current include_path, etc */ -char *accel_make_persistent_key(const char *path, int path_length, int *key_len) +char *accel_make_persistent_key(const char *path, size_t path_length, int *key_len) { int key_length; @@ -1171,7 +1171,7 @@ char *accel_make_persistent_key(const char *path, int path_length, int *key_len) return (char*)path; } -int zend_accel_invalidate(const char *filename, int filename_len, zend_bool force) +int zend_accel_invalidate(const char *filename, size_t filename_len, zend_bool force) { zend_string *realpath; zend_persistent_script *persistent_script; @@ -2018,7 +2018,7 @@ static int persistent_stream_open_function(const char *filename, zend_file_handl } /* zend_resolve_path() replacement for PHP 5.3 and above */ -static zend_string* persistent_zend_resolve_path(const char *filename, int filename_len) +static zend_string* persistent_zend_resolve_path(const char *filename, size_t filename_len) { if (ZCG(enabled) && accel_startup_ok && (ZCG(counted) || ZCSG(accelerator_enabled)) && @@ -2319,7 +2319,6 @@ static inline int accel_find_sapi(void) "cli-server", "cgi-fcgi", "fpm-fcgi", - "isapi", "apache2filter", "apache2handler", "litespeed", @@ -2598,7 +2597,7 @@ static int accel_startup(zend_extension *extension) strcmp(sapi_module.name, "cli") == 0) { zps_startup_failure("Opcode Caching is disabled for CLI", NULL, accelerator_remove_cb); } else { - zps_startup_failure("Opcode Caching is only supported in Apache, ISAPI, FPM, FastCGI and LiteSpeed SAPIs", NULL, accelerator_remove_cb); + zps_startup_failure("Opcode Caching is only supported in Apache, FPM, FastCGI and LiteSpeed SAPIs", NULL, accelerator_remove_cb); } return SUCCESS; } diff --git a/ext/opcache/ZendAccelerator.h b/ext/opcache/ZendAccelerator.h index 17b6f8da521f5..5c22415d88662 100644 --- a/ext/opcache/ZendAccelerator.h +++ b/ext/opcache/ZendAccelerator.h @@ -310,11 +310,11 @@ void zend_accel_schedule_restart_if_necessary(zend_accel_restart_reason reason); accel_time_t zend_get_file_handle_timestamp(zend_file_handle *file_handle, size_t *size); int validate_timestamp_and_record(zend_persistent_script *persistent_script, zend_file_handle *file_handle); int validate_timestamp_and_record_ex(zend_persistent_script *persistent_script, zend_file_handle *file_handle); -int zend_accel_invalidate(const char *filename, int filename_len, zend_bool force); +int zend_accel_invalidate(const char *filename, size_t filename_len, zend_bool force); int accelerator_shm_read_lock(void); void accelerator_shm_read_unlock(void); -char *accel_make_persistent_key(const char *path, int path_length, int *key_len); +char *accel_make_persistent_key(const char *path, size_t path_length, int *key_len); zend_op_array *persistent_compile_file(zend_file_handle *file_handle, int type); #define IS_ACCEL_INTERNED(str) \ diff --git a/ext/opcache/config.m4 b/ext/opcache/config.m4 index 7b500f023d69a..8098f3d885fe5 100644 --- a/ext/opcache/config.m4 +++ b/ext/opcache/config.m4 @@ -413,6 +413,7 @@ fi Optimizer/sccp.c \ Optimizer/scdf.c \ Optimizer/dce.c \ + Optimizer/escape_analysis.c \ Optimizer/compact_vars.c \ Optimizer/zend_dump.c, shared,,-DZEND_ENABLE_STATIC_TSRMLS_CACHE=1,,yes) diff --git a/ext/opcache/config.w32 b/ext/opcache/config.w32 index f32834e878a1a..8a33fd906c6a6 100644 --- a/ext/opcache/config.w32 +++ b/ext/opcache/config.w32 @@ -23,7 +23,7 @@ if (PHP_OPCACHE != "no") { zend_shared_alloc.c \ shared_alloc_win32.c", true, "/DZEND_ENABLE_STATIC_TSRMLS_CACHE=1"); - ADD_SOURCES(configure_module_dirname + "/Optimizer", "zend_optimizer.c pass1_5.c pass2.c pass3.c optimize_func_calls.c block_pass.c optimize_temp_vars_5.c nop_removal.c compact_literals.c zend_cfg.c zend_dfg.c dfa_pass.c zend_ssa.c zend_inference.c zend_func_info.c zend_call_graph.c sccp.c scdf.c dce.c compact_vars.c zend_dump.c", "opcache", "OptimizerObj"); + ADD_SOURCES(configure_module_dirname + "/Optimizer", "zend_optimizer.c pass1_5.c pass2.c pass3.c optimize_func_calls.c block_pass.c optimize_temp_vars_5.c nop_removal.c compact_literals.c zend_cfg.c zend_dfg.c dfa_pass.c zend_ssa.c zend_inference.c zend_func_info.c zend_call_graph.c sccp.c scdf.c dce.c escape_analysis.c compact_vars.c zend_dump.c", "opcache", "OptimizerObj"); ADD_FLAG('CFLAGS_OPCACHE', "/I " + configure_module_dirname); diff --git a/ext/opcache/tests/jmp_elim_002.phpt b/ext/opcache/tests/jmp_elim_002.phpt new file mode 100644 index 0000000000000..e396ca0a9dd5e --- /dev/null +++ b/ext/opcache/tests/jmp_elim_002.phpt @@ -0,0 +1,38 @@ +--TEST-- +Incorrect empty basic block elimination +--SKIPIF-- + +--FILE-- + 'monthly', 'limit' => '', + 'format' => 'html', 'before' => '', + 'after' => '', 'show_post_count' => false, + 'echo' => 1, 'order' => 'DESC', + ); + + $r = wp_parse_args( $args, $defaults ); + + if ( ! empty( $r['limit'] ) ) { + $r['limit'] = absint( $r['limit'] ); + $r['limit'] = ' LIMIT ' . $r['limit']; + } + + $archive_date_format_over_ride = 0; + $archive_day_date_format = 'Y/m/d'; + + if (!$archive_date_format_over_ride ) { + $archive_day_date_format = get_option( 'date_format' ); + } + + if ( $r['echo'] ) { + echo $output; + } else { + return $output; + } +} +?> +OK +--EXPECT-- +OK diff --git a/ext/opcache/tests/jmp_elim_003.phpt b/ext/opcache/tests/jmp_elim_003.phpt new file mode 100644 index 0000000000000..55be9632bab40 --- /dev/null +++ b/ext/opcache/tests/jmp_elim_003.phpt @@ -0,0 +1,27 @@ +--TEST-- +Incorrect empty basic block elimination +--SKIPIF-- + +--FILE-- + +OK +--EXPECT-- +OK diff --git a/ext/opcache/tests/opt/dce_001.phpt b/ext/opcache/tests/opt/dce_001.phpt new file mode 100644 index 0000000000000..e41afdafa16e3 --- /dev/null +++ b/ext/opcache/tests/opt/dce_001.phpt @@ -0,0 +1,31 @@ +--TEST-- +DCE 001: Remove dead computation after constants propagation +--INI-- +opcache.enable=1 +opcache.enable_cli=1 +opcache.optimization_level=-1 +opcache.opt_debug_level=0x20000 +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +$_main: ; (lines=1, args=0, vars=0, tmps=0) + ; (after optimizer) + ; %sdce_001.php:1-8 +L0: RETURN int(1) + +foo: ; (lines=5, args=4, vars=4, tmps=0) + ; (after optimizer) + ; %sdce_001.php:2-6 +L0: CV0($s1) = RECV 1 +L1: CV1($s2) = RECV 2 +L2: CV2($s3) = RECV 3 +L3: CV3($s4) = RECV 4 +L4: RETURN int(0) diff --git a/ext/opcache/tests/opt/dce_002.phpt b/ext/opcache/tests/opt/dce_002.phpt new file mode 100644 index 0000000000000..6cb50a3f0baad --- /dev/null +++ b/ext/opcache/tests/opt/dce_002.phpt @@ -0,0 +1,34 @@ +--TEST-- +DCE 002: func_get_args() disables deletion of assignments to parameter variables +--INI-- +opcache.enable=1 +opcache.enable_cli=1 +opcache.optimization_level=-1 +opcache.opt_debug_level=0x20000 +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +$_main: ; (lines=1, args=0, vars=0, tmps=0) + ; (after optimizer) + ; %sdce_002.php:1-11 +L0: RETURN int(1) + +foo: ; (lines=5, args=1, vars=2, tmps=0) + ; (after optimizer) + ; %sdce_002.php:2-9 +L0: CV0($a) = RECV 1 +L1: CV0($a) = QM_ASSIGN int(10) +L2: CV1($x) = FUNC_GET_ARGS +L3: CV0($a) = QM_ASSIGN int(30) +L4: RETURN CV1($x) diff --git a/ext/opcache/tests/opt/dce_003.phpt b/ext/opcache/tests/opt/dce_003.phpt new file mode 100644 index 0000000000000..651a8fea48191 --- /dev/null +++ b/ext/opcache/tests/opt/dce_003.phpt @@ -0,0 +1,28 @@ +--TEST-- +DCE 003: Assignment elimination (without FREE) +--INI-- +opcache.enable=1 +opcache.enable_cli=1 +opcache.optimization_level=-1 +opcache.opt_debug_level=0x20000 +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +$_main: ; (lines=1, args=0, vars=0, tmps=0) + ; (after optimizer) + ; %sdce_003.php:1-7 +L0: RETURN int(1) + +foo: ; (lines=3, args=1, vars=1, tmps=0) + ; (after optimizer) + ; %sdce_003.php:2-5 +L0: CV0($a) = RECV 1 +L1: ASSIGN_ADD CV0($a) int(3) +L2: RETURN CV0($a) diff --git a/ext/opcache/tests/opt/dce_004.phpt b/ext/opcache/tests/opt/dce_004.phpt new file mode 100644 index 0000000000000..3038028294ba0 --- /dev/null +++ b/ext/opcache/tests/opt/dce_004.phpt @@ -0,0 +1,30 @@ +--TEST-- +DCE 004: Elimination of assignment to non-escaping arrays +--INI-- +opcache.enable=1 +opcache.enable_cli=1 +opcache.optimization_level=-1 +opcache.opt_debug_level=0x20000 +--SKIPIF-- + +--FILE-- + +--FILE-- +foo = $x; +} +--EXPECTF-- +$_main: ; (lines=1, args=0, vars=0, tmps=0) + ; (after optimizer) + ; %sdce_005.php:1-8 +L0: RETURN int(1) + +foo: ; (lines=2, args=1, vars=1, tmps=0) + ; (after optimizer) + ; %sdce_005.php:4-7 +L0: CV0($x) = RECV 1 +L1: RETURN null diff --git a/ext/opcache/tests/opt/dce_006.phpt b/ext/opcache/tests/opt/dce_006.phpt new file mode 100644 index 0000000000000..a45a15e41b09f --- /dev/null +++ b/ext/opcache/tests/opt/dce_006.phpt @@ -0,0 +1,39 @@ +--TEST-- +DCE 006: Objects with destructors escape +--INI-- +opcache.enable=1 +opcache.enable_cli=1 +opcache.optimization_level=-1 +opcache.opt_debug_level=0x20000 +--SKIPIF-- + +--FILE-- +foo = $x; +} +--EXPECTF-- +$_main: ; (lines=1, args=0, vars=0, tmps=0) + ; (after optimizer) + ; %sdce_006.php:1-9 +L0: RETURN int(1) + +foo: ; (lines=7, args=1, vars=2, tmps=1) + ; (after optimizer) + ; %sdce_006.php:5-8 +L0: CV0($x) = RECV 1 +L1: V2 = NEW 0 string("A") +L2: DO_FCALL +L3: CV1($a) = QM_ASSIGN V2 +L4: ASSIGN_OBJ CV1($a) string("foo") +L5: OP_DATA CV0($x) +L6: RETURN null + +A::__destruct: ; (lines=1, args=0, vars=0, tmps=0) + ; (after optimizer) + ; %sdce_006.php:3-3 +L0: RETURN null diff --git a/ext/opcache/tests/opt/dce_007.phpt b/ext/opcache/tests/opt/dce_007.phpt new file mode 100644 index 0000000000000..4ec3da1f05572 --- /dev/null +++ b/ext/opcache/tests/opt/dce_007.phpt @@ -0,0 +1,28 @@ +--TEST-- +DCE 007: Escaping of enclosed arrays doesn't prevent removal of enclosing array +--INI-- +opcache.enable=1 +opcache.enable_cli=1 +opcache.optimization_level=-1 +opcache.opt_debug_level=0x20000 +--SKIPIF-- + +--FILE-- + +--FILE-- + +--FILE-- + +--EXPECTF-- +$_main: ; (lines=1, args=0, vars=0, tmps=0) + ; (after optimizer) + ; %ssccp_001.php:1-9 +L0: RETURN int(1) + +foo: ; (lines=1, args=0, vars=0, tmps=0) + ; (after optimizer) + ; %ssccp_001.php:2-7 +L0: RETURN int(4) diff --git a/ext/opcache/tests/opt/sccp_002.phpt b/ext/opcache/tests/opt/sccp_002.phpt new file mode 100644 index 0000000000000..960888e1fdad8 --- /dev/null +++ b/ext/opcache/tests/opt/sccp_002.phpt @@ -0,0 +1,36 @@ +--TEST-- +SCCP 002: Conditional Constant Propagation of non-escaping array elements +--INI-- +opcache.enable=1 +opcache.enable_cli=1 +opcache.optimization_level=-1 +opcache.opt_debug_level=0x20000 +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +$_main: ; (lines=1, args=0, vars=0, tmps=0) + ; (after optimizer) + ; %ssccp_002.php:1-14 +L0: RETURN int(1) + +foo: ; (lines=4, args=1, vars=1, tmps=0) + ; (after optimizer) + ; %ssccp_002.php:2-12 +L0: CV0($x) = RECV 1 +L1: ECHO int(1) +L2: ECHO int(1) +L3: RETURN null diff --git a/ext/opcache/tests/opt/sccp_003.phpt b/ext/opcache/tests/opt/sccp_003.phpt new file mode 100644 index 0000000000000..63e225b4be224 --- /dev/null +++ b/ext/opcache/tests/opt/sccp_003.phpt @@ -0,0 +1,35 @@ +--TEST-- +SCCP 003: Conditional Constant Propagation of non-escaping array elements +--INI-- +opcache.enable=1 +opcache.enable_cli=1 +opcache.optimization_level=-1 +opcache.opt_debug_level=0x20000 +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +$_main: ; (lines=1, args=0, vars=0, tmps=0) + ; (after optimizer) + ; %ssccp_003.php:1-14 +L0: RETURN int(1) + +foo: ; (lines=3, args=0, vars=0, tmps=0) + ; (after optimizer) + ; %ssccp_003.php:2-12 +L0: ECHO int(1) +L1: ECHO int(1) +L2: RETURN null diff --git a/ext/opcache/tests/opt/sccp_004.phpt b/ext/opcache/tests/opt/sccp_004.phpt new file mode 100644 index 0000000000000..e8a7593b65e66 --- /dev/null +++ b/ext/opcache/tests/opt/sccp_004.phpt @@ -0,0 +1,39 @@ +--TEST-- +SCCP 004: Conditional Constant Propagation of non-escaping array elements +--INI-- +opcache.enable=1 +opcache.enable_cli=1 +opcache.optimization_level=-1 +opcache.opt_debug_level=0x20000 +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +$_main: ; (lines=1, args=0, vars=0, tmps=0) + ; (after optimizer) + ; %ssccp_004.php:1-17 +L0: RETURN int(1) + +foo: ; (lines=4, args=1, vars=1, tmps=0) + ; (after optimizer) + ; %ssccp_004.php:2-15 +L0: CV0($x) = RECV 1 +L1: ECHO bool(true) +L2: ECHO int(1) +L3: RETURN null diff --git a/ext/opcache/tests/opt/sccp_005.phpt b/ext/opcache/tests/opt/sccp_005.phpt new file mode 100644 index 0000000000000..0ec6e04be54c0 --- /dev/null +++ b/ext/opcache/tests/opt/sccp_005.phpt @@ -0,0 +1,28 @@ +--TEST-- +SCCP 005: Conditional Constant Propagation of non-escaping array elements +--INI-- +opcache.enable=1 +opcache.enable_cli=1 +opcache.optimization_level=-1 +opcache.opt_debug_level=0x20000 +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +$_main: ; (lines=1, args=0, vars=0, tmps=0) + ; (after optimizer) + ; %ssccp_005.php:1-7 +L0: RETURN int(1) + +foo: ; (lines=3, args=1, vars=1, tmps=0) + ; (after optimizer) + ; %ssccp_005.php:2-5 +L0: CV0($x) = RECV 1 +L1: ECHO int(2) +L2: RETURN null diff --git a/ext/opcache/tests/opt/sccp_006.phpt b/ext/opcache/tests/opt/sccp_006.phpt new file mode 100644 index 0000000000000..bc3bac0b87969 --- /dev/null +++ b/ext/opcache/tests/opt/sccp_006.phpt @@ -0,0 +1,35 @@ +--TEST-- +SCCP 006: Conditional Constant Propagation of non-escaping array elements +--INI-- +opcache.enable=1 +opcache.enable_cli=1 +opcache.optimization_level=-1 +opcache.opt_debug_level=0x20000 +--SKIPIF-- + +--FILE-- +1,"a"=>2,"a"=>$x]; + echo $a["a"]; +} +?> +--EXPECTF-- +$_main: ; (lines=1, args=0, vars=0, tmps=0) + ; (after optimizer) + ; %ssccp_006.php:1-7 +L0: RETURN int(1) + +foo: ; (lines=8, args=1, vars=2, tmps=1) + ; (after optimizer) + ; %ssccp_006.php:2-5 +L0: CV0($x) = RECV 1 +L1: T2 = INIT_ARRAY 3 int(1) string("a") +L2: T2 = ADD_ARRAY_ELEMENT int(2) string("a") +L3: T2 = ADD_ARRAY_ELEMENT CV0($x) string("a") +L4: CV1($a) = QM_ASSIGN T2 +L5: V2 = FETCH_DIM_R CV1($a) string("a") +L6: ECHO V2 +L7: RETURN null +LIVE RANGES: + 2: L2 - L4 (tmp/var) diff --git a/ext/opcache/tests/opt/sccp_007.phpt b/ext/opcache/tests/opt/sccp_007.phpt new file mode 100644 index 0000000000000..515facfd6d0a5 --- /dev/null +++ b/ext/opcache/tests/opt/sccp_007.phpt @@ -0,0 +1,32 @@ +--TEST-- +SCCP 007: Conditional Constant Propagation of non-escaping array elements +--INI-- +opcache.enable=1 +opcache.enable_cli=1 +opcache.optimization_level=-1 +opcache.opt_debug_level=0x20000 +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +$_main: ; (lines=1, args=0, vars=0, tmps=0) + ; (after optimizer) + ; %ssccp_007.php:1-11 +L0: RETURN int(1) + +foo: ; (lines=3, args=1, vars=1, tmps=0) + ; (after optimizer) + ; %ssccp_007.php:2-9 +L0: CV0($x) = RECV 1 +L1: ECHO int(0) +L2: RETURN null diff --git a/ext/opcache/tests/opt/sccp_008.phpt b/ext/opcache/tests/opt/sccp_008.phpt new file mode 100644 index 0000000000000..d540ce4706c4a --- /dev/null +++ b/ext/opcache/tests/opt/sccp_008.phpt @@ -0,0 +1,37 @@ +--TEST-- +SCCP 008: Conditional Constant Propagation of non-escaping array elements +--INI-- +opcache.enable=1 +opcache.enable_cli=1 +opcache.optimization_level=-1 +opcache.opt_debug_level=0x20000 +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +$_main: ; (lines=1, args=0, vars=0, tmps=0) + ; (after optimizer) + ; %ssccp_008.php:1-11 +L0: RETURN int(1) + +foo: ; (lines=8, args=1, vars=2, tmps=1) + ; (after optimizer) + ; %ssccp_008.php:2-9 +L0: CV0($x) = RECV 1 +L1: JMPZ CV0($x) L4 +L2: CV1($a) = QM_ASSIGN array(...) +L3: JMP L5 +L4: CV1($a) = QM_ASSIGN array(...) +L5: V2 = FETCH_DIM_R CV1($a) int(1) +L6: ECHO V2 +L7: RETURN null diff --git a/ext/opcache/tests/opt/sccp_009.phpt b/ext/opcache/tests/opt/sccp_009.phpt new file mode 100644 index 0000000000000..78efe4581516a --- /dev/null +++ b/ext/opcache/tests/opt/sccp_009.phpt @@ -0,0 +1,29 @@ +--TEST-- +SCCP 009: Conditional Constant Propagation of non-escaping array elements +--INI-- +opcache.enable=1 +opcache.enable_cli=1 +opcache.optimization_level=-1 +opcache.opt_debug_level=0x20000 +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +$_main: ; (lines=1, args=0, vars=0, tmps=0) + ; (after optimizer) + ; %ssccp_009.php:1-8 +L0: RETURN int(1) + +foo: ; (lines=3, args=1, vars=1, tmps=0) + ; (after optimizer) + ; %ssccp_009.php:2-6 +L0: CV0($x) = RECV 1 +L1: ECHO int(2) +L2: RETURN null diff --git a/ext/opcache/tests/opt/sccp_010.phpt b/ext/opcache/tests/opt/sccp_010.phpt new file mode 100644 index 0000000000000..7e91107f41dda --- /dev/null +++ b/ext/opcache/tests/opt/sccp_010.phpt @@ -0,0 +1,36 @@ +--TEST-- +SCCP 010: Conditional Constant Propagation of non-escaping object properties +--INI-- +opcache.enable=1 +opcache.enable_cli=1 +opcache.optimization_level=-1 +opcache.opt_debug_level=0x20000 +--SKIPIF-- + +--FILE-- +foo = 0; + $i = 1; + $c = $i < 2; + if ($c) { + $k = 2 * $i; + $o->foo = $i; + echo $o->foo; + } + echo $o->foo; +} +?> +--EXPECTF-- +$_main: ; (lines=1, args=0, vars=0, tmps=0) + ; (after optimizer) + ; %ssccp_010.php:1-15 +L0: RETURN int(1) + +foo: ; (lines=3, args=0, vars=0, tmps=0) + ; (after optimizer) + ; %ssccp_010.php:2-13 +L0: ECHO int(1) +L1: ECHO int(1) +L2: RETURN null diff --git a/ext/opcache/tests/opt/sccp_011.phpt b/ext/opcache/tests/opt/sccp_011.phpt new file mode 100644 index 0000000000000..761a251b0de54 --- /dev/null +++ b/ext/opcache/tests/opt/sccp_011.phpt @@ -0,0 +1,35 @@ +--TEST-- +SCCP 011: Conditional Constant Propagation of non-escaping object properties +--INI-- +opcache.enable=1 +opcache.enable_cli=1 +opcache.optimization_level=-1 +opcache.opt_debug_level=0x20000 +--SKIPIF-- + +--FILE-- +foo = 0; + $o->bar = 1; + } else { + $o->foo = 0; + $o->bar = 2; + } + echo $o->foo; +} +?> +--EXPECTF-- +$_main: ; (lines=1, args=0, vars=0, tmps=0) + ; (after optimizer) + ; %ssccp_011.php:1-14 +L0: RETURN int(1) + +foo: ; (lines=3, args=1, vars=1, tmps=0) + ; (after optimizer) + ; %ssccp_011.php:2-12 +L0: CV0($x) = RECV 1 +L1: ECHO int(0) +L2: RETURN null diff --git a/ext/opcache/tests/opt/sccp_012.phpt b/ext/opcache/tests/opt/sccp_012.phpt new file mode 100644 index 0000000000000..fb4ee3d897cef --- /dev/null +++ b/ext/opcache/tests/opt/sccp_012.phpt @@ -0,0 +1,38 @@ +--TEST-- +SCCP 012: Conditional Constant Propagation of non-escaping object properties +--INI-- +opcache.enable=1 +opcache.enable_cli=1 +opcache.optimization_level=-1 +opcache.opt_debug_level=0x20000 +--SKIPIF-- + +--FILE-- +foo = 0; + $i = 1; + $c = $i < 2; + if ($c) { + $k = 2 * $i; + $o->foo = $i; + echo $o->foo; + } + $o->foo += 2; + $o->foo++; + echo $o->foo; +} +?> +--EXPECTF-- +$_main: ; (lines=1, args=0, vars=0, tmps=0) + ; (after optimizer) + ; %ssccp_012.php:1-17 +L0: RETURN int(1) + +foo: ; (lines=3, args=0, vars=0, tmps=0) + ; (after optimizer) + ; %ssccp_012.php:2-15 +L0: ECHO int(1) +L1: ECHO int(4) +L2: RETURN null diff --git a/ext/opcache/tests/opt/sccp_013.phpt b/ext/opcache/tests/opt/sccp_013.phpt new file mode 100644 index 0000000000000..d421743e18c0a --- /dev/null +++ b/ext/opcache/tests/opt/sccp_013.phpt @@ -0,0 +1,22 @@ +--TEST-- +SCCP 013: Conditional Constant Propagation of non-escaping array elements on PHI +--INI-- +opcache.enable=1 +opcache.enable_cli=1 +opcache.optimization_level=-1 +--SKIPIF-- + +--FILE-- + +--EXPECT-- +bool(true) diff --git a/ext/opcache/tests/opt/sccp_014.phpt b/ext/opcache/tests/opt/sccp_014.phpt new file mode 100644 index 0000000000000..76592ea444905 --- /dev/null +++ b/ext/opcache/tests/opt/sccp_014.phpt @@ -0,0 +1,23 @@ +--TEST-- +SCCP 014: Conditional Constant Propagation of non-escaping object properties on PHI +--INI-- +opcache.enable=1 +opcache.enable_cli=1 +opcache.optimization_level=-1 +--SKIPIF-- + +--FILE-- +a = 1; + foreach ($entity_information as $info) { + $entity_types->a = 0; + } + var_dump((bool)($entity_types->a)); +} + +loadEntities(array("first", "second")); +?> +--EXPECT-- +bool(false) diff --git a/ext/opcache/tests/opt/sccp_015.phpt b/ext/opcache/tests/opt/sccp_015.phpt new file mode 100644 index 0000000000000..3e229fef0094c --- /dev/null +++ b/ext/opcache/tests/opt/sccp_015.phpt @@ -0,0 +1,26 @@ +--TEST-- +SCCP 015: Conditional Constant Propagation of non-escaping object properties on PHI and Rewinding +--INI-- +opcache.enable=1 +opcache.enable_cli=1 +opcache.optimization_level=-1 +--SKIPIF-- + +--FILE-- +b = 0; + foreach ($entity_information as $ex) { + var_dump((bool)$entity_types->b); + foreach ($entity_information as $info) { + $entity_types->b = 1; + } + } +} + +loadEntities(array("first", "second")); +?> +--EXPECT-- +bool(false) +bool(true) diff --git a/ext/opcache/tests/opt/sccp_016.phpt b/ext/opcache/tests/opt/sccp_016.phpt new file mode 100644 index 0000000000000..d877e57a719f9 --- /dev/null +++ b/ext/opcache/tests/opt/sccp_016.phpt @@ -0,0 +1,21 @@ +--TEST-- +SCCP 016: Used constant instructions should be replaced with QM_ASSIGN +--INI-- +opcache.enable=1 +opcache.enable_cli=1 +opcache.optimization_level=-1 +opcache.opt_debug_level=0x20000 +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +$_main: ; (lines=4, args=0, vars=1, tmps=1) + ; (after optimizer) + ; %ssccp_016.php:1-4 +L0: T1 = ISSET_ISEMPTY_CV (isset) CV0($undef) +L1: T1 = JMPNZ_EX T1 L3 +L2: T1 = QM_ASSIGN bool(true) +L3: RETURN T1 diff --git a/ext/opcache/tests/opt/sccp_017.phpt b/ext/opcache/tests/opt/sccp_017.phpt new file mode 100644 index 0000000000000..a8cbcae7230e8 --- /dev/null +++ b/ext/opcache/tests/opt/sccp_017.phpt @@ -0,0 +1,30 @@ +--TEST-- +SCCP 017: Array assignemnt +--INI-- +opcache.enable=1 +opcache.enable_cli=1 +opcache.optimization_level=-1 +opcache.opt_debug_level=0x20000 +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +$_main: ; (lines=1, args=0, vars=0, tmps=0) + ; (after optimizer) + ; %ssccp_017.php:1-10 +L0: RETURN int(1) + +foo: ; (lines=2, args=1, vars=1, tmps=0) + ; (after optimizer) + ; %ssccp_017.php:2-8 +L0: CV0($x) = RECV 1 +L1: RETURN int(5) diff --git a/ext/opcache/tests/opt/sccp_018.phpt b/ext/opcache/tests/opt/sccp_018.phpt new file mode 100644 index 0000000000000..66a4b6ca1501b --- /dev/null +++ b/ext/opcache/tests/opt/sccp_018.phpt @@ -0,0 +1,23 @@ +--TEST-- +SCCP 018: Object assignemnt +--INI-- +opcache.enable=1 +opcache.enable_cli=1 +opcache.optimization_level=-1 +;opcache.opt_debug_level=0x20000 +--SKIPIF-- + +--FILE-- +x = 5; + $b->x = 42; + echo $a->x; + echo "\n"; +} +foo(); +?> +--EXPECT-- +42 diff --git a/ext/opcache/tests/opt/sccp_019.phpt b/ext/opcache/tests/opt/sccp_019.phpt new file mode 100644 index 0000000000000..80d4123411ef0 --- /dev/null +++ b/ext/opcache/tests/opt/sccp_019.phpt @@ -0,0 +1,29 @@ +--TEST-- +SCCP 019: Array assignemnt +--INI-- +opcache.enable=1 +opcache.enable_cli=1 +opcache.optimization_level=-1 +opcache.opt_debug_level=0x20000 +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +$_main: ; (lines=1, args=0, vars=0, tmps=0) + ; (after optimizer) + ; %ssccp_019.php:1-9 +L0: RETURN int(1) + +foo: ; (lines=2, args=1, vars=1, tmps=0) + ; (after optimizer) + ; %ssccp_019.php:2-7 +L0: CV0($x) = RECV 1 +L1: RETURN int(5) diff --git a/ext/opcache/tests/opt/sccp_020.phpt b/ext/opcache/tests/opt/sccp_020.phpt new file mode 100644 index 0000000000000..41c694a591183 --- /dev/null +++ b/ext/opcache/tests/opt/sccp_020.phpt @@ -0,0 +1,22 @@ +--TEST-- +SCCP 020: Object assignemnt +--INI-- +opcache.enable=1 +opcache.enable_cli=1 +opcache.optimization_level=-1 +;opcache.opt_debug_level=0x20000 +--SKIPIF-- + +--FILE-- +x = 5; + $b->x = 42; + echo $a->x; + echo "\n"; +} +foo(); +?> +--EXPECT-- +42 diff --git a/ext/opcache/tests/opt/sccp_021.phpt b/ext/opcache/tests/opt/sccp_021.phpt new file mode 100644 index 0000000000000..38d93d2264122 --- /dev/null +++ b/ext/opcache/tests/opt/sccp_021.phpt @@ -0,0 +1,30 @@ +--TEST-- +SCCP 021: Memleak +--INI-- +opcache.enable=1 +opcache.enable_cli=1 +opcache.optimization_level=-1 +;opcache.opt_debug_level=0x20000 +--SKIPIF-- + +--FILE-- + +okey +--EXPECT-- +okey diff --git a/ext/opcache/tests/opt/sccp_022.phpt b/ext/opcache/tests/opt/sccp_022.phpt new file mode 100644 index 0000000000000..64ff8dd5ca316 --- /dev/null +++ b/ext/opcache/tests/opt/sccp_022.phpt @@ -0,0 +1,39 @@ +--TEST-- +SCCP 022: Invailid types +--INI-- +opcache.enable=1 +opcache.enable_cli=1 +opcache.optimization_level=-1 +opcache.opt_debug_level=0x20000 +--SKIPIF-- + +--FILE-- +foo = 5; + echo $a[1]; +} +?> +--EXPECTF-- +$_main: ; (lines=1, args=0, vars=0, tmps=0) + ; (after optimizer) + ; %ssccp_022.php:1-10 +L0: RETURN int(1) + +foo: ; (lines=11, args=1, vars=2, tmps=1) + ; (after optimizer) + ; %ssccp_022.php:2-8 +L0: CV0($x) = RECV 1 +L1: ASSIGN_DIM CV1($a) int(0) +L2: OP_DATA CV0($x) +L3: ASSIGN_DIM CV1($a) int(1) +L4: OP_DATA int(5) +L5: ECHO int(5) +L6: ASSIGN_OBJ CV1($a) string("foo") +L7: OP_DATA int(5) +L8: V2 = FETCH_DIM_R CV1($a) int(1) +L9: ECHO V2 +L10: RETURN null \ No newline at end of file diff --git a/ext/opcache/tests/opt/skipif.inc b/ext/opcache/tests/opt/skipif.inc new file mode 100644 index 0000000000000..c5a81810391b7 --- /dev/null +++ b/ext/opcache/tests/opt/skipif.inc @@ -0,0 +1,3 @@ + diff --git a/ext/openssl/tests/openssl_get_cert_locations_basic.phpt b/ext/openssl/tests/openssl_get_cert_locations_basic.phpt new file mode 100644 index 0000000000000..b3992d0a69620 --- /dev/null +++ b/ext/openssl/tests/openssl_get_cert_locations_basic.phpt @@ -0,0 +1,28 @@ +--TEST-- +openssl_get_cert_locations() tests +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +array(8) { + ["default_cert_file"]=> + string(%d) "%s" + ["default_cert_file_env"]=> + string(%d) "%s" + ["default_cert_dir"]=> + string(%d) "%s" + ["default_cert_dir_env"]=> + string(%d) "%s" + ["default_private_dir"]=> + string(%d) "%s" + ["default_default_cert_area"]=> + string(%d) "%s" + ["ini_cafile"]=> + string(%d) "" + ["ini_capath"]=> + string(%d) "" +} diff --git a/ext/openssl/xp_ssl.c b/ext/openssl/xp_ssl.c index fe7aeda06d67a..bb47f3965ad1b 100644 --- a/ext/openssl/xp_ssl.c +++ b/ext/openssl/xp_ssl.c @@ -2581,9 +2581,9 @@ static char *php_openssl_get_url_name(const char *resourcename, } if (url->host) { - const char * host = url->host; + const char * host = ZSTR_VAL(url->host); char * url_name = NULL; - size_t len = strlen(host); + size_t len = ZSTR_LEN(url->host); /* skip trailing dots */ while (len && host[len-1] == '.') { diff --git a/ext/pcntl/package.xml b/ext/pcntl/package.xml deleted file mode 100644 index b9127395c23ae..0000000000000 --- a/ext/pcntl/package.xml +++ /dev/null @@ -1,46 +0,0 @@ - - - - posix - POSIX functions - - - ??? - Kristian Köhntopp - kris@koehntopp.de - lead - - - -This module contains an interface to those functions defined -in the IEEE 1003.1 (POSIX.1) standards document which are not -accessible through other means. POSIX.1 for example defined the -open(), read(), write() and close() functions, too, which -traditionally have been part of PHP for a long time. Some more -system specific functions have not been available before, though, -and this module tries to remedy this by providing easy access -to these functions. - - PHP - - beta - 5.0.0rc1 - 2004-03-19 - -package.xml added to support installation using pear installer - - - - - - - - - - - - - - diff --git a/ext/pcntl/pcntl.c b/ext/pcntl/pcntl.c index d82fed294a2c6..f9ea76de4ff86 100644 --- a/ext/pcntl/pcntl.c +++ b/ext/pcntl/pcntl.c @@ -622,7 +622,7 @@ PHP_FUNCTION(pcntl_alarm) #define PHP_RUSAGE_PARA(from, to, field) \ add_assoc_long(to, #field, from.field) -#if !defined(_OSD_POSIX) && !defined(__BEOS__) /* BS2000 has only a few fields in the rusage struct */ +#ifndef _OSD_POSIX #define PHP_RUSAGE_SPECIAL(from, to) \ PHP_RUSAGE_PARA(from, to, ru_oublock); \ PHP_RUSAGE_PARA(from, to, ru_inblock); \ diff --git a/ext/pdo/package2.xml b/ext/pdo/package2.xml deleted file mode 100644 index add5a47fc304d..0000000000000 --- a/ext/pdo/package2.xml +++ /dev/null @@ -1,134 +0,0 @@ - - - PDO - pecl.php.net - PHP Data Objects Interface - PDO provides a uniform data access interface, sporting advanced features such -as prepared statements and bound parameters. PDO drivers are dynamically -loadable and may be developed independently from the core, but still accessed -using the same API. -Read the documentation at http://www.php.net/pdo for more information. - - - Wez Furlong - wez - wez@php.net - yes - - - Marcus Boerger - helly - helly@php.net - yes - - - Ilia Alshanetsky - iliaa - iliaa@php.net - yes - - - George Schlossnagle - gschlossnagle - george@omniti.com - yes - - 2006-05-01 - - 1.0.3 - 1.0.3 - - - stable - stable - - PHP - -It is highly recommended that you update to PHP 5.1 or higher before using PDO. -This PECL release corresponds to the PHP 5.1.3 release. - -You need to install a PDO database driver to make use of PDO, -check http://pecl.php.net/package-search.php?pkg_name=PDO -for a list of available PDO drivers. - -If you are running on Windows, you can find a precompiled binary at: -http://pecl4win.php.net/ext.php/php_pdo.dll - -You can find additional PDO drivers at: -http://pecl4win.php.net - -** Changes ** -- Added PDO::PARAM_EVT_* family of constants. (Sara) -- Fixed bug #37167 (PDO segfaults when throwing exception from the - fetch handler). (Tony) -- Fixed memory corruption when PDO::FETCH_LAZY mode is being used. (Ilia) -- Fixed bug #36222 (errorInfo in PDOException is always NULL). (Ilia) -- Fixed bug #35797 (segfault on PDOStatement::execute() with - zend.ze1_compatibility_mode = On). (Tony, Ilia) -- Fixed bug #35543 (crash when calling non-existing method in extended class). (Tony) -- Fixed bug #35508 (improved validation of fetch modes). (Tony) -- Fixed bug #35431 (PDO crashes when using LAZY fetch with fetchAll). (Wez) -- Fixed bug #35430 (PDO crashes on incorrect FETCH_FUNC use). (Tony) - -- Changed PDO_XXX constants to PDO::XXX -- It is now possible to extend PDO and PDOStatement and override their constructors - -- Fixed Bug #35303; PDO::prepare() can cause crashes with invalid parameters -- Fixed Bug #35135; "new PDOStatement" can cause crashes. -- Fixed Bug #35293 and PECL Bug #5589; segfault when creating persistent connections -- Fixed PECL Bug #5010, problem installing headers -- renamed pdo_drivers() to PDO::getAvailableDrivers() -- Various fixes when building with SPL -- PDO::setAttribute(PDO::ATTR_STATEMENT_CLASS) allows you to set your own - PDOStatement replacement when extending PDO and PDOStatement -- Fixed Bug #34687; error information from PDO::query() was not always returned -- Fixed PECL Bug #5750; uri: DSN was not handled correctly -- Fixed PECL Bug #5589; segfault when persistent connection attempt fails -- Fixed Bug #34590; User defined PDOStatement class methods are not callable -- Fixed Bug #34908; FETCH_INTO segfaults without destination object -- Fixed PECL Bug #5809; PDOStatement::execute(array(...)) modifies args -- Fixed PECL Bug #5772; FETCH_FUNC cannot call functions with mixed case names - -** Note ** - -You should uninstall and re-install your individual database drivers whenever -you upgrade the base PDO package, otherwise you will see an error about PDO API -numbers when you run your PHP scripts. - - - - - - - - - - - - - - - - - - - - - - - - - - 5.0.3 - - - 1.4.0 - - - - PDO - - diff --git a/ext/pdo/pdo_stmt.c b/ext/pdo/pdo_stmt.c index caf3ff1ef4de2..d65bf217c4724 100644 --- a/ext/pdo/pdo_stmt.c +++ b/ext/pdo/pdo_stmt.c @@ -857,8 +857,7 @@ static int do_fetch(pdo_stmt_t *stmt, int do_bind, zval *return_value, enum pdo_ case PDO_FETCH_NUM: case PDO_FETCH_NAMED: if (!return_all) { - ZVAL_NEW_ARR(return_value); - zend_hash_init(Z_ARRVAL_P(return_value), stmt->column_count, NULL, ZVAL_PTR_DTOR, 0); + array_init_size(return_value, stmt->column_count); } else { array_init(return_value); } diff --git a/ext/pdo_dblib/package2.xml b/ext/pdo_dblib/package2.xml deleted file mode 100644 index 8b726666db115..0000000000000 --- a/ext/pdo_dblib/package2.xml +++ /dev/null @@ -1,76 +0,0 @@ - - - PDO_DBLIB - pecl.php.net - FreeTDS/Sybase/MSSQL driver for PDO - This extension provides a FreeTDS/Sybase/MSSQL driver for PDO. - - - Wez Furlong - wez - wez@php.net - yes - - - Frank M. Kromann - fmk - fmk@php.net - yes - - 2006-05-01 - - 1.0.1 - 1.0.1 - - - stable - stable - - PHP - -- Packaging update; no functional changes in this release -- Fix Bug #34777; segfault when retrieving non-existent error info -- Fix Bug #35032; didn't find FreeTDS includes on some systems - -Windows binaries can be found at: -http://pecl4win.php.net/ext.php/php_pdo_mssql.dll, - -however: you are *strongly* recommended to use PDO_ODBC instead of this driver on -Windows platforms. - - - - - - - - - - - - - - - - - - - 5.0.3 - - - 1.4.0 - - - pdo - pecl.php.net - 1.0.3 - PDO - - - - PDO_DBLIB - - diff --git a/ext/pdo_firebird/firebird_driver.c b/ext/pdo_firebird/firebird_driver.c index ab2571df3d57c..83203d7804f23 100644 --- a/ext/pdo_firebird/firebird_driver.c +++ b/ext/pdo_firebird/firebird_driver.c @@ -545,6 +545,9 @@ static int firebird_handle_get_attribute(pdo_dbh_t *dbh, zend_long attr, zval *v info_func(tmp); ZVAL_STRING(val, tmp); } +#ifdef PHP_WIN32 + FreeLibrary(l); +#endif #else ZVAL_NULL(val); #endif diff --git a/ext/pdo_firebird/package2.xml b/ext/pdo_firebird/package2.xml deleted file mode 100644 index b744d388bc0d5..0000000000000 --- a/ext/pdo_firebird/package2.xml +++ /dev/null @@ -1,68 +0,0 @@ - - - PDO_FIREBIRD - pecl.php.net - Firebird driver for PDO - This extension provides a Firebird driver for PDO. It supports -all versions of Firebird 2.1 and up. - - - Ard Biesheuvel - abies - abies@php.net - yes - - 2013-09-01 - - 1.0 - 1.0 - - - stable - stable - - PHP - To compile and run this module, you will need to have the main PDO module and Firebird's client library installed on your system. -Hope it works! - - - - - - - - - - - - - - - - - - - - - - 5.3.27 - - - 1.4.0 - - - pdo - pecl.php.net - 1.0.3 - PDO - - - - PDO_FIREBIRD - - - - diff --git a/ext/pdo_mysql/mysql_driver.c b/ext/pdo_mysql/mysql_driver.c index de6b1b6d32285..ec7d5b8ea72a6 100644 --- a/ext/pdo_mysql/mysql_driver.c +++ b/ext/pdo_mysql/mysql_driver.c @@ -349,11 +349,7 @@ static int mysql_handle_commit(pdo_dbh_t *dbh) { PDO_DBG_ENTER("mysql_handle_commit"); PDO_DBG_INF_FMT("dbh=%p", dbh); -#if MYSQL_VERSION_ID >= 40100 || defined(PDO_USE_MYSQLND) PDO_DBG_RETURN(0 == mysql_commit(((pdo_mysql_db_handle *)dbh->driver_data)->server)); -#else - PDO_DBG_RETURN(0 <= mysql_handle_doer(dbh, ZEND_STRL("COMMIT"))); -#endif } /* }}} */ @@ -362,11 +358,7 @@ static int mysql_handle_rollback(pdo_dbh_t *dbh) { PDO_DBG_ENTER("mysql_handle_rollback"); PDO_DBG_INF_FMT("dbh=%p", dbh); -#if MYSQL_VERSION_ID >= 40100 || defined(PDO_USE_MYSQLND) PDO_DBG_RETURN(0 <= mysql_rollback(((pdo_mysql_db_handle *)dbh->driver_data)->server)); -#else - PDO_DBG_RETURN(0 <= mysql_handle_doer(dbh, ZEND_STRL("ROLLBACK"))); -#endif } /* }}} */ @@ -376,15 +368,7 @@ static inline int mysql_handle_autocommit(pdo_dbh_t *dbh) PDO_DBG_ENTER("mysql_handle_autocommit"); PDO_DBG_INF_FMT("dbh=%p", dbh); PDO_DBG_INF_FMT("dbh->autocommit=%d", dbh->auto_commit); -#if MYSQL_VERSION_ID >= 40100 || defined(PDO_USE_MYSQLND) PDO_DBG_RETURN(0 <= mysql_autocommit(((pdo_mysql_db_handle *)dbh->driver_data)->server, dbh->auto_commit)); -#else - if (dbh->auto_commit) { - PDO_DBG_RETURN(0 <= mysql_handle_doer(dbh, ZEND_STRL("SET AUTOCOMMIT=1"))); - } else { - PDO_DBG_RETURN(0 <= mysql_handle_doer(dbh, ZEND_STRL("SET AUTOCOMMIT=0"))); - } -#endif } /* }}} */ @@ -516,31 +500,13 @@ static int pdo_mysql_get_attribute(pdo_dbh_t *dbh, zend_long attr, zval *return_ static int pdo_mysql_check_liveness(pdo_dbh_t *dbh) { pdo_mysql_db_handle *H = (pdo_mysql_db_handle *)dbh->driver_data; -#if MYSQL_VERSION_ID <= 32230 - void (*handler) (int); - unsigned int my_errno; -#endif PDO_DBG_ENTER("pdo_mysql_check_liveness"); PDO_DBG_INF_FMT("dbh=%p", dbh); -#if MYSQL_VERSION_ID > 32230 if (mysql_ping(H->server)) { PDO_DBG_RETURN(FAILURE); } -#else /* no mysql_ping() */ - handler = signal(SIGPIPE, SIG_IGN); - mysql_stat(H->server); - switch (mysql_errno(H->server)) { - case CR_SERVER_GONE_ERROR: - case CR_SERVER_LOST: - signal(SIGPIPE, handler); - PDO_DBG_RETURN(FAILURE); - default: - break; - } - signal(SIGPIPE, handler); -#endif /* end mysql_ping() */ PDO_DBG_RETURN(SUCCESS); } /* }}} */ diff --git a/ext/pdo_mysql/package2.xml b/ext/pdo_mysql/package2.xml deleted file mode 100644 index cee6cc7deacff..0000000000000 --- a/ext/pdo_mysql/package2.xml +++ /dev/null @@ -1,93 +0,0 @@ - - - PDO_MYSQL - pecl.php.net - MySQL driver for PDO - This extension provides a MySQL driver for PDO. - - - George Schlossnagle - gschlossnagle - george@omniti.com - yes - - - Ilia Alshanetsky - iliaa - iliaa@php.net - yes - - - Wez Furlong - wez - wez@php.net - yes - - 2006-05-01 - - 1.0.2 - 1.0.2 - - - stable - stable - - PHP - -This PECL release corresponds to PHP 5.1.3. - -Added PDO::ATTR_EMULATE_PREPARES which can be used to force use of emulated or -native prepares. This attribute should can be set on the database handle, and -will cause subsequent prepares to use emulation. - -- Fixed bug #36572 (cannot use native prepared statements with internal - queries like "show master status") (Ilia) -- Repackage using package2.xml -- Fixed Bug #35480 and #35415, crash when using persistent connections. -- Improved error detection for OPTIMIZE queries -- Added PDO::MYSQL_ATTR_LOCAL_INFILE, PDO::MYSQL_ATTR_INIT_COMMAND, - PDO::MYSQL_ATTR_READ_DEFAULT_FILE, PDO::MYSQL_ATTR_READ_DEFAULT_GROUP -- Improved error reporting when using native prepared statements -- Fixed PECL Bug #5193: improved bounds checking when calling getColumnMeta() -- Fixed Bug #34630: improved (emulated) LOB support -- Fixed Bug #34623: crash when selecting longtext fields -- Fixed PECL Bug #5802; is_null flag was sticking -- Fixed PECL Bug #5645; added mysql client library version information to phpinfo() output. - -Windows binaries can be found at http://pecl4win.php.net/ext.php/php_pdo_mysql.dll - - - - - - - - - - - - - - - - - - 5.0.3 - - - 1.4.0 - - - pdo - pecl.php.net - 1.0.3 - PDO - - - - PDO_MYSQL - - diff --git a/ext/pdo_odbc/package2.xml b/ext/pdo_odbc/package2.xml deleted file mode 100644 index 3eb99d1416c65..0000000000000 --- a/ext/pdo_odbc/package2.xml +++ /dev/null @@ -1,71 +0,0 @@ - - - PDO_ODBC - pecl.php.net - ODBC v3 Interface driver for PDO - This extension provides an ODBC v3 driver for PDO. It supports unixODBC -and IBM DB2 libraries, and will support more in future releases. - - - Wez Furlong - wez - wez@php.net - yes - - 2006-05-01 - - 1.0.1 - 1.0.1 - - - stable - stable - - PHP - -- Fixed bug #35552 (crash when pdo_odbc prepare fails). (Wez). -- Fixed bug #36632 (bad error reporting for pdo_odbc exec UPDATE). (Wez). -- repackage with package2.xml - -You require either IBM DB2 CLI libraries or unixODBC to use this package. - -If you are running on windows, you can download the binary from here: -http://pecl4win.php.net/ext.php/php_pdo_odbc.dll - - - - - - - - - - - - - - - - - - 5.0.3 - - - 1.4.0 - - - pdo - pecl.php.net - 1.0.3 - PDO - - - - PDO_ODBC - - - - diff --git a/ext/pdo_pgsql/package2.xml b/ext/pdo_pgsql/package2.xml deleted file mode 100644 index e397958a7d13c..0000000000000 --- a/ext/pdo_pgsql/package2.xml +++ /dev/null @@ -1,87 +0,0 @@ - - - PDO_PGSQL - pecl.php.net - PostgreSQL driver for PDO - This extension provides an PostgreSQL driver for PDO. - - - Edin Kadribasic - edink - edink@php.net - yes - - - Ilia Alshanetsky - iliaa - iliaa@php.net - yes - - - Wez Furlong - wez - wez@php.net - yes - - 2006-05-01 - - 1.0.2 - 1.0.2 - - - stable - stable - - PHP - -This PECL release corresponds to PHP 5.1.3. - -- Fixed bug #36727 (segfault in pdo_pgsql bindValue() when no parameters are - defined). (Tony) -- Fixed bug #36382 (PDO/PgSQL's getColumnMeta() crashes). (Derick) -- Fixed bug #36176 (PDO_PGSQL - PDO::exec() does not return number of rows - affected by the operation). (Ilia) -- Fixed prepared statement name conflict handling in PDO_PGSQL. (Thies, Ilia) -- repackage with package2.xml -- Added PDO::pgsqlLOBCreate(), PDO::pgsqlLOBOpen() and PDO::pgsqlLOBUnlink(). - -You require PostgreSQL client libraries installed on the machine where you -intend to build and/or use this package. - -If you are running on windows, you can download the binary from here: -http://pecl4win.php.net/ext.php/php_pdo_pgsql.dll - - - - - - - - - - - - - - - - - 5.0.3 - - - 1.4.0 - - - pdo - pecl.php.net - 1.0.3 - PDO - - - - PDO_PGSQL - - diff --git a/ext/pdo_sqlite/package2.xml b/ext/pdo_sqlite/package2.xml deleted file mode 100644 index 9b582292aecad..0000000000000 --- a/ext/pdo_sqlite/package2.xml +++ /dev/null @@ -1,203 +0,0 @@ - - - PDO_SQLITE - pecl.php.net - SQLite v3 Interface driver for PDO - This extension provides an SQLite v3 driver for PDO. -SQLite V3 is NOT compatible with the bundled SQLite 2 in PHP 5, but is a significant -step forwards, featuring complete utf-8 support, native support for blobs, -native support for prepared statements with bound parameters and improved -concurrency. - - - - Wez Furlong - wez - wez@php.net - yes - - 2006-05-01 - - 1.0.1 - 1.0.1 - - - stable - stable - - PHP - -- Updated libsqlite in ext/pdo_sqlite to 3.2.8. (Ilia) -- Upgraded to new package2 format -- Fixed PECL Bug #5633; build issues -- Added sqliteCreateFunction() and sqliteCreateAggregate() -- Fixed PECL Bug #3452; problem when first row of a result set contains a NULL value. -- Upgraded bundled sqlite to 3.1.3 -- setting PDO_ATTR_TIMEOUT controls the busy timeout -- Fixed PECL Bug #3391; cannot bind NULL parameters -- Fixed build problem when building the bundled sqlite library - -Windows binary: -http://pecl4win.php.net/ext.php/php_pdo_sqlite.dll - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5.0.3 - - - 1.4.0 - - - pdo - pecl.php.net - 1.0.3 - PDO - - - - PDO_SQLITE - - - diff --git a/ext/pdo_sqlite/pdo_sqlite.c b/ext/pdo_sqlite/pdo_sqlite.c index d0eb1823d61db..60e1a07afb3d2 100644 --- a/ext/pdo_sqlite/pdo_sqlite.c +++ b/ext/pdo_sqlite/pdo_sqlite.c @@ -73,6 +73,11 @@ PHP_MINIT_FUNCTION(pdo_sqlite) REGISTER_PDO_CLASS_CONST_LONG("SQLITE_DETERMINISTIC", (zend_long)SQLITE_DETERMINISTIC); #endif + REGISTER_PDO_CLASS_CONST_LONG("SQLITE_ATTR_OPEN_FLAGS", (zend_long)PDO_SQLITE_ATTR_OPEN_FLAGS); + REGISTER_PDO_CLASS_CONST_LONG("SQLITE_OPEN_READONLY", (zend_long)SQLITE_OPEN_READONLY); + REGISTER_PDO_CLASS_CONST_LONG("SQLITE_OPEN_READWRITE", (zend_long)SQLITE_OPEN_READWRITE); + REGISTER_PDO_CLASS_CONST_LONG("SQLITE_OPEN_CREATE", (zend_long)SQLITE_OPEN_CREATE); + return php_pdo_register_driver(&pdo_sqlite_driver); } /* }}} */ diff --git a/ext/pdo_sqlite/php_pdo_sqlite_int.h b/ext/pdo_sqlite/php_pdo_sqlite_int.h index a390d6497f504..1c90416b9f9d4 100644 --- a/ext/pdo_sqlite/php_pdo_sqlite_int.h +++ b/ext/pdo_sqlite/php_pdo_sqlite_int.h @@ -75,4 +75,9 @@ extern int _pdo_sqlite_error(pdo_dbh_t *dbh, pdo_stmt_t *stmt, const char *file, #define pdo_sqlite_error_stmt(s) _pdo_sqlite_error(stmt->dbh, stmt, __FILE__, __LINE__) extern struct pdo_stmt_methods sqlite_stmt_methods; + +enum { + PDO_SQLITE_ATTR_OPEN_FLAGS = PDO_ATTR_DRIVER_SPECIFIC, +}; + #endif diff --git a/ext/pdo_sqlite/sqlite_driver.c b/ext/pdo_sqlite/sqlite_driver.c index e234406be9bb9..1b4fecae81dc3 100644 --- a/ext/pdo_sqlite/sqlite_driver.c +++ b/ext/pdo_sqlite/sqlite_driver.c @@ -791,7 +791,7 @@ static int pdo_sqlite_handle_factory(pdo_dbh_t *dbh, zval *driver_options) /* {{ { pdo_sqlite_db_handle *H; int i, ret = 0; - zend_long timeout = 60; + zend_long timeout = 60, flags; char *filename; H = pecalloc(1, sizeof(pdo_sqlite_db_handle), dbh->is_persistent); @@ -809,7 +809,14 @@ static int pdo_sqlite_handle_factory(pdo_dbh_t *dbh, zval *driver_options) /* {{ goto cleanup; } + flags = pdo_attr_lval(driver_options, PDO_SQLITE_ATTR_OPEN_FLAGS, SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE); + +#if SQLITE_VERSION_NUMBER >= 3005000 + i = sqlite3_open_v2(filename, &H->db, flags, NULL); +#else i = sqlite3_open(filename, &H->db); +#endif + efree(filename); if (i != SQLITE_OK) { diff --git a/ext/pdo_sqlite/tests/pdo_sqlite_open_flags.phpt b/ext/pdo_sqlite/tests/pdo_sqlite_open_flags.phpt new file mode 100644 index 0000000000000..89cb6c89bd3ca --- /dev/null +++ b/ext/pdo_sqlite/tests/pdo_sqlite_open_flags.phpt @@ -0,0 +1,33 @@ +--TEST-- +PDO_sqlite: Testing open flags +--SKIPIF-- + +--FILE-- + PDO::ERRMODE_EXCEPTION]); + +var_dump($db->exec('CREATE TABLE test1 (id INT);')); + +$db = new PDO('sqlite:' . $filename, null, null, [PDO::SQLITE_ATTR_OPEN_FLAGS => PDO::SQLITE_OPEN_READONLY, PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION]); + +var_dump($db->exec('CREATE TABLE test2 (id INT);')); +?> +--CLEAN-- + +--EXPECTF-- +int(0) + +Fatal error: Uncaught PDOException: SQLSTATE[HY000]: General error: 8 attempt to write a readonly database in %s +Stack trace: +%s +#1 {main} + thrown in %s diff --git a/ext/pgsql/pgsql.c b/ext/pgsql/pgsql.c index 1fe26f78fc7eb..07dcff9cf2d05 100644 --- a/ext/pgsql/pgsql.c +++ b/ext/pgsql/pgsql.c @@ -1194,6 +1194,24 @@ PHP_MINIT_FUNCTION(pgsql) REGISTER_LONG_CONSTANT("PGSQL_DIAG_SOURCE_FILE", PG_DIAG_SOURCE_FILE, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("PGSQL_DIAG_SOURCE_LINE", PG_DIAG_SOURCE_LINE, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("PGSQL_DIAG_SOURCE_FUNCTION", PG_DIAG_SOURCE_FUNCTION, CONST_CS | CONST_PERSISTENT); +#ifdef PG_DIAG_SCHEMA_NAME + REGISTER_LONG_CONSTANT("PGSQL_DIAG_SCHEMA_NAME", PG_DIAG_SCHEMA_NAME, CONST_CS | CONST_PERSISTENT); +#endif +#ifdef PG_DIAG_TABLE_NAME + REGISTER_LONG_CONSTANT("PGSQL_DIAG_TABLE_NAME", PG_DIAG_TABLE_NAME, CONST_CS | CONST_PERSISTENT); +#endif +#ifdef PG_DIAG_COLUMN_NAME + REGISTER_LONG_CONSTANT("PGSQL_DIAG_COLUMN_NAME", PG_DIAG_COLUMN_NAME, CONST_CS | CONST_PERSISTENT); +#endif +#ifdef PG_DIAG_DATATYPE_NAME + REGISTER_LONG_CONSTANT("PGSQL_DIAG_DATATYPE_NAME", PG_DIAG_DATATYPE_NAME, CONST_CS | CONST_PERSISTENT); +#endif +#ifdef PG_DIAG_CONSTRAINT_NAME + REGISTER_LONG_CONSTANT("PGSQL_DIAG_CONSTRAINT_NAME", PG_DIAG_CONSTRAINT_NAME, CONST_CS | CONST_PERSISTENT); +#endif +#ifdef PG_DIAG_SEVERITY_NONLOCALIZED + REGISTER_LONG_CONSTANT("PGSQL_DIAG_SEVERITY_NONLOCALIZED", PG_DIAG_SEVERITY_NONLOCALIZED, CONST_CS | CONST_PERSISTENT); +#endif #endif /* pg_convert options */ REGISTER_LONG_CONSTANT("PGSQL_CONV_IGNORE_DEFAULT", PGSQL_CONV_IGNORE_DEFAULT, CONST_CS | CONST_PERSISTENT); diff --git a/ext/pgsql/pgsql.mak b/ext/pgsql/pgsql.mak deleted file mode 100644 index 908056acfb155..0000000000000 --- a/ext/pgsql/pgsql.mak +++ /dev/null @@ -1,170 +0,0 @@ -# Temporarily here -- later may go into some batch file -# which will set this as an environment variable -PROJECT_ROOT = ..\.. - -# Module details -MODULE_NAME = phppgsql -MODULE_DESC = "PHP 4.3 - PostgreSQL Extension" -VMAJ = 3 -VMIN = 0 -VREV = 0 - -#include the common settings -include $(PROJECT_ROOT)/netware/common.mif - -# Build type defaults to 'release' -ifndef BUILD -BUILD = release -endif - -# Extensions of all input and output files -.SUFFIXES: -.SUFFIXES: .nlm .lib .obj .cpp .c .msg .mlc .mdb .xdc .d - -# Source files -C_SRC = pgsql.c \ - start.c - -CPP_SRC_NODIR = $(notdir $(CPP_SRC)) -C_SRC_NODIR = $(notdir $(C_SRC)) -SRC_DIR = $(dir $(CPP_SRC) $(C_SRC)) - -# Library files -LIBRARY = - -# Destination directories and files -OBJ_DIR = $(BUILD) -FINAL_DIR = $(BUILD) -OBJECTS = $(addprefix $(OBJ_DIR)/,$(CPP_SRC_NODIR:.c=.obj) $(C_SRC_NODIR:.c=.obj)) -DEPDS = $(addprefix $(OBJ_DIR)/,$(CPP_SRC_NODIR:.c=.d) $(C_SRC_NODIR:.c=.d)) - -# Binary file -ifndef BINARY - BINARY=$(FINAL_DIR)\$(MODULE_NAME).nlm -endif - -# Compile flags -C_FLAGS += -c -maxerrors 25 -msgstyle gcc -wchar_t on -bool on -processor Pentium -C_FLAGS += -nostdinc -nosyspath -C_FLAGS += -relax_pointers # To remove type-casting errors -C_FLAGS += -DNETWARE -DZTS -DNEW_LIBC -DUSE_OLD_FUNCTIONS -C_FLAGS += -D__BIT_TYPES_DEFINED__ -DCOMPILE_DL_PGSQL=1 -C_FLAGS += -I. -I- -I$(PROJECT_ROOT) -I$(PROJECT_ROOT)/main -C_FLAGS += -I$(PROJECT_ROOT)/ext/standard -I$(PROJECT_ROOT)/netware -C_FLAGS += -I$(PROJECT_ROOT)/zend -I$(PROJECT_ROOT)/tsrm -C_FLAGS += -I$(SDK_DIR)/include -I$(MWCIncludes) -C_FLAGS += -I$(WINSOCK_DIR)/include/nlm -I$(WINSOCK_DIR)/include - - -# Extra stuff based on debug / release builds -ifeq '$(BUILD)' 'debug' - SYM_FILE = $(FINAL_DIR)\$(MODULE_NAME).sym - C_FLAGS += -inline smart -sym on -sym codeview4 -opt off -opt intrinsics -DDEBUGGING -DDKFBPON - C_FLAGS += -exc cw -DZEND_DEBUG=1 - LD_FLAGS += -sym on -sym codeview4 -osym $(SYM_FILE) - export MWLibraryFiles=$(SDK_DIR)/imports/libcpre.o;mwcrtld.lib -else - C_FLAGS += -opt speed -inline on -inline smart -inline auto -sym off -opt intrinsics - C_FLAGS += -opt level=4 -DZEND_DEBUG=0 - LD_FLAGS += -sym off - export MWLibraryFiles=$(SDK_DIR)/imports/libcpre.o;mwcrtl.lib -endif - - -# Dependencies -MODULE = LibC \ - phplib \ - libpq -IMPORT = @$(SDK_DIR)/imports/libc.imp \ - @$(SDK_DIR)/imports/ws2nlm.imp \ - @$(MPK_DIR)/import/mpkOrg.imp \ - @$(PROJECT_ROOT)/netware/phplib.imp \ - @$(PROJECT_ROOT)/netware/libpq.imp -EXPORT = ($(MODULE_NAME)) get_module -API = OutputToScreen - -# Virtual paths -vpath %.cpp . -vpath %.c . ..\..\netware -vpath %.obj $(OBJ_DIR) - - -all: prebuild project - -.PHONY: all - -prebuild: - @if not exist $(OBJ_DIR) md $(OBJ_DIR) - -project: $(BINARY) - @echo Build complete. - -$(OBJ_DIR)/%.d: %.cpp - @echo Building Dependencies for $( $(basename $@).def -ifdef API - @echo Import $(API) >> $(basename $@).def -endif - @echo Module $(MODULE) >> $(basename $@).def -ifdef EXPORT - @echo Export $(EXPORT) >> $(basename $@).def -endif - @echo AutoUnload >> $(basename $@).def -ifeq '$(BUILD)' 'debug' - @echo Debug >> $(basename $@).def -endif - @echo Flag_On 0x00000008 >> $(basename $@).def - @echo Start _LibCPrelude >> $(basename $@).def - @echo Exit _LibCPostlude >> $(basename $@).def - - $(MPKTOOL) $(XDCFLAGS) $(basename $@).xdc - @echo xdcdata $(basename $@).xdc >> $(basename $@).def - - @echo Linking $@... - @echo $(LD_FLAGS) -commandfile $(basename $@).def > $(basename $@).link - - @echo $(LIBRARY) $(OBJECTS) >> $(basename $@).link - - @$(LINK) @$(basename $@).link - - -.PHONY: clean -clean: cleanobj cleanbin - -.PHONY: cleand -cleand: - @echo Deleting all dependency files... - -@del "$(OBJ_DIR)\*.d" - -.PHONY: cleanobj -cleanobj: - @echo Deleting all object files... - -@del "$(OBJ_DIR)\*.obj" - -.PHONY: cleanbin -cleanbin: - @echo Deleting binary files... - -@del "$(FINAL_DIR)\$(MODULE_NAME).nlm" - @echo Deleting MAP, DEF files, etc.... - -@del "$(FINAL_DIR)\$(MODULE_NAME).map" - -@del "$(FINAL_DIR)\$(MODULE_NAME).def" - -@del "$(FINAL_DIR)\$(MODULE_NAME).link" -ifeq '$(BUILD)' 'debug' - -@del $(FINAL_DIR)\$(MODULE_NAME).sym -endif diff --git a/ext/phar/dirstream.c b/ext/phar/dirstream.c index cb95cdf0e94d0..ce37a448f5db4 100644 --- a/ext/phar/dirstream.c +++ b/ext/phar/dirstream.c @@ -319,7 +319,7 @@ php_stream *phar_wrapper_open_dir(php_stream_wrapper *wrapper, const char *path, /* we must have at the very least phar://alias.phar/ */ if (!resource->scheme || !resource->host || !resource->path) { if (resource->host && !resource->path) { - php_stream_wrapper_log_error(wrapper, options, "phar error: no directory in \"%s\", must have at least phar://%s/ for root directory (always use full path to a new phar)", path, resource->host); + php_stream_wrapper_log_error(wrapper, options, "phar error: no directory in \"%s\", must have at least phar://%s/ for root directory (always use full path to a new phar)", path, ZSTR_VAL(resource->host)); php_url_free(resource); return NULL; } @@ -328,22 +328,22 @@ php_stream *phar_wrapper_open_dir(php_stream_wrapper *wrapper, const char *path, return NULL; } - if (strcasecmp("phar", resource->scheme)) { + if (!zend_string_equals_literal_ci(resource->scheme, "phar")) { php_url_free(resource); php_stream_wrapper_log_error(wrapper, options, "phar error: not a phar url \"%s\"", path); return NULL; } - host_len = strlen(resource->host); + host_len = ZSTR_LEN(resource->host); phar_request_initialize(); - internal_file = resource->path + 1; /* strip leading "/" */ + internal_file = ZSTR_VAL(resource->path) + 1; /* strip leading "/" */ - if (FAILURE == phar_get_archive(&phar, resource->host, host_len, NULL, 0, &error)) { + if (FAILURE == phar_get_archive(&phar, ZSTR_VAL(resource->host), host_len, NULL, 0, &error)) { if (error) { php_stream_wrapper_log_error(wrapper, options, "%s", error); efree(error); } else { - php_stream_wrapper_log_error(wrapper, options, "phar file \"%s\" is unknown", resource->host); + php_stream_wrapper_log_error(wrapper, options, "phar file \"%s\" is unknown", ZSTR_VAL(resource->host)); } php_url_free(resource); return NULL; @@ -446,48 +446,48 @@ int phar_wrapper_mkdir(php_stream_wrapper *wrapper, const char *url_from, int mo return 0; } - if (strcasecmp("phar", resource->scheme)) { + if (!zend_string_equals_literal_ci(resource->scheme, "phar")) { php_url_free(resource); php_stream_wrapper_log_error(wrapper, options, "phar error: not a phar stream url \"%s\"", url_from); return 0; } - host_len = strlen(resource->host); + host_len = ZSTR_LEN(resource->host); - if (FAILURE == phar_get_archive(&phar, resource->host, host_len, NULL, 0, &error)) { - php_stream_wrapper_log_error(wrapper, options, "phar error: cannot create directory \"%s\" in phar \"%s\", error retrieving phar information: %s", resource->path+1, resource->host, error); + if (FAILURE == phar_get_archive(&phar, ZSTR_VAL(resource->host), host_len, NULL, 0, &error)) { + php_stream_wrapper_log_error(wrapper, options, "phar error: cannot create directory \"%s\" in phar \"%s\", error retrieving phar information: %s", resource->path+1, ZSTR_VAL(resource->host), error); efree(error); php_url_free(resource); return 0; } - if ((e = phar_get_entry_info_dir(phar, resource->path + 1, strlen(resource->path + 1), 2, &error, 1))) { + if ((e = phar_get_entry_info_dir(phar, ZSTR_VAL(resource->path) + 1, ZSTR_LEN(resource->path) - 1, 2, &error, 1))) { /* directory exists, or is a subdirectory of an existing file */ if (e->is_temp_dir) { efree(e->filename); efree(e); } - php_stream_wrapper_log_error(wrapper, options, "phar error: cannot create directory \"%s\" in phar \"%s\", directory already exists", resource->path+1, resource->host); + php_stream_wrapper_log_error(wrapper, options, "phar error: cannot create directory \"%s\" in phar \"%s\", directory already exists", ZSTR_VAL(resource->path)+1, ZSTR_VAL(resource->host)); php_url_free(resource); return 0; } if (error) { - php_stream_wrapper_log_error(wrapper, options, "phar error: cannot create directory \"%s\" in phar \"%s\", %s", resource->path+1, resource->host, error); + php_stream_wrapper_log_error(wrapper, options, "phar error: cannot create directory \"%s\" in phar \"%s\", %s", ZSTR_VAL(resource->path)+1, ZSTR_VAL(resource->host), error); efree(error); php_url_free(resource); return 0; } - if (phar_get_entry_info_dir(phar, resource->path + 1, strlen(resource->path + 1), 0, &error, 1)) { + if (phar_get_entry_info_dir(phar, ZSTR_VAL(resource->path) + 1, ZSTR_LEN(resource->path) - 1, 0, &error, 1)) { /* entry exists as a file */ - php_stream_wrapper_log_error(wrapper, options, "phar error: cannot create directory \"%s\" in phar \"%s\", file already exists", resource->path+1, resource->host); + php_stream_wrapper_log_error(wrapper, options, "phar error: cannot create directory \"%s\" in phar \"%s\", file already exists", ZSTR_VAL(resource->path)+1, ZSTR_VAL(resource->host)); php_url_free(resource); return 0; } if (error) { - php_stream_wrapper_log_error(wrapper, options, "phar error: cannot create directory \"%s\" in phar \"%s\", %s", resource->path+1, resource->host, error); + php_stream_wrapper_log_error(wrapper, options, "phar error: cannot create directory \"%s\" in phar \"%s\", %s", ZSTR_VAL(resource->path)+1, ZSTR_VAL(resource->host), error); efree(error); php_url_free(resource); return 0; @@ -500,14 +500,14 @@ int phar_wrapper_mkdir(php_stream_wrapper *wrapper, const char *url_from, int mo entry.is_zip = 1; } - entry.filename = estrdup(resource->path + 1); + entry.filename = estrdup(ZSTR_VAL(resource->path) + 1); if (phar->is_tar) { entry.is_tar = 1; entry.tar_type = TAR_DIR; } - entry.filename_len = strlen(resource->path + 1); + entry.filename_len = ZSTR_LEN(resource->path) - 1; php_url_free(resource); entry.is_dir = 1; entry.phar = phar; @@ -581,29 +581,29 @@ int phar_wrapper_rmdir(php_stream_wrapper *wrapper, const char *url, int options return 0; } - if (strcasecmp("phar", resource->scheme)) { + if (!zend_string_equals_literal_ci(resource->scheme, "phar")) { php_url_free(resource); php_stream_wrapper_log_error(wrapper, options, "phar error: not a phar stream url \"%s\"", url); return 0; } - host_len = strlen(resource->host); + host_len = ZSTR_LEN(resource->host); - if (FAILURE == phar_get_archive(&phar, resource->host, host_len, NULL, 0, &error)) { - php_stream_wrapper_log_error(wrapper, options, "phar error: cannot remove directory \"%s\" in phar \"%s\", error retrieving phar information: %s", resource->path+1, resource->host, error); + if (FAILURE == phar_get_archive(&phar, ZSTR_VAL(resource->host), host_len, NULL, 0, &error)) { + php_stream_wrapper_log_error(wrapper, options, "phar error: cannot remove directory \"%s\" in phar \"%s\", error retrieving phar information: %s", ZSTR_VAL(resource->path)+1, ZSTR_VAL(resource->host), error); efree(error); php_url_free(resource); return 0; } - path_len = strlen(resource->path+1); + path_len = ZSTR_LEN(resource->path) - 1; - if (!(entry = phar_get_entry_info_dir(phar, resource->path + 1, path_len, 2, &error, 1))) { + if (!(entry = phar_get_entry_info_dir(phar, ZSTR_VAL(resource->path) + 1, path_len, 2, &error, 1))) { if (error) { - php_stream_wrapper_log_error(wrapper, options, "phar error: cannot remove directory \"%s\" in phar \"%s\", %s", resource->path+1, resource->host, error); + php_stream_wrapper_log_error(wrapper, options, "phar error: cannot remove directory \"%s\" in phar \"%s\", %s", ZSTR_VAL(resource->path)+1, ZSTR_VAL(resource->host), error); efree(error); } else { - php_stream_wrapper_log_error(wrapper, options, "phar error: cannot remove directory \"%s\" in phar \"%s\", directory does not exist", resource->path+1, resource->host); + php_stream_wrapper_log_error(wrapper, options, "phar error: cannot remove directory \"%s\" in phar \"%s\", directory does not exist", ZSTR_VAL(resource->path)+1, ZSTR_VAL(resource->host)); } php_url_free(resource); return 0; @@ -615,7 +615,7 @@ int phar_wrapper_rmdir(php_stream_wrapper *wrapper, const char *url, int options zend_hash_move_forward(&phar->manifest) ) { if (ZSTR_LEN(str_key) > path_len && - memcmp(ZSTR_VAL(str_key), resource->path+1, path_len) == 0 && + memcmp(ZSTR_VAL(str_key), ZSTR_VAL(resource->path)+1, path_len) == 0 && IS_SLASH(ZSTR_VAL(str_key)[path_len])) { php_stream_wrapper_log_error(wrapper, options, "phar error: Directory not empty"); if (entry->is_temp_dir) { @@ -632,7 +632,7 @@ int phar_wrapper_rmdir(php_stream_wrapper *wrapper, const char *url, int options zend_hash_move_forward(&phar->virtual_dirs)) { if (ZSTR_LEN(str_key) > path_len && - memcmp(ZSTR_VAL(str_key), resource->path+1, path_len) == 0 && + memcmp(ZSTR_VAL(str_key), ZSTR_VAL(resource->path)+1, path_len) == 0 && IS_SLASH(ZSTR_VAL(str_key)[path_len])) { php_stream_wrapper_log_error(wrapper, options, "phar error: Directory not empty"); if (entry->is_temp_dir) { @@ -646,7 +646,7 @@ int phar_wrapper_rmdir(php_stream_wrapper *wrapper, const char *url, int options } if (entry->is_temp_dir) { - zend_hash_str_del(&phar->virtual_dirs, resource->path+1, path_len); + zend_hash_str_del(&phar->virtual_dirs, ZSTR_VAL(resource->path)+1, path_len); efree(entry->filename); efree(entry); } else { diff --git a/ext/phar/package.xml b/ext/phar/package.xml deleted file mode 100644 index 4a9798e252ce7..0000000000000 --- a/ext/phar/package.xml +++ /dev/null @@ -1,1452 +0,0 @@ - - - phar - pecl.php.net - allows running of complete applications out of .phar files (like Java .jar files) - This is the extension version of PEAR's PHP_Archive package. Support for -zlib, bz2 and crc32 is achieved without any dependency other than the external -zlib or bz2 extension. - -.phar files can be read using the phar stream, or with the Phar class. If the SPL extension -is available, a Phar object can be used as an array to iterate over a phar's contents -or to read files directly from the phar. - -Phar supports tar and zip file formats as well as the native phar file format, and can also be -used to create data-only tar and zip archives with the PharData class, even if -write access is disabled by the phar.readonly ini variable. - -Executable phar archives can be created using the streams API or with the Phar class, if -the phar.readonly ini variable is set to false. - -Full support for MD5 and SHA1 signatures is possible. Signatures can be required -if the ini variable phar.require_hash is set to true. When PECL extension hash is -available then SHA-256 and SHA-512 signatures are supported as well. - -Phar is APC-compatible, the latest APC will cache files within a phar archive, resulting in -a 6x speedup measured running phpMyAdmin as a phar archive. - - Greg Beaver - cellog - cellog@php.net - yes - - - Marcus Boerger - helly - helly@php.net - yes - - - Steph Fox - sfox - sfox@php.net - yes - - 2009-07-26 - - - 2.0.0 - 1.1.1 - - - stable - stable - - PHP License - -BC BREAKING RELEASE - BC breaks: - * Phar object Compression API is rewritten. Use Phar::compress() and decompress(), - Phar::compressFiles()/decompressFiles() and PharFileInfo->compress()/decompress(). - * phar.extract_list and Phar::getExtractList() are removed - -Major feature functionality release - * phar.cache_list allows web-based phar applications to run at equal or faster than - their on-disk equivalent [Greg] - * new default stub allows running of phar-based phars without phar extension [Greg/Steph] - * add support for tar-based and zip-based phar archives [Greg] - * add support for OpenSSL-based true signatures [Greg] - * add support for signatures to tar-based phar archives [Greg] - * add Phar::isFileFormat() [Greg] - * add Phar::convertToExecutable(), Phar::convertToData() [Greg] - * add Phar::compress() [Greg] - * rename Phar::compressAllFiles() to compressFiles(), uncompressAllFiles() to - decompressFiles() [Greg] - * conversion to compressed or to other file formats automatically copies the archive - to a new extension (i.e. ".phar" to ".phar.tar" or ".tar" to ".tar.gz") [Steph] - * add Phar::webPhar() for running a web-based application unmodified - directly from a phar archive [Greg] - * file functions (fopen-based and stat-based) can be instructed to only look for - relative paths within a phar via Phar::interceptFileFuncs() - * add PharData class to allow manipulation/creation of non-executable tar and zip archives. [Steph] - non-executable tar/zip manipulation is allowed even when phar.readonly=1 [Greg] - * paths with . and .. work (phar://blah.phar/a/../b.php => phar://blah.phar/b.php) [Greg] - * add support for mkdir()/rmdir() and support for empty directories to phar file format [Greg] - * add option to compress the entire phar file for phar/tar file format [Greg] - * implement Phar::isCompressed() returning 0, Phar::GZ or Phar::BZ2 [Greg] - * implement Phar::copy(string $from, string $to) [Greg] - * implement Phar::running(), returns path or URL to currently executed phar - * implement Phar::buildFromIterator(Iterator $it[, string $base_directory]) [Greg] - * implement Phar::buildFromDirectory(string $base_directory[, string $regex]) [Steph] - * implement Phar::mount() for mounting external paths or files to locations inside a phar [Greg] - * add Phar::delete() [Greg] - * implement Phar::unlinkArchive() [Greg] - -Security addition - * aliases are validated so that they contain no directory separators as intended - * on conversion to other formats, user-supplied aliases are validated - -Changes since 2.0.0RC2: - fixed PHP Bug #49021: phar tar signature algorithm reports as Unknown (0) in - getSignature() call - fixed PHP Bug #49020: phar misinterprets ustar long filename standard - fixed PHP Bug #49018: phar tar stores long filenames with prefix/name reversed - fixed PHP Bug #48791: open office files always reported as corrupted - fixed PHP Bug #48783: make install will fail saying phar file exists - fixed PHP Bug #48740: PHAR install fails when INSTALL_ROOT is not the final install location - fixed PHP Bug #48681: openssl signature verification for tar archives broken - fixed PHP Bug #48377: error message unclear on converting phar with existing file - fixed isset() on sub-directories (isset("blah") if file "blah/foo.php" exists) - - make phar work in PHP 6 -Changes since 2.0.0RC1: - security vulnerability in handling of long tar filenames fixed - fixed PECL Bug #14646: phar error message unclear with php stream wrappers - fixed PECL Bug #16338: php_stream_copy_to_stream{,_ex}() - fixed PHP Bug #48257: PharData throws an exception with non-phar tar - fixed PHP Bug #47085: rename() returns true even if the file in PHAR does not exist - fixed PHP Bug #46032: PharData::__construct() - wrong memory read - fixed PHP Bug #46060: Phar::addEmptyDir() breaks - fixed PHP Bug #45907: undefined reference to 'PHP_SHA512Init' - fixed PHP Bug #45726: PHP_Archive / Archive.php missing -Changes since 2.0.0a2: many bugfixes, removal of phar.extract_list, compression API refactored, - conversion API refactored -Changes since 2.0.0b1: addition of phar.cache_list, many performance improvements and bugfixes - implement OpenSSL asynchronous true package signing - add support for package signing to tar-based archives - require PHP 5.2.1+ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5.2.1 - - - 1.4.3 - - - - - bz2 - pecl.php.net - bz2 - - - hash - pecl.php.net - hash - - - spl - - - zlib - - - - phar - - - - - 2.0.0 - 1.1.1 - - - beta - beta - - 2009-07-26 - PHP License - -BC BREAKING RELEASE - BC breaks: - * Phar object Compression API is rewritten. Use Phar::compress() and decompress(), - Phar::compressFiles()/decompressFiles() and PharFileInfo->compress()/decompress(). - * phar.extract_list and Phar::getExtractList() are removed - -Major feature functionality release - * phar.cache_list allows web-based phar applications to run at equal or faster than - their on-disk equivalent [Greg] - * new default stub allows running of phar-based phars without phar extension [Greg/Steph] - * add support for tar-based and zip-based phar archives [Greg] - * add support for OpenSSL-based true signatures [Greg] - * add support for signatures to tar-based phar archives [Greg] - * add Phar::isFileFormat() [Greg] - * add Phar::convertToExecutable(), Phar::convertToData() [Greg] - * add Phar::compress() [Greg] - * rename Phar::compressAllFiles() to compressFiles(), uncompressAllFiles() to - decompressFiles() [Greg] - * conversion to compressed or to other file formats automatically copies the archive - to a new extension (i.e. ".phar" to ".phar.tar" or ".tar" to ".tar.gz") [Steph] - * add Phar::webPhar() for running a web-based application unmodified - directly from a phar archive [Greg] - * file functions (fopen-based and stat-based) can be instructed to only look for - relative paths within a phar via Phar::interceptFileFuncs() - * add PharData class to allow manipulation/creation of non-executable tar and zip archives. [Steph] - non-executable tar/zip manipulation is allowed even when phar.readonly=1 [Greg] - * paths with . and .. work (phar://blah.phar/a/../b.php => phar://blah.phar/b.php) [Greg] - * add support for mkdir()/rmdir() and support for empty directories to phar file format [Greg] - * add option to compress the entire phar file for phar/tar file format [Greg] - * implement Phar::isCompressed() returning 0, Phar::GZ or Phar::BZ2 [Greg] - * implement Phar::copy(string $from, string $to) [Greg] - * implement Phar::running(), returns path or URL to currently executed phar - * implement Phar::buildFromIterator(Iterator $it[, string $base_directory]) [Greg] - * implement Phar::buildFromDirectory(string $base_directory[, string $regex]) [Steph] - * implement Phar::mount() for mounting external paths or files to locations inside a phar [Greg] - * add Phar::delete() [Greg] - * implement Phar::unlinkArchive() [Greg] - -Security addition - * aliases are validated so that they contain no directory separators as intended - * on conversion to other formats, user-supplied aliases are validated - -Changes since 2.0.0RC2: - fixed PHP Bug #49021: phar tar signature algorithm reports as Unknown (0) in - getSignature() call - fixed PHP Bug #49020: phar misinterprets ustar long filename standard - fixed PHP Bug #49018: phar tar stores long filenames with prefix/name reversed - fixed PHP Bug #48791: open office files always reported as corrupted - fixed PHP Bug #48783: make install will fail saying phar file exists - fixed PHP Bug #48740: PHAR install fails when INSTALL_ROOT is not the final install location - fixed PHP Bug #48681: openssl signature verification for tar archives broken - fixed PHP Bug #48377: error message unclear on converting phar with existing file - fixed isset() on sub-directories (isset("blah") if file "blah/foo.php" exists) - - make phar work in PHP 6 -Changes since 2.0.0RC1: - security vulnerability in handling of long tar filenames fixed - fixed PECL Bug #14646: phar error message unclear with php stream wrappers - fixed PECL Bug #16338: php_stream_copy_to_stream{,_ex}() - fixed PHP Bug #48257: PharData throws an exception with non-phar tar - fixed PHP Bug #47085: rename() returns true even if the file in PHAR does not exist - fixed PHP Bug #46032: PharData::__construct() - wrong memory read - fixed PHP Bug #46060: Phar::addEmptyDir() breaks - fixed PHP Bug #45907: undefined reference to 'PHP_SHA512Init' - fixed PHP Bug #45726: PHP_Archive / Archive.php missing -Changes since 2.0.0a2: many bugfixes, removal of phar.extract_list, compression API refactored, - conversion API refactored -Changes since 2.0.0b1: addition of phar.cache_list, many performance improvements and bugfixes - implement OpenSSL asynchronous true package signing - add support for package signing to tar-based archives - require PHP 5.2.1+ - - - - - 2.0.0RC2 - 1.1.1 - - - beta - beta - - 2009-06-04 - PHP License - -BC BREAKING RELEASE - BC breaks: - * Phar object Compression API is rewritten. Use Phar::compress() and decompress(), - Phar::compressFiles()/decompressFiles() and PharFileInfo->compress()/decompress(). - * phar.extract_list and Phar::getExtractList() are removed - -Major feature functionality release - * phar.cache_list allows web-based phar applications to run at equal or faster than - their on-disk equivalent [Greg] - * new default stub allows running of phar-based phars without phar extension [Greg/Steph] - * add support for tar-based and zip-based phar archives [Greg] - * add support for OpenSSL-based true signatures [Greg] - * add support for signatures to tar-based phar archives [Greg] - * add Phar::isFileFormat() [Greg] - * add Phar::convertToExecutable(), Phar::convertToData() [Greg] - * add Phar::compress() [Greg] - * rename Phar::compressAllFiles() to compressFiles(), uncompressAllFiles() to - decompressFiles() [Greg] - * conversion to compressed or to other file formats automatically copies the archive - to a new extension (i.e. ".phar" to ".phar.tar" or ".tar" to ".tar.gz") [Steph] - * add Phar::webPhar() for running a web-based application unmodified - directly from a phar archive [Greg] - * file functions (fopen-based and stat-based) can be instructed to only look for - relative paths within a phar via Phar::interceptFileFuncs() - * add PharData class to allow manipulation/creation of non-executable tar and zip archives. [Steph] - non-executable tar/zip manipulation is allowed even when phar.readonly=1 [Greg] - * paths with . and .. work (phar://blah.phar/a/../b.php => phar://blah.phar/b.php) [Greg] - * add support for mkdir()/rmdir() and support for empty directories to phar file format [Greg] - * add option to compress the entire phar file for phar/tar file format [Greg] - * implement Phar::isCompressed() returning 0, Phar::GZ or Phar::BZ2 [Greg] - * implement Phar::copy(string $from, string $to) [Greg] - * implement Phar::running(), returns path or URL to currently executed phar - * implement Phar::buildFromIterator(Iterator $it[, string $base_directory]) [Greg] - * implement Phar::buildFromDirectory(string $base_directory[, string $regex]) [Steph] - * implement Phar::mount() for mounting external paths or files to locations inside a phar [Greg] - * add Phar::delete() [Greg] - * implement Phar::unlinkArchive() [Greg] - -Security addition - * aliases are validated so that they contain no directory separators as intended - * on conversion to other formats, user-supplied aliases are validated - -Changes since 2.0.0RC1: - security vulnerability in handling of long tar filenames fixed - fixed PECL Bug #14646: phar error message unclear with php stream wrappers - fixed PECL Bug #16338: php_stream_copy_to_stream{,_ex}() - fixed PHP Bug #48257: PharData throws an exception with non-phar tar - fixed PHP Bug #47085: rename() returns true even if the file in PHAR does not exist - fixed PHP Bug #46032: PharData::__construct() - wrong memory read - fixed PHP Bug #46060: Phar::addEmptyDir() breaks - fixed PHP Bug #45907: undefined reference to 'PHP_SHA512Init' - fixed PHP Bug #45726: PHP_Archive / Archive.php missing -Changes since 2.0.0a2: many bugfixes, removal of phar.extract_list, compression API refactored, - conversion API refactored -Changes since 2.0.0b1: addition of phar.cache_list, many performance improvements and bugfixes - implement OpenSSL asynchronous true package signing - add support for package signing to tar-based archives - require PHP 5.2.1+ - - - - - 2.0.0RC1 - 1.1.1 - - - beta - beta - - 2008-08-31 - PHP License - -BC BREAKING RELEASE - BC breaks: - * Phar object Compression API is rewritten. Use Phar::compress() and decompress(), - Phar::compressFiles()/decompressFiles() and PharFileInfo->compress()/decompress(). - * phar.extract_list and Phar::getExtractList() are removed - -Major feature functionality release - * phar.cache_list allows web-based phar applications to run at equal or faster than - their on-disk equivalent [Greg] - * new default stub allows running of phar-based phars without phar extension [Greg/Steph] - * add support for tar-based and zip-based phar archives [Greg] - * add support for OpenSSL-based true signatures [Greg] - * add support for signatures to tar-based phar archives [Greg] - * add Phar::isFileFormat() [Greg] - * add Phar::convertToExecutable(), Phar::convertToData() [Greg] - * add Phar::compress() [Greg] - * rename Phar::compressAllFiles() to compressFiles(), uncompressAllFiles() to - decompressFiles() [Greg] - * conversion to compressed or to other file formats automatically copies the archive - to a new extension (i.e. ".phar" to ".phar.tar" or ".tar" to ".tar.gz") [Steph] - * add Phar::webPhar() for running a web-based application unmodified - directly from a phar archive [Greg] - * file functions (fopen-based and stat-based) can be instructed to only look for - relative paths within a phar via Phar::interceptFileFuncs() - * add PharData class to allow manipulation/creation of non-executable tar and zip archives. [Steph] - non-executable tar/zip manipulation is allowed even when phar.readonly=1 [Greg] - * paths with . and .. work (phar://blah.phar/a/../b.php => phar://blah.phar/b.php) [Greg] - * add support for mkdir()/rmdir() and support for empty directories to phar file format [Greg] - * add option to compress the entire phar file for phar/tar file format [Greg] - * implement Phar::isCompressed() returning 0, Phar::GZ or Phar::BZ2 [Greg] - * implement Phar::copy(string $from, string $to) [Greg] - * implement Phar::running(), returns path or URL to currently executed phar - * implement Phar::buildFromIterator(Iterator $it[, string $base_directory]) [Greg] - * implement Phar::buildFromDirectory(string $base_directory[, string $regex]) [Steph] - * implement Phar::mount() for mounting external paths or files to locations inside a phar [Greg] - * add Phar::delete() [Greg] - * implement Phar::unlinkArchive() [Greg] - -Security addition - * aliases are validated so that they contain no directory separators as intended - * on conversion to other formats, user-supplied aliases are validated - -Changes since 2.0.0a2: many bugfixes, removal of phar.extract_list, compression API refactored, - conversion API refactored -Changes since 2.0.0b1: addition of phar.cache_list, many performance improvements and bugfixes - implement OpenSSL asynchronous true package signing - add support for package signing to tar-based archives - require PHP 5.2.1+ - - - - - 2.0.0b1 - 1.1.1 - - - beta - beta - - 2008-05-12 - PHP License - -BC BREAKING RELEASE - BC breaks: - * Phar object Compression API is rewritten. Use Phar::compress() and decompress(), - Phar::compressFiles()/decompressFiles() and PharFileInfo->compress()/decompress(). - * phar.extract_list and Phar::getExtractList() are removed - -Major feature functionality release - * new default stub allows running of phar-based phars without phar extension [Greg/Steph] - * add support for tar-based and zip-based phar archives [Greg] - * add Phar::isFileFormat() [Greg] - * add Phar::convertToExecutable(), Phar::convertToData() [Greg] - * add Phar::compress() [Greg] - * rename Phar::compressAllFiles() to compressFiles(), uncompressAllFiles() to - decompressFiles() [Greg] - * conversion to compressed or to other file formats automatically copies the archive - to a new extension (i.e. ".phar" to ".phar.tar" or ".tar" to ".tar.gz") [Steph] - * add Phar::webPhar() for running a web-based application unmodified - directly from a phar archive [Greg] - * file functions (fopen-based and stat-based) can be instructed to only look for - relative paths within a phar via Phar::interceptFileFuncs() - * add PharData class to allow manipulation/creation of non-executable tar and zip archives. [Steph] - non-executable tar/zip manipulation is allowed even when phar.readonly=1 [Greg] - * paths with . and .. work (phar://blah.phar/a/../b.php => phar://blah.phar/b.php) [Greg] - * add support for mkdir()/rmdir() and support for empty directories to phar file format [Greg] - * add option to compress the entire phar file for phar/tar file format [Greg] - * implement Phar::isCompressed() returning 0, Phar::GZ or Phar::BZ2 [Greg] - * implement Phar::copy(string $from, string $to) [Greg] - * implement Phar::running(), returns path or URL to currently executed phar - * implement Phar::buildFromIterator(Iterator $it[, string $base_directory]) [Greg] - * implement Phar::buildFromDirectory(string $base_directory[, string $regex]) [Steph] - * implement Phar::mount() for mounting external paths or files to locations inside a phar [Greg] - * add Phar::delete() [Greg] - * implement Phar::unlinkArchive() [Greg] - -Security addition - * aliases are validated so that they contain no directory separators as intended - * on conversion to other formats, user-supplied aliases are validated - -Changes since 2.0.0a2: many bugfixes, removal of phar.extract_list, compression API refactored, - conversion API refactored - - - - - 2.0.0a2 - 1.1.1 - - - alpha - alpha - - 2008-03-27 - PHP License - -Major feature functionality release - * new default stub allows running of phar-based phars without phar extension [Greg/Steph] - * add support for tar-based and zip-based phar archives [Greg] - * add Phar::isTar(), Phar::isZip(), and Phar::isPhar() [Greg] - * add Phar::convertToTar(), Phar::convertToZip(), and Phar::convertToPhar() [Greg] - * add Phar::compress() [Greg] - * conversion to compressed or to other file formats automatically copies the archive - to a new extension (i.e. ".phar" to ".phar.tar" or ".tar" to ".tar.gz") [Steph] - * add Phar::webPhar() for running a web-based application unmodified - directly from a phar archive [Greg] - * file functions (fopen-based and stat-based) can be instructed to only look for - relative paths within a phar via Phar::interceptFileFuncs() - * add PharData class to allow manipulation/creation of non-executable tar and zip archives. [Steph] - non-executable tar/zip manipulation is allowed even when phar.readonly=1 [Greg] - * paths with . and .. work (phar://blah.phar/a/../b.php => phar://blah.phar/b.php) [Greg] - * add support for mkdir()/rmdir() and support for empty directories to phar file format [Greg] - * add option to compress the entire phar file for phar/tar file format [Greg] - * implement Phar::isCompressed() returning 0, Phar::GZ or Phar::BZ2 [Greg] - * implement Phar::copy(string $from, string $to) [Greg] - * implement Phar::buildFromIterator(Iterator $it[, string $base_directory]) [Greg] - * implement Phar::mount() for mounting external paths or files to locations inside a phar [Greg] - * add Phar::delete() [Greg] - -Changes since 2.0.0a1: fix build in PHP 5.2 - - - - - 2.0.0a1 - 1.1.1 - - - alpha - alpha - - 2008-03-26 - PHP License - -Major feature functionality release - * new default stub allows running of phar-based phars without phar extension [Greg/Steph] - * add support for tar-based and zip-based phar archives [Greg] - * add Phar::isTar(), Phar::isZip(), and Phar::isPhar() [Greg] - * add Phar::convertToTar(), Phar::convertToZip(), and Phar::convertToPhar() [Greg] - * add Phar::compress() [Greg] - * conversion to compressed or to other file formats automatically copies the archive - to a new extension (i.e. ".phar" to ".phar.tar" or ".tar" to ".tar.gz") [Steph] - * add Phar::webPhar() for running a web-based application unmodified - directly from a phar archive [Greg] - * file functions (fopen-based and stat-based) can be instructed to only look for - relative paths within a phar via Phar::interceptFileFuncs() - * add PharData class to allow manipulation/creation of non-executable tar and zip archives. [Steph] - non-executable tar/zip manipulation is allowed even when phar.readonly=1 [Greg] - * paths with . and .. work (phar://blah.phar/a/../b.php => phar://blah.phar/b.php) [Greg] - * add support for mkdir()/rmdir() and support for empty directories to phar file format [Greg] - * add option to compress the entire phar file for phar/tar file format [Greg] - * implement Phar::isCompressed() returning 0, Phar::GZ or Phar::BZ2 [Greg] - * implement Phar::copy(string $from, string $to) [Greg] - * implement Phar::buildFromIterator(Iterator $it[, string $base_directory]) [Greg] - * implement Phar::mount() for mounting external paths or files to locations inside a phar [Greg] - * add Phar::delete() [Greg] - - - - - 1.2.1 - 1.1.0 - - - stable - stable - - 2007-08-24 - PHP License - -* add Phar::setAlias() [Greg] -* fix too many open file handles issue [Greg] -* fix rename [Greg] -* add Phar::getAlias() [Marcus] -* Made -a optional in pack subcommand of phar.phar [Marcus] -* Fix issue with apache module and extracted archives [Marcus] -* Send all error messages to stderr in phar.phar [Marcus] -* Added new subcommands add and delete to phar.phar [Marcus] -* Made Phar::loadPhar() and Phar::mapPhar() ignore extracted archives [Marcus] -* Fix issue with compressed entries and uncompressing entries [Marcus] -* Verify stubs before writing [Marcus] -* Always use longest stub end to avoid issues with length field [Marcus] - - - - - 1.2.0 - 1.1.0 - - - stable - stable - - 2007-05-18 - PHP License - -* add PharFileInfo::hasMetadata(), PharFileInfo::delMetadata() [Marcus] -* add Phar::hasMetadata(), Phar::delMetadata() [Marcus] -* fix Phar::CanWrite() [Marcus] -* add preliminary phar command (phar.php) [Marcus] -* add phar command (phar.phar) [Marcus] -* list all available compression methods using Phar::getSupportedCompression() [Marcus] -* remove RINIT [Marcus] - - - - - 1.1.0 - 1.1.0 - - - stable - stable - - 2007-04-12 - PHP License - -* implement ability connect a phar file 'phar://whatever' to a directory. That way all - access to that phar archive are directed to the extracted directory. This - allows to have the installed files and the archive keep the same includes. - [Marcus] -* implement SHA-2 (256, 512) support [Marcus] -* implement setSignatureAlgorithm() and Phar::MD5 Phar::SHA1 Phar::SHA256 Phar::SHA512 Phar::PGP to - choose the kind of signature to use (PGP falls back to SHA1) [Greg] - - - - - 1.0.1 - 1.0.1 - - - stable - stable - - 2007-03-28 - PHP License - -* Fix return value of unlink() and rename() when used for phar archievs. [Marcus] - - - - - 1.0.0 - 1.0.0 - - - stable - stable - - 2007-03-26 - PHP License - -*BACKWARDS COMPATIBILITY BREAK* -Rename Phar->begin/isFlushingToPhar/commit to startBuffering/isBuffering/stopBuffering -Note that isBuffering() returns the opposite value to isFlushingToPhar() - - - - diff --git a/ext/phar/phar.c b/ext/phar/phar.c index 65ebce0f0856f..34ba5c692a9b9 100644 --- a/ext/phar/phar.c +++ b/ext/phar/phar.c @@ -27,7 +27,7 @@ static void destroy_phar_data(zval *zv); ZEND_DECLARE_MODULE_GLOBALS(phar) -zend_string *(*phar_save_resolve_path)(const char *filename, int filename_len); +zend_string *(*phar_save_resolve_path)(const char *filename, size_t filename_len); /** * set's phar->is_writeable based on the current INI value @@ -2202,9 +2202,9 @@ int phar_split_fname(const char *filename, int filename_len, char **arch, int *a ext_len = 0; #ifdef PHP_WIN32 - save = filename; + save = (char *)filename; filename = estrndup(filename, filename_len); - phar_unixify_path_separators(filename, filename_len); + phar_unixify_path_separators((char *)filename, filename_len); #endif if (phar_detect_phar_fname_ext(filename, filename_len, &ext_str, &ext_len, executable, for_create, 0) == FAILURE) { if (ext_len != -1) { @@ -2218,7 +2218,7 @@ int phar_split_fname(const char *filename, int filename_len, char **arch, int *a } #ifdef PHP_WIN32 - efree(filename); + efree((char *)filename); #endif return FAILURE; } @@ -2243,7 +2243,7 @@ int phar_split_fname(const char *filename, int filename_len, char **arch, int *a } #ifdef PHP_WIN32 - efree(filename); + efree((char *)filename); #endif return SUCCESS; @@ -3249,7 +3249,7 @@ static size_t phar_zend_stream_fsizer(void *handle) /* {{{ */ zend_op_array *(*phar_orig_compile_file)(zend_file_handle *file_handle, int type); #define phar_orig_zend_open zend_stream_open_function -static zend_string *phar_resolve_path(const char *filename, int filename_len) +static zend_string *phar_resolve_path(const char *filename, size_t filename_len) { return phar_find_in_include_path((char *) filename, filename_len, NULL); } diff --git a/ext/phar/phar_object.c b/ext/phar/phar_object.c index c3102039f04cd..46423246ddc1a 100644 --- a/ext/phar/phar_object.c +++ b/ext/phar/phar_object.c @@ -67,7 +67,7 @@ static void phar_mung_server_vars(char *fname, char *entry, int entry_len, char if (NULL != (stuff = zend_hash_str_find(_SERVER, "PATH_INFO", sizeof("PATH_INFO")-1))) { path_info = Z_STRVAL_P(stuff); code = Z_STRLEN_P(stuff); - if (code > entry_len && !memcmp(path_info, entry, entry_len)) { + if (code > (size_t)entry_len && !memcmp(path_info, entry, entry_len)) { ZVAL_STR(&temp, Z_STR_P(stuff)); ZVAL_STRINGL(stuff, path_info + entry_len, request_uri_len); zend_hash_str_update(_SERVER, "PHAR_PATH_INFO", sizeof("PHAR_PATH_INFO")-1, &temp); @@ -4164,7 +4164,7 @@ PHP_METHOD(Phar, delMetadata) } /* }}} */ -static int phar_extract_file(zend_bool overwrite, phar_entry_info *entry, char *dest, int dest_len, char **error) /* {{{ */ +static int phar_extract_file(zend_bool overwrite, phar_entry_info *entry, char *dest, size_t dest_len, char **error) /* {{{ */ { php_stream_statbuf ssb; size_t len; @@ -4206,13 +4206,13 @@ static int phar_extract_file(zend_bool overwrite, phar_entry_info *entry, char * #ifdef PHP_WIN32 /* unixify the path back, otherwise non zip formats might be broken */ { - int cnt = filename_len; + size_t cnt = 0; do { if ('\\' == filename[cnt]) { filename[cnt] = '/'; } - } while (cnt-- >= 0); + } while (cnt++ <= filename_len); } #endif @@ -4433,7 +4433,7 @@ PHP_METHOD(Phar, extractTo) zend_throw_exception_ex(phar_ce_PharException, 0, "Phar Error: attempted to extract non-existent file \"%s\" from phar \"%s\"", Z_STRVAL_P(zval_file), phar_obj->archive->fname); } - if (FAILURE == phar_extract_file(overwrite, entry, pathto, (int)pathto_len, &error)) { + if (FAILURE == phar_extract_file(overwrite, entry, pathto, pathto_len, &error)) { zend_throw_exception_ex(phar_ce_PharException, 0, "Extraction from phar \"%s\" failed: %s", phar_obj->archive->fname, error); efree(error); @@ -4454,7 +4454,7 @@ PHP_METHOD(Phar, extractTo) return; } - if (FAILURE == phar_extract_file(overwrite, entry, pathto, (int)pathto_len, &error)) { + if (FAILURE == phar_extract_file(overwrite, entry, pathto, pathto_len, &error)) { zend_throw_exception_ex(phar_ce_PharException, 0, "Extraction from phar \"%s\" failed: %s", phar_obj->archive->fname, error); efree(error); @@ -4470,7 +4470,7 @@ PHP_METHOD(Phar, extractTo) } ZEND_HASH_FOREACH_PTR(&phar->manifest, entry) { - if (FAILURE == phar_extract_file(overwrite, entry, pathto, (int)pathto_len, &error)) { + if (FAILURE == phar_extract_file(overwrite, entry, pathto, pathto_len, &error)) { zend_throw_exception_ex(phar_ce_PharException, 0, "Extraction from phar \"%s\" failed: %s", phar->fname, error); efree(error); diff --git a/ext/phar/stream.c b/ext/phar/stream.c index 97e1dc6b979d7..65eabd901b7ed 100644 --- a/ext/phar/stream.c +++ b/ext/phar/stream.c @@ -84,19 +84,21 @@ php_url* phar_parse_url(php_stream_wrapper *wrapper, const char *filename, const return NULL; } resource = ecalloc(1, sizeof(php_url)); - resource->scheme = estrndup("phar", 4); - resource->host = arch; + resource->scheme = zend_string_init("phar", 4, 0); + resource->host = zend_string_init(arch, arch_len, 0); + efree(arch); + resource->path = zend_string_init(entry, entry_len, 0); + efree(entry); - resource->path = entry; #if MBO_0 if (resource) { fprintf(stderr, "Alias: %s\n", alias); - fprintf(stderr, "Scheme: %s\n", resource->scheme); + fprintf(stderr, "Scheme: %s\n", ZSTR_VAL(resource->scheme)); /* fprintf(stderr, "User: %s\n", resource->user);*/ /* fprintf(stderr, "Pass: %s\n", resource->pass ? "***" : NULL);*/ - fprintf(stderr, "Host: %s\n", resource->host); + fprintf(stderr, "Host: %s\n", ZSTR_VAL(resource->host)); /* fprintf(stderr, "Port: %d\n", resource->port);*/ - fprintf(stderr, "Path: %s\n", resource->path); + fprintf(stderr, "Path: %s\n", ZSTR_VAL(resource->path)); /* fprintf(stderr, "Query: %s\n", resource->query);*/ /* fprintf(stderr, "Fragment: %s\n", resource->fragment);*/ } @@ -104,7 +106,7 @@ php_url* phar_parse_url(php_stream_wrapper *wrapper, const char *filename, const if (mode[0] == 'w' || (mode[0] == 'r' && mode[1] == '+')) { phar_archive_data *pphar = NULL, *phar; - if (PHAR_G(request_init) && PHAR_G(phar_fname_map.u.flags) && NULL == (pphar = zend_hash_str_find_ptr(&(PHAR_G(phar_fname_map)), arch, arch_len))) { + if (PHAR_G(request_init) && PHAR_G(phar_fname_map.u.flags) && NULL == (pphar = zend_hash_find_ptr(&(PHAR_G(phar_fname_map)), resource->host))) { pphar = NULL; } if (PHAR_G(readonly) && (!pphar || !pphar->is_data)) { @@ -114,7 +116,7 @@ php_url* phar_parse_url(php_stream_wrapper *wrapper, const char *filename, const php_url_free(resource); return NULL; } - if (phar_open_or_create_filename(resource->host, arch_len, NULL, 0, 0, options, &phar, &error) == FAILURE) + if (phar_open_or_create_filename(ZSTR_VAL(resource->host), ZSTR_LEN(resource->host), NULL, 0, 0, options, &phar, &error) == FAILURE) { if (error) { if (!(options & PHP_STREAM_URL_STAT_QUIET)) { @@ -127,7 +129,7 @@ php_url* phar_parse_url(php_stream_wrapper *wrapper, const char *filename, const } if (phar->is_persistent && FAILURE == phar_copy_on_write(&phar)) { if (error) { - spprintf(&error, 0, "Cannot open cached phar '%s' as writeable, copy on write failed", resource->host); + spprintf(&error, 0, "Cannot open cached phar '%s' as writeable, copy on write failed", ZSTR_VAL(resource->host)); if (!(options & PHP_STREAM_URL_STAT_QUIET)) { php_stream_wrapper_log_error(wrapper, options, "%s", error); } @@ -137,7 +139,7 @@ php_url* phar_parse_url(php_stream_wrapper *wrapper, const char *filename, const return NULL; } } else { - if (phar_open_from_filename(resource->host, arch_len, NULL, 0, options, NULL, &error) == FAILURE) + if (phar_open_from_filename(ZSTR_VAL(resource->host), ZSTR_LEN(resource->host), NULL, 0, options, NULL, &error) == FAILURE) { if (error) { if (!(options & PHP_STREAM_URL_STAT_QUIET)) { @@ -179,24 +181,24 @@ static php_stream * phar_wrapper_open_url(php_stream_wrapper *wrapper, const cha return NULL; } - if (strcasecmp("phar", resource->scheme)) { + if (!zend_string_equals_literal_ci(resource->scheme, "phar")) { php_url_free(resource); php_stream_wrapper_log_error(wrapper, options, "phar error: not a phar stream url \"%s\"", path); return NULL; } - host_len = strlen(resource->host); + host_len = ZSTR_LEN(resource->host); phar_request_initialize(); /* strip leading "/" */ - internal_file = estrdup(resource->path + 1); + internal_file = estrndup(ZSTR_VAL(resource->path) + 1, ZSTR_LEN(resource->path) - 1); if (mode[0] == 'w' || (mode[0] == 'r' && mode[1] == '+')) { - if (NULL == (idata = phar_get_or_create_entry_data(resource->host, host_len, internal_file, strlen(internal_file), mode, 0, &error, 1))) { + if (NULL == (idata = phar_get_or_create_entry_data(ZSTR_VAL(resource->host), host_len, internal_file, strlen(internal_file), mode, 0, &error, 1))) { if (error) { php_stream_wrapper_log_error(wrapper, options, "%s", error); efree(error); } else { - php_stream_wrapper_log_error(wrapper, options, "phar error: file \"%s\" could not be created in phar \"%s\"", internal_file, resource->host); + php_stream_wrapper_log_error(wrapper, options, "phar error: file \"%s\" could not be created in phar \"%s\"", internal_file, ZSTR_VAL(resource->host)); } efree(internal_file); php_url_free(resource); @@ -239,14 +241,14 @@ static php_stream * phar_wrapper_open_url(php_stream_wrapper *wrapper, const cha } else { if (!*internal_file && (options & STREAM_OPEN_FOR_INCLUDE)) { /* retrieve the stub */ - if (FAILURE == phar_get_archive(&phar, resource->host, host_len, NULL, 0, NULL)) { - php_stream_wrapper_log_error(wrapper, options, "file %s is not a valid phar archive", resource->host); + if (FAILURE == phar_get_archive(&phar, ZSTR_VAL(resource->host), host_len, NULL, 0, NULL)) { + php_stream_wrapper_log_error(wrapper, options, "file %s is not a valid phar archive", ZSTR_VAL(resource->host)); efree(internal_file); php_url_free(resource); return NULL; } if (phar->is_tar || phar->is_zip) { - if ((FAILURE == phar_get_entry_data(&idata, resource->host, host_len, ".phar/stub.php", sizeof(".phar/stub.php")-1, "r", 0, &error, 0)) || !idata) { + if ((FAILURE == phar_get_entry_data(&idata, ZSTR_VAL(resource->host), host_len, ".phar/stub.php", sizeof(".phar/stub.php")-1, "r", 0, &error, 0)) || !idata) { goto idata_error; } efree(internal_file); @@ -284,13 +286,13 @@ static php_stream * phar_wrapper_open_url(php_stream_wrapper *wrapper, const cha } } /* read-only access is allowed to magic files in .phar directory */ - if ((FAILURE == phar_get_entry_data(&idata, resource->host, host_len, internal_file, strlen(internal_file), "r", 0, &error, 0)) || !idata) { + if ((FAILURE == phar_get_entry_data(&idata, ZSTR_VAL(resource->host), host_len, internal_file, strlen(internal_file), "r", 0, &error, 0)) || !idata) { idata_error: if (error) { php_stream_wrapper_log_error(wrapper, options, "%s", error); efree(error); } else { - php_stream_wrapper_log_error(wrapper, options, "phar error: \"%s\" is not a file in phar \"%s\"", internal_file, resource->host); + php_stream_wrapper_log_error(wrapper, options, "phar error: \"%s\" is not a file in phar \"%s\"", internal_file, ZSTR_VAL(resource->host)); } efree(internal_file); php_url_free(resource); @@ -569,17 +571,17 @@ static int phar_wrapper_stat(php_stream_wrapper *wrapper, const char *url, int f return FAILURE; } - if (strcasecmp("phar", resource->scheme)) { + if (!zend_string_equals_literal_ci(resource->scheme, "phar")) { php_url_free(resource); return FAILURE; } - host_len = strlen(resource->host); + host_len = ZSTR_LEN(resource->host); phar_request_initialize(); - internal_file = resource->path + 1; /* strip leading "/" */ + internal_file = ZSTR_VAL(resource->path) + 1; /* strip leading "/" */ /* find the phar in our trusty global hash indexed by alias (host of phar://blah.phar/file.whatever) */ - if (FAILURE == phar_get_archive(&phar, resource->host, host_len, NULL, 0, &error)) { + if (FAILURE == phar_get_archive(&phar, ZSTR_VAL(resource->host), host_len, NULL, 0, &error)) { php_url_free(resource); if (error) { efree(error); @@ -679,16 +681,16 @@ static int phar_wrapper_unlink(php_stream_wrapper *wrapper, const char *url, int return 0; } - if (strcasecmp("phar", resource->scheme)) { + if (!zend_string_equals_literal_ci(resource->scheme, "phar")) { php_url_free(resource); php_stream_wrapper_log_error(wrapper, options, "phar error: not a phar stream url \"%s\"", url); return 0; } - host_len = strlen(resource->host); + host_len = ZSTR_LEN(resource->host); phar_request_initialize(); - pphar = zend_hash_str_find_ptr(&(PHAR_G(phar_fname_map)), resource->host, host_len); + pphar = zend_hash_find_ptr(&(PHAR_G(phar_fname_map)), resource->host); if (PHAR_G(readonly) && (!pphar || !pphar->is_data)) { php_url_free(resource); php_stream_wrapper_log_error(wrapper, options, "phar error: write operations disabled by the php.ini setting phar.readonly"); @@ -696,9 +698,9 @@ static int phar_wrapper_unlink(php_stream_wrapper *wrapper, const char *url, int } /* need to copy to strip leading "/", will get touched again */ - internal_file = estrdup(resource->path + 1); - internal_file_len = strlen(internal_file); - if (FAILURE == phar_get_entry_data(&idata, resource->host, host_len, internal_file, internal_file_len, "r", 0, &error, 1)) { + internal_file = estrndup(ZSTR_VAL(resource->path) + 1, ZSTR_LEN(resource->path) - 1); + internal_file_len = ZSTR_LEN(resource->path) - 1; + if (FAILURE == phar_get_entry_data(&idata, ZSTR_VAL(resource->host), host_len, internal_file, internal_file_len, "r", 0, &error, 1)) { /* constraints of fp refcount were not met */ if (error) { php_stream_wrapper_log_error(wrapper, options, "unlink of \"%s\" failed: %s", url, error); @@ -715,7 +717,7 @@ static int phar_wrapper_unlink(php_stream_wrapper *wrapper, const char *url, int } if (idata->internal_file->fp_refcount > 1) { /* more than just our fp resource is open for this file */ - php_stream_wrapper_log_error(wrapper, options, "phar error: \"%s\" in phar \"%s\", has open file pointers, cannot unlink", internal_file, resource->host); + php_stream_wrapper_log_error(wrapper, options, "phar error: \"%s\" in phar \"%s\", has open file pointers, cannot unlink", internal_file, ZSTR_VAL(resource->host)); efree(internal_file); php_url_free(resource); phar_entry_delref(idata); @@ -748,7 +750,7 @@ static int phar_wrapper_rename(php_stream_wrapper *wrapper, const char *url_from php_error_docref(NULL, E_WARNING, "phar error: cannot rename \"%s\" to \"%s\": invalid or non-writable url \"%s\"", url_from, url_to, url_from); return 0; } - if (SUCCESS != phar_get_archive(&pfrom, resource_from->host, strlen(resource_from->host), NULL, 0, &error)) { + if (SUCCESS != phar_get_archive(&pfrom, ZSTR_VAL(resource_from->host), ZSTR_LEN(resource_from->host), NULL, 0, &error)) { pfrom = NULL; if (error) { efree(error); @@ -765,7 +767,7 @@ static int phar_wrapper_rename(php_stream_wrapper *wrapper, const char *url_from php_error_docref(NULL, E_WARNING, "phar error: cannot rename \"%s\" to \"%s\": invalid or non-writable url \"%s\"", url_from, url_to, url_to); return 0; } - if (SUCCESS != phar_get_archive(&pto, resource_to->host, strlen(resource_to->host), NULL, 0, &error)) { + if (SUCCESS != phar_get_archive(&pto, ZSTR_VAL(resource_to->host), ZSTR_LEN(resource_to->host), NULL, 0, &error)) { if (error) { efree(error); } @@ -777,7 +779,7 @@ static int phar_wrapper_rename(php_stream_wrapper *wrapper, const char *url_from return 0; } - if (strcmp(resource_from->host, resource_to->host)) { + if (!zend_string_equals(resource_from->host, resource_to->host)) { php_url_free(resource_from); php_url_free(resource_to); php_error_docref(NULL, E_WARNING, "phar error: cannot rename \"%s\" to \"%s\", not within the same phar archive", url_from, url_to); @@ -799,23 +801,23 @@ static int phar_wrapper_rename(php_stream_wrapper *wrapper, const char *url_from return 0; } - if (strcasecmp("phar", resource_from->scheme)) { + if (!zend_string_equals_literal_ci(resource_from->scheme, "phar")) { php_url_free(resource_from); php_url_free(resource_to); php_error_docref(NULL, E_WARNING, "phar error: cannot rename \"%s\" to \"%s\": not a phar stream url \"%s\"", url_from, url_to, url_from); return 0; } - if (strcasecmp("phar", resource_to->scheme)) { + if (!zend_string_equals_literal_ci(resource_to->scheme, "phar")) { php_url_free(resource_from); php_url_free(resource_to); php_error_docref(NULL, E_WARNING, "phar error: cannot rename \"%s\" to \"%s\": not a phar stream url \"%s\"", url_from, url_to, url_to); return 0; } - host_len = strlen(resource_from->host); + host_len = ZSTR_LEN(resource_from->host); - if (SUCCESS != phar_get_archive(&phar, resource_from->host, host_len, NULL, 0, &error)) { + if (SUCCESS != phar_get_archive(&phar, ZSTR_VAL(resource_from->host), host_len, NULL, 0, &error)) { php_url_free(resource_from); php_url_free(resource_to); php_error_docref(NULL, E_WARNING, "phar error: cannot rename \"%s\" to \"%s\": %s", url_from, url_to, error); @@ -830,7 +832,7 @@ static int phar_wrapper_rename(php_stream_wrapper *wrapper, const char *url_from return 0; } - if (NULL != (entry = zend_hash_str_find_ptr(&(phar->manifest), resource_from->path+1, strlen(resource_from->path)-1))) { + if (NULL != (entry = zend_hash_str_find_ptr(&(phar->manifest), ZSTR_VAL(resource_from->path)+1, ZSTR_LEN(resource_from->path)-1))) { phar_entry_info new, *source; /* perform rename magic */ @@ -850,9 +852,9 @@ static int phar_wrapper_rename(php_stream_wrapper *wrapper, const char *url_from source = entry; /* add to the manifest, and then store the pointer to the new guy in entry */ - entry = zend_hash_str_add_mem(&(phar->manifest), resource_to->path+1, strlen(resource_to->path)-1, (void **)&new, sizeof(phar_entry_info)); + entry = zend_hash_str_add_mem(&(phar->manifest), ZSTR_VAL(resource_to->path)+1, ZSTR_LEN(resource_to->path)-1, (void **)&new, sizeof(phar_entry_info)); - entry->filename = estrdup(resource_to->path+1); + entry->filename = estrndup(ZSTR_VAL(resource_to->path)+1, ZSTR_LEN(resource_to->path)-1); if (FAILURE == phar_copy_entry_fp(source, entry, &error)) { php_url_free(resource_from); php_url_free(resource_to); @@ -866,7 +868,7 @@ static int phar_wrapper_rename(php_stream_wrapper *wrapper, const char *url_from entry->filename_len = strlen(entry->filename); is_dir = entry->is_dir; } else { - is_dir = zend_hash_str_exists(&(phar->virtual_dirs), resource_from->path+1, strlen(resource_from->path)-1); + is_dir = zend_hash_str_exists(&(phar->virtual_dirs), ZSTR_VAL(resource_from->path)+1, ZSTR_LEN(resource_from->path)-1); if (!is_dir) { /* file does not exist */ php_url_free(resource_from); @@ -882,19 +884,19 @@ static int phar_wrapper_rename(php_stream_wrapper *wrapper, const char *url_from Bucket *b; zend_string *str_key; zend_string *new_str_key; - uint32_t from_len = strlen(resource_from->path+1); - uint32_t to_len = strlen(resource_to->path+1); + uint32_t from_len = ZSTR_LEN(resource_from->path) - 1; + uint32_t to_len = ZSTR_LEN(resource_to->path) - 1; ZEND_HASH_FOREACH_BUCKET(&phar->manifest, b) { str_key = b->key; entry = Z_PTR(b->val); if (!entry->is_deleted && ZSTR_LEN(str_key) > from_len && - memcmp(ZSTR_VAL(str_key), resource_from->path+1, from_len) == 0 && + memcmp(ZSTR_VAL(str_key), ZSTR_VAL(resource_from->path)+1, from_len) == 0 && IS_SLASH(ZSTR_VAL(str_key)[from_len])) { new_str_key = zend_string_alloc(ZSTR_LEN(str_key) + to_len - from_len, 0); - memcpy(ZSTR_VAL(new_str_key), resource_to->path + 1, to_len); + memcpy(ZSTR_VAL(new_str_key), ZSTR_VAL(resource_to->path) + 1, to_len); memcpy(ZSTR_VAL(new_str_key) + to_len, ZSTR_VAL(str_key) + from_len, ZSTR_LEN(str_key) - from_len); ZSTR_VAL(new_str_key)[ZSTR_LEN(new_str_key)] = 0; @@ -915,11 +917,11 @@ static int phar_wrapper_rename(php_stream_wrapper *wrapper, const char *url_from ZEND_HASH_FOREACH_BUCKET(&phar->virtual_dirs, b) { str_key = b->key; if (ZSTR_LEN(str_key) >= from_len && - memcmp(ZSTR_VAL(str_key), resource_from->path+1, from_len) == 0 && + memcmp(ZSTR_VAL(str_key), ZSTR_VAL(resource_from->path)+1, from_len) == 0 && (ZSTR_LEN(str_key) == from_len || IS_SLASH(ZSTR_VAL(str_key)[from_len]))) { new_str_key = zend_string_alloc(ZSTR_LEN(str_key) + to_len - from_len, 0); - memcpy(ZSTR_VAL(new_str_key), resource_to->path + 1, to_len); + memcpy(ZSTR_VAL(new_str_key), ZSTR_VAL(resource_to->path) + 1, to_len); memcpy(ZSTR_VAL(new_str_key) + to_len, ZSTR_VAL(str_key) + from_len, ZSTR_LEN(str_key) - from_len); ZSTR_VAL(new_str_key)[ZSTR_LEN(new_str_key)] = 0; @@ -933,11 +935,11 @@ static int phar_wrapper_rename(php_stream_wrapper *wrapper, const char *url_from ZEND_HASH_FOREACH_BUCKET(&phar->mounted_dirs, b) { str_key = b->key; if (ZSTR_LEN(str_key) >= from_len && - memcmp(ZSTR_VAL(str_key), resource_from->path+1, from_len) == 0 && + memcmp(ZSTR_VAL(str_key), ZSTR_VAL(resource_from->path)+1, from_len) == 0 && (ZSTR_LEN(str_key) == from_len || IS_SLASH(ZSTR_VAL(str_key)[from_len]))) { new_str_key = zend_string_alloc(ZSTR_LEN(str_key) + to_len - from_len, 0); - memcpy(ZSTR_VAL(new_str_key), resource_to->path + 1, to_len); + memcpy(ZSTR_VAL(new_str_key), ZSTR_VAL(resource_to->path) + 1, to_len); memcpy(ZSTR_VAL(new_str_key) + to_len, ZSTR_VAL(str_key) + from_len, ZSTR_LEN(str_key) - from_len); ZSTR_VAL(new_str_key)[ZSTR_LEN(new_str_key)] = 0; diff --git a/ext/phar/zip.c b/ext/phar/zip.c index 08417bc07b03d..573de4f25d047 100644 --- a/ext/phar/zip.c +++ b/ext/phar/zip.c @@ -167,7 +167,7 @@ int phar_parse_zipfile(php_stream *fp, char *fname, int fname_len, char *alias, { phar_zip_dir_end locator; char buf[sizeof(locator) + 65536]; - size_t size; + zend_off_t size; uint16_t i; phar_archive_data *mydata = NULL; phar_entry_info entry = {0}; @@ -199,7 +199,7 @@ int phar_parse_zipfile(php_stream *fp, char *fname, int fname_len, char *alias, } while ((p=(char *) memchr(p + 1, 'P', (size_t) (size - (p + 1 - buf)))) != NULL) { - if ((p - buf) + sizeof(locator) <= size && !memcmp(p + 1, "K\5\6", 3)) { + if ((p - buf) + sizeof(locator) <= (size_t)size && !memcmp(p + 1, "K\5\6", 3)) { memcpy((void *)&locator, (void *) p, sizeof(locator)); if (PHAR_GET_16(locator.centraldisk) != 0 || PHAR_GET_16(locator.disknumber) != 0) { /* split archives not handled */ diff --git a/ext/posix/package.xml b/ext/posix/package.xml deleted file mode 100644 index 231c5bee20201..0000000000000 --- a/ext/posix/package.xml +++ /dev/null @@ -1,49 +0,0 @@ - - - - pcntl - Process control functions - - - ??? - Jason Greene - jason@inetgurus.net - lead - - - -Process Control support in PHP implements the Unix style -of process creation, program execution, signal handling -and process termination. Process Control should not be -enabled within a webserver environment and unexpected -results may happen if any Process Control functions -are used within a webserver environment. - - PHP - - beta - 5.0.0rc1 - 2004-03-19 - -package.xml added to support installation using pear installer - - - - - - - - - - - - - - - - - - - diff --git a/ext/readline/tests/readline_read_history_open_basedir_001.phpt b/ext/readline/tests/readline_read_history_open_basedir_001.phpt new file mode 100644 index 0000000000000..6b8ecce3a91de --- /dev/null +++ b/ext/readline/tests/readline_read_history_open_basedir_001.phpt @@ -0,0 +1,17 @@ +--TEST-- +readline_read_history(): Test that open_basedir is respected +--SKIPIF-- + +--INI-- +open_basedir=/tmp/some-sandbox +--FILE-- + +--EXPECTF-- +Warning: readline_read_history(): open_basedir restriction in effect. File(/tmp/out-of-sandbox) is not within the allowed path(s): (/tmp/some-sandbox) in %s on line %d +bool(false) \ No newline at end of file diff --git a/ext/readline/tests/readline_write_history_open_basedir_001.phpt b/ext/readline/tests/readline_write_history_open_basedir_001.phpt new file mode 100644 index 0000000000000..bd7880bb9b240 --- /dev/null +++ b/ext/readline/tests/readline_write_history_open_basedir_001.phpt @@ -0,0 +1,17 @@ +--TEST-- +readline_write_history(): Test that open_basedir is respected +--SKIPIF-- + +--INI-- +open_basedir=/tmp/some-sandbox +--FILE-- + +--EXPECTF-- +Warning: readline_write_history(): open_basedir restriction in effect. File(/tmp/out-of-sandbox) is not within the allowed path(s): (/tmp/some-sandbox) in %s on line %d +bool(false) \ No newline at end of file diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c index a87ecddae4ba3..6c8efe21c2ed3 100644 --- a/ext/reflection/php_reflection.c +++ b/ext/reflection/php_reflection.c @@ -214,7 +214,7 @@ static void _fix_closure_prototype(zend_function *fptr) /* {{{ */ { /* Actually we are setting proxy function's prototype to null * as for it, the prototype is an object not a function - * which could cause serias problems, see #74949 */ + * which could cause serious problems, see #74949 */ fptr->common.prototype = NULL; } /* }}} */ diff --git a/ext/session/package.xml b/ext/session/package.xml deleted file mode 100644 index 03fcbf66daf8b..0000000000000 --- a/ext/session/package.xml +++ /dev/null @@ -1,83 +0,0 @@ - - - - session - Session handling functions - - - sascha - Sascha Schumann - sas@php.net - lead - - - andrei - Andrei Zmievski - andrei@php.net - lead - - - -Session support in PHP consists of a way to preserve certain data -across subsequent accesses. This enables you to build more customized -applications and increase the appeal of your web site. - - PHP - - beta - 5.0.0rc1 - 2004-03-19 - -package.xml added to support installation using pear installer - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/ext/session/session.c b/ext/session/session.c index 2ae78bdf06736..a2642807ad44d 100644 --- a/ext/session/session.c +++ b/ext/session/session.c @@ -770,7 +770,7 @@ static PHP_INI_MH(OnUpdateLazyWrite) /* {{{ */ static PHP_INI_MH(OnUpdateRfc1867Freq) /* {{{ */ { int tmp; - tmp = zend_atoi(ZSTR_VAL(new_value), (int)ZSTR_LEN(new_value)); + tmp = zend_atoi(ZSTR_VAL(new_value), ZSTR_LEN(new_value)); if(tmp < 0) { php_error_docref(NULL, E_WARNING, "session.upload_progress.freq must be greater than or equal to zero"); return FAILURE; @@ -2044,6 +2044,11 @@ static PHP_FUNCTION(session_id) RETURN_FALSE; } + if (name && PS(session_status) == php_session_active) { + php_error_docref(NULL, E_WARNING, "Cannot change session id when session is active"); + RETURN_FALSE; + } + if (PS(id)) { /* keep compatibility for "\0" characters ??? * see: ext/session/tests/session_id_error3.phpt */ diff --git a/ext/session/tests/session_id_error2.phpt b/ext/session/tests/session_id_error2.phpt index 05284e797befa..0d256564b6222 100644 --- a/ext/session/tests/session_id_error2.phpt +++ b/ext/session/tests/session_id_error2.phpt @@ -7,20 +7,20 @@ Test session_id() function : error functionality ob_start(); -/* +/* * Prototype : string session_id([string $id]) * Description : Get and/or set the current session id - * Source code : ext/session/session.c + * Source code : ext/session/session.c */ echo "*** Testing session_id() : error functionality ***\n"; -var_dump(session_id()); -var_dump(session_start()); var_dump(session_id("test")); var_dump(session_id()); var_dump(session_id("1234567890")); var_dump(session_id()); +var_dump(session_start()); +var_dump(session_id("1234567890")); var_dump(session_destroy()); var_dump(session_id()); @@ -30,12 +30,13 @@ ob_end_flush(); --EXPECTF-- *** Testing session_id() : error functionality *** string(0) "" -bool(true) -string(%d) "%s" string(4) "test" string(4) "test" string(10) "1234567890" bool(true) + +Warning: session_id(): Cannot change session id when session is active in %s on line %d +bool(false) +bool(true) string(0) "" Done - diff --git a/ext/session/tests/session_id_error3.phpt b/ext/session/tests/session_id_error3.phpt index fc291389d9e2e..e6404eb70e532 100644 --- a/ext/session/tests/session_id_error3.phpt +++ b/ext/session/tests/session_id_error3.phpt @@ -15,40 +15,40 @@ ob_start(); echo "*** Testing session_id() : error functionality ***\n"; -@session_start(); var_dump(session_id()); var_dump(session_id("!")); var_dump(session_id()); +@session_start(); @session_destroy(); -@session_start(); var_dump(session_id()); var_dump(session_id("?><")); var_dump(session_id()); +@session_start(); @session_destroy(); -@session_start(); var_dump(session_id()); -var_dump(session_id("£$%^&*()")); +var_dump(session_id("\xa3$%^&*()")); var_dump(session_id()); +@session_start(); @session_destroy(); -@session_start(); var_dump(session_id()); var_dump(session_id("\r\n")); var_dump(session_id()); +@session_start(); @session_destroy(); -@session_start(); var_dump(session_id()); var_dump(session_id("\0")); var_dump(session_id()); +@session_start(); @session_destroy(); -@session_start(); var_dump(session_id()); -var_dump(session_id("¬``@~:{>?><,./[]+--")); +var_dump(session_id("\xac``@~:{>?><,./[]+--")); var_dump(session_id()); +@session_start(); @session_destroy(); echo "Done"; @@ -56,24 +56,24 @@ ob_end_flush(); ?> --EXPECTF-- *** Testing session_id() : error functionality *** -string(%d) "%s" -string(%d) "%s" +string(0) "" +string(0) "" string(1) "!" -string(%d) "%s" -string(%d) "%s" +string(0) "" +string(0) "" string(3) "?><" -string(%d) "%s" -string(%d) "%s" +string(0) "" +string(0) "" string(8) "£$%^&*()" -string(%d) "%s" -string(%d) "%s" +string(0) "" +string(0) "" string(2) " " -string(%d) "%s" -string(%d) "%s" string(0) "" -string(%d) "%s" -string(%d) "%s" +string(0) "" +string(0) "" +string(0) "" +string(0) "" string(19) "¬``@~:{>?><,./[]+--" Done diff --git a/ext/shmop/package.xml b/ext/shmop/package.xml deleted file mode 100644 index 669da64bcffc3..0000000000000 --- a/ext/shmop/package.xml +++ /dev/null @@ -1,46 +0,0 @@ - - - - shmop - Portable shared memory access - - - iliaa - Ilia Alshanetsky - ilia@prohost.org - lead - - - Slava Poliakov - hackie@prohost.org - developer - - - - Portable Shared Memory access - - PHP - - stable - 5.0.0rc1 - 2004-03-19 - -package.xml added to support installation using pear installer - - - - - - - - - - - - - - - - diff --git a/ext/shmop/package2.xml b/ext/shmop/package2.xml deleted file mode 100644 index a8b00f371c35c..0000000000000 --- a/ext/shmop/package2.xml +++ /dev/null @@ -1,56 +0,0 @@ - - - shmop - pecl.php.net - Portable shared memory access - Portable Shared Memory access - - - Ilia Alshanetsky - iliaa - ilia@prohost.org - yes - - 2007-07-03 - - - 5.0.0rc1 - 5.0.0rc1 - - - stable - stable - - PHP - package.xml added to support installation using pear installer - - - - - - - - - - - - - - - - - - - 5 - - - 1.4.0b1 - - - - shmop - - diff --git a/ext/simplexml/simplexml.c b/ext/simplexml/simplexml.c index 0ec2c86f4a629..92d180cf8b056 100644 --- a/ext/simplexml/simplexml.c +++ b/ext/simplexml/simplexml.c @@ -1133,14 +1133,12 @@ static HashTable *sxe_get_prop_hash(zval *object, int is_debug) /* {{{ */ sxe = Z_SXEOBJ_P(object); if (is_debug) { - ALLOC_HASHTABLE(rv); - zend_hash_init(rv, 0, NULL, ZVAL_PTR_DTOR, 0); + rv = zend_new_array(0); } else if (sxe->properties) { zend_hash_clean(sxe->properties); rv = sxe->properties; } else { - ALLOC_HASHTABLE(rv); - zend_hash_init(rv, 0, NULL, ZVAL_PTR_DTOR, 0); + rv = zend_new_array(0); sxe->properties = rv; } diff --git a/ext/skeleton/CREDITS b/ext/skeleton/CREDITS deleted file mode 100644 index 58fc71019ae2e..0000000000000 --- a/ext/skeleton/CREDITS +++ /dev/null @@ -1 +0,0 @@ -extname \ No newline at end of file diff --git a/ext/skeleton/EXPERIMENTAL b/ext/skeleton/EXPERIMENTAL deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/ext/skeleton/config.m4.in b/ext/skeleton/config.m4.in new file mode 100644 index 0000000000000..fe2a1c48ededb --- /dev/null +++ b/ext/skeleton/config.m4.in @@ -0,0 +1,7 @@ +PHP_ARG_ENABLE(%EXTNAME%, whether to enable %EXTNAME% support, +[ --enable-%EXTNAME% Enable %EXTNAME% support], no) + +if test "$PHP_%EXTNAMECAPS%" != "no"; then + AC_DEFINE(HAVE_%EXTNAMECAPS%, 1, [ Have %EXTNAME% support ]) + PHP_NEW_EXTENSION(%EXTNAME%, %EXTNAME%.c, $ext_shared) +fi diff --git a/ext/skeleton/config.w32.in b/ext/skeleton/config.w32.in new file mode 100644 index 0000000000000..41592624965a2 --- /dev/null +++ b/ext/skeleton/config.w32.in @@ -0,0 +1,7 @@ +ARG_ENABLE('%EXTNAME%', '%EXTNAME% support', 'no'); + +if (PHP_%EXTNAMECAPS% != 'no') { + AC_DEFINE('HAVE_%EXTNAMECAPS%', 1, '%EXTNAME% support enabled'); + + EXTENSION('%EXTNAME%', '%EXTNAME%.c', null, '/DZEND_ENABLE_STATIC_TSRMLS_CACHE=1'); +} \ No newline at end of file diff --git a/ext/skeleton/create_stubs b/ext/skeleton/create_stubs deleted file mode 100755 index fe79d6a29c514..0000000000000 --- a/ext/skeleton/create_stubs +++ /dev/null @@ -1,289 +0,0 @@ -#!/usr/bin/awk -f - -function gobble(s, x) -{ - sub(/^ /, "", line) - match(line, "^" "(" s ")") - x = substr(line, 1, RLENGTH) - line = substr(line, RLENGTH+1) - return x -} - -function convert(i, j, t) -{ - type = argtypes[i,j] - name = argnames[i,j] - opt = optionals[i,j] - tabs = x = "" - - for (i = 0; i < t; i++) { tabs = tabs "\t" } - - if (type == "int" || type == "long") { - longs = longs "\tzend_long " name ";\n" - } else if (type == "bool" || type == "boolean") { - bools = bools "\tzend_bool " name ";\n" - } else if (type == "double" || type == "float") { - doubles = doubles "\tdouble " name ";\n" - } else if (type == "string") { - strings = strings "\tchar *" name " = NULL;\n" - ints = ints "\tsize_t " name "_len;\n" - } else if (type == "array" || type == "object" || type == "mixed") { - zvals = zvals "\tzval *" name " = NULL;\n" - } else if (type == "resource" || type == "handle") { - zvals = zvals "\tzval *" name " = NULL;\n" - resources = resources "\tif (" name ") {\n" \ - "\t\tZEND_FETCH_RESOURCE(???, ???, " name ", " name "_id, \"???\", ???_rsrc_id);\n\t}\n" - ints = ints "\tint " name "_id = -1;\n" - } -} - -function comment(s) -{ - if (i_know_what_to_do_shut_up_i_dont_need_your_help_mode) { - return - } else { - return s - } -} - -BEGIN { - name = "[_A-Za-z][_A-Za-z0-9]*" - type = "int|long|double|float|string|bool|boolean|array|object|resource|handle|mixed|void" - spec = "l|l|d|d|s|b|b|a|o|r|r|z|" - num_funcs = 0 - -# create a map from type name to the spec - split(type, type_array, "\|") - split(spec, spec_array, "\|") - for (i in type_array) { - spec_map[type_array[i]] = spec_array[i] - } - - if (xml && xml != "yes") { - xmldoc = xml - } else { - xmldoc = extname "/" extname ".xml" - } - - - xmlhead = "\n" \ - "\n" \ - " \n" \ - " functions\n" \ - " \n\n" \ - " \n" \ - " &warn.experimental;\n" \ - " \n" \ - " \n" \ - " \n\n"; - - xmlfoot = " \n\n" \ - "\n" -} - -{ - args_max = args_min = optional = i = spec_opt = 0 - line = $0 - spec_str = "\"" - -## php extension must use lower case function names. -## this will translate any capitalized letter to lowercase -## and warn the user - if (match(func_name,"[A-Z]") != 0) { - printf("NOTICE: lower casing function name '%s'\n",func_name) - func_name = tolower(func_name) - } - func_type = gobble(type); - func_name = gobble(name); - - if (gobble("\\(")) { - if (gobble("\\[")) optional = 1 - while (arg_type = gobble(type)) { - arg_name = gobble(name) - if(arg_type == "void") { - args_max = 0; - args_min = 0; - break; - } else { - argtypes[num_funcs,args_max] = arg_type - argnames[num_funcs,args_max] = arg_name - - args_max++ - if (optional) { - if (!spec_opt) { - spec_str = spec_str "|" - spec_opt = 1 - } - optionals[num_funcs,i] = optional - } else { - args_min++ - } - spec_str = spec_str spec_map[arg_type] - - if (x = gobble("\\[")) { - optional++ - } - - y = gobble(",") - if (!x && y && optional) { - grouped_optional_param[num_funcs,i] = 1 - } - i++ - } - } - } - -# if (x = gobble("\\)")) { - gobble("\\]* *\\)") - sub(/^[ \t]+/, "", line) - fcomments[num_funcs] = line -# } - - spec_str = spec_str "\"" - - funcs[num_funcs] = func_name - types[num_funcs] = func_type - maxargs[num_funcs] = args_max - minargs[num_funcs] = args_min - specs[num_funcs] = spec_str - spec_opts[num_funcs] = spec_opt - - num_funcs++ -} - -END { - if (xml) print xmlhead > xmldoc - for (i = 0; i < num_funcs; i++) { - compareargc = maxargs[i] - minargs[i] - closefetch = fetchargs = zvals = xmlparams = funcvals = resources = handleargs = closeopts = "" - ints = longs = doubles = strings = bools = zvals = "" - - proto = "/* {{{ proto " types[i] " " funcs[i] "(" - - refid = funcs[i] - gsub(/_/, "-", refid) - xmlstr = " \n" \ - " \n" \ - " " funcs[i] "\n" \ - " " fcomments[i] "\n" \ - " \n" \ - " \n" \ - " Description\n" \ - " \n" \ - " \n" \ - " " types[i] " " funcs[i] "\n" - - if (maxargs[i]>0) { - fetchargs = "\tif (zend_parse_parameters(" - ints = ints "\tint argc = ZEND_NUM_ARGS();\n" - fetchargs = fetchargs "argc, " specs[i] - } else { - fetchargs = fetchargs "\tif (zend_parse_parameters_none() == FAILURE) {\n\t\treturn;\n\t}" - xmlparams = xmlparams " \n" - } - - for (j = 0; j < maxargs[i]; j++) { - - fetchargs = fetchargs ", " - - fetchargs = fetchargs "&" argnames[i,j] - if (argtypes[i,j] == "string") { - fetchargs = fetchargs ", &" argnames[i,j] "_len" - } - - xmlparams = xmlparams " " argtypes[i,j] - if (j > minargs[i]-1) { - if (!grouped_optional_param[i,j-1]) { - if (j > 0) proto = proto " " - proto = proto "[" - closeopts = closeopts "]" - } - xmlparams = xmlparams "\n " \ - argnames[i,j] \ - "\n \n" - } else { - xmlparams = xmlparams \ - " " \ - argnames[i,j] \ - "\n" - } - - if (j > 0) proto = proto ", " - proto = proto argtypes[i,j] " " argnames[i,j] - - convert(i, j, 1) - } - - proto = proto closeopts ")\n " fcomments[i] " */\nPHP_FUNCTION(" funcs[i] ")\n{" - if (maxargs[i]>0) { - fetchargs = fetchargs ") == FAILURE)" closefetch " \n\t\treturn;\n" - } - funcvals = strings ints longs doubles bools zvals - xmlstr = xmlstr xmlparams \ - " \n" \ - " \n" \ - " &warn.experimental.func;\n" \ - " \n" \ - " &warn.undocumented.func;\n" \ - " \n" \ - " \n" \ - " \n" - - print proto > stubfile - if (funcvals) print funcvals > stubfile - if (fetchargs) print fetchargs > stubfile - if (resources) { - print resources > stubfile - if (!stubs) print "" > ( extname "/function_warning" ) - } - if (!i_know_what_to_do_shut_up_i_dont_need_your_help_mode) { - print "\tphp_error(E_WARNING, \"" funcs[i] ": not yet implemented\");" > stubfile - } - print "}\n/* }}} */\n" > stubfile - - if (stubs) { - h_stubs = h_stubs "PHP_FUNCTION(" funcs[i] ");\n" - c_stubs = c_stubs "\tPHP_FE(" funcs[i] ",\tNULL)\n" - } else { - print "PHP_FUNCTION(" funcs[i] ");" > ( extname "/function_declarations" ) - print "\tPHP_FE(" funcs[i] ",\tNULL)" > ( extname "/function_entries" ) - } - - if (xml) print xmlstr > xmldoc - } - - if (stubs) { - print "\n/* ----------------------------------------------------------- */\n" > stubfile - print c_stubs > stubfile - print "\n/* ----------------------------------------------------------- */\n" > stubfile - print h_stubs > stubfile - } - - if (xml) print xmlfoot > xmldoc -} - -# -# Local variables: -# tab-width: 2 -# c-basic-offset: 2 -# End: - diff --git a/ext/skeleton/php_skeleton.h b/ext/skeleton/php_skeleton.h index 1514563a70d1a..542bc915482c1 100644 --- a/ext/skeleton/php_skeleton.h +++ b/ext/skeleton/php_skeleton.h @@ -1,45 +1,16 @@ -/* __header_here__ */ +%HEADER% -#ifndef PHP_EXTNAME_H -#define PHP_EXTNAME_H +#ifndef PHP_%EXTNAMECAPS%_H +# define PHP_%EXTNAMECAPS%_H -extern zend_module_entry extname_module_entry; -#define phpext_extname_ptr &extname_module_entry +extern zend_module_entry %EXTNAME%_module_entry; +# define phpext_%EXTNAME%_ptr &%EXTNAME%_module_entry -#define PHP_EXTNAME_VERSION "0.1.0" /* Replace with version number for your extension */ +# define PHP_%EXTNAMECAPS%_VERSION "0.1.0" -#ifdef PHP_WIN32 -# define PHP_EXTNAME_API __declspec(dllexport) -#elif defined(__GNUC__) && __GNUC__ >= 4 -# define PHP_EXTNAME_API __attribute__ ((visibility("default"))) -#else -# define PHP_EXTNAME_API -#endif - -#ifdef ZTS -#include "TSRM.h" -#endif - -/* - Declare any global variables you may need between the BEGIN - and END macros here: - -ZEND_BEGIN_MODULE_GLOBALS(extname) - zend_long global_value; - char *global_string; -ZEND_END_MODULE_GLOBALS(extname) -*/ - -/* Always refer to the globals in your function as EXTNAME_G(variable). - You are encouraged to rename these macros something shorter, see - examples in any other php module directory. -*/ -#define EXTNAME_G(v) ZEND_MODULE_GLOBALS_ACCESSOR(extname, v) - -#if defined(ZTS) && defined(COMPILE_DL_EXTNAME) +# if defined(ZTS) && defined(COMPILE_DL_%EXTNAMECAPS%) ZEND_TSRMLS_CACHE_EXTERN() -#endif - -#endif /* PHP_EXTNAME_H */ +# endif -/* __footer_here__ */ +#endif /* PHP_%EXTNAMECAPS%_H */ +%FOOTER% \ No newline at end of file diff --git a/ext/skeleton/skeleton.c b/ext/skeleton/skeleton.c index 50f3271e20916..5e674c15c143e 100644 --- a/ext/skeleton/skeleton.c +++ b/ext/skeleton/skeleton.c @@ -1,168 +1,103 @@ -/* __header_here__ */ +%HEADER% #ifdef HAVE_CONFIG_H -#include "config.h" +# include "config.h" #endif #include "php.h" -#include "php_ini.h" #include "ext/standard/info.h" -#include "php_extname.h" +#include "php_%EXTNAME%.h" -/* If you declare any globals in php_extname.h uncomment this: -ZEND_DECLARE_MODULE_GLOBALS(extname) -*/ - -/* True global resources - no need for thread safety here */ -static int le_extname; - -/* {{{ PHP_INI +/* {{{ void %EXTNAME%_test1() */ -/* Remove comments and fill if you need to have entries in php.ini -PHP_INI_BEGIN() - STD_PHP_INI_ENTRY("extname.global_value", "42", PHP_INI_ALL, OnUpdateLong, global_value, zend_extname_globals, extname_globals) - STD_PHP_INI_ENTRY("extname.global_string", "foobar", PHP_INI_ALL, OnUpdateString, global_string, zend_extname_globals, extname_globals) -PHP_INI_END() -*/ -/* }}} */ - -/* Remove the following function when you have successfully modified config.m4 - so that your module can be compiled into PHP, it exists only for testing - purposes. */ - -/* Every user-visible function in PHP should document itself in the source */ -/* {{{ proto string confirm_extname_compiled(string arg) - Return a string to confirm that the module is compiled in */ -PHP_FUNCTION(confirm_extname_compiled) +PHP_FUNCTION(%EXTNAME%_test1) { - char *arg = NULL; - size_t arg_len, len; - zend_string *strg; + ZEND_PARSE_PARAMETERS_NONE(); - if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &arg, &arg_len) == FAILURE) { - return; - } - - strg = strpprintf(0, "Congratulations! You have successfully modified ext/%.78s/config.m4. Module %.78s is now compiled into PHP.", "extname", arg); - - RETURN_STR(strg); + php_printf("The extension %s is loaded and working!\r\n", "%EXTNAME%"); } /* }}} */ -/* The previous line is meant for vim and emacs, so it can correctly fold and - unfold functions in source code. See the corresponding marks just before - function definition, where the functions purpose is also documented. Please - follow this convention for the convenience of others editing your code. -*/ -/* __function_stubs_here__ */ - -/* {{{ php_extname_init_globals +/* {{{ string %EXTNAME%_test2( [ string $var ] ) */ -/* Uncomment this function if you have INI entries -static void php_extname_init_globals(zend_extname_globals *extname_globals) +PHP_FUNCTION(%EXTNAME%_test2) { - extname_globals->global_value = 0; - extname_globals->global_string = NULL; -} -*/ -/* }}} */ + char *var = "World"; + size_t var_len = sizeof("World") - 1; + zend_string *retval; -/* {{{ PHP_MINIT_FUNCTION - */ -PHP_MINIT_FUNCTION(extname) -{ - /* If you have INI entries, uncomment these lines - REGISTER_INI_ENTRIES(); - */ - return SUCCESS; -} -/* }}} */ + ZEND_PARSE_PARAMETERS_START(0, 1) + Z_PARAM_OPTIONAL + Z_PARAM_STRING(var, var_len) + ZEND_PARSE_PARAMETERS_END(); -/* {{{ PHP_MSHUTDOWN_FUNCTION - */ -PHP_MSHUTDOWN_FUNCTION(extname) -{ - /* uncomment this line if you have INI entries - UNREGISTER_INI_ENTRIES(); - */ - return SUCCESS; + retval = strpprintf(0, "Hello %s", var); + + RETURN_STR(retval); } -/* }}} */ +/* }}}*/ -/* Remove if there's nothing to do at request start */ /* {{{ PHP_RINIT_FUNCTION */ -PHP_RINIT_FUNCTION(extname) +PHP_RINIT_FUNCTION(%EXTNAME%) { -#if defined(COMPILE_DL_EXTNAME) && defined(ZTS) +#if defined(ZTS) && defined(COMPILE_DL_%EXTNAMECAPS%) ZEND_TSRMLS_CACHE_UPDATE(); #endif - return SUCCESS; -} -/* }}} */ -/* Remove if there's nothing to do at request end */ -/* {{{ PHP_RSHUTDOWN_FUNCTION - */ -PHP_RSHUTDOWN_FUNCTION(extname) -{ return SUCCESS; } /* }}} */ /* {{{ PHP_MINFO_FUNCTION */ -PHP_MINFO_FUNCTION(extname) +PHP_MINFO_FUNCTION(%EXTNAME%) { php_info_print_table_start(); - php_info_print_table_header(2, "extname support", "enabled"); + php_info_print_table_header(2, "%EXTNAME% support", "enabled"); php_info_print_table_end(); - - /* Remove comments if you have entries in php.ini - DISPLAY_INI_ENTRIES(); - */ } /* }}} */ -/* {{{ extname_functions[] - * - * Every user visible function must have an entry in extname_functions[]. +/* {{{ arginfo + */ +ZEND_BEGIN_ARG_INFO(arginfo_%EXTNAME%_test1, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_%EXTNAME%_test2, 0) + ZEND_ARG_INFO(0, str) +ZEND_END_ARG_INFO() +/* }}} */ + +/* {{{ %EXTNAME%_functions[] */ -const zend_function_entry extname_functions[] = { - PHP_FE(confirm_extname_compiled, NULL) /* For testing, remove later. */ - /* __function_entries_here__ */ - PHP_FE_END /* Must be the last line in extname_functions[] */ +const zend_function_entry %EXTNAME%_functions[] = { + PHP_FE(%EXTNAME%_test1, arginfo_%EXTNAME%_test1) + PHP_FE(%EXTNAME%_test2, arginfo_%EXTNAME%_test2) + PHP_FE_END }; /* }}} */ -/* {{{ extname_module_entry +/* {{{ %EXTNAME%_module_entry */ -zend_module_entry extname_module_entry = { +zend_module_entry %EXTNAME%_module_entry = { STANDARD_MODULE_HEADER, - "extname", - extname_functions, - PHP_MINIT(extname), - PHP_MSHUTDOWN(extname), - PHP_RINIT(extname), /* Replace with NULL if there's nothing to do at request start */ - PHP_RSHUTDOWN(extname), /* Replace with NULL if there's nothing to do at request end */ - PHP_MINFO(extname), - PHP_EXTNAME_VERSION, + "%EXTNAME%", /* Extension name */ + %EXTNAME%_functions, /* zend_function_entry */ + NULL, /* PHP_MINIT - Module initialization */ + NULL, /* PHP_MSHUTDOWN - Module shutdown */ + PHP_RINIT(%EXTNAME%), /* PHP_RINIT - Request initialization */ + NULL, /* PHP_RSHUTDOWN - Request shutdown */ + PHP_MINFO(%EXTNAME%), /* PHP_MINFO - Module info */ + PHP_%EXTNAMECAPS%_VERSION, /* Version */ STANDARD_MODULE_PROPERTIES }; /* }}} */ -#ifdef COMPILE_DL_EXTNAME -#ifdef ZTS +#ifdef COMPILE_DL_%EXTNAMECAPS% +# ifdef ZTS ZEND_TSRMLS_CACHE_DEFINE() +# endif +ZEND_GET_MODULE(%EXTNAME%) #endif -ZEND_GET_MODULE(extname) -#endif - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * End: - * vim600: noet sw=4 ts=4 fdm=marker - * vim<600: noet sw=4 ts=4 - */ +%FOOTER% \ No newline at end of file diff --git a/ext/skeleton/skeleton.php b/ext/skeleton/skeleton.php deleted file mode 100644 index 91db9d540881b..0000000000000 --- a/ext/skeleton/skeleton.php +++ /dev/null @@ -1,21 +0,0 @@ -"; - -if(!extension_loaded('extname')) { - dl('extname.' . PHP_SHLIB_SUFFIX); -} -$module = 'extname'; -$functions = get_extension_funcs($module); -echo "Functions available in the test extension:$br\n"; -foreach($functions as $func) { - echo $func."$br\n"; -} -echo "$br\n"; -$function = 'confirm_' . $module . '_compiled'; -if (extension_loaded($module)) { - $str = $function($module); -} else { - $str = "Module $module is not compiled into PHP"; -} -echo "$str\n"; -?> diff --git a/ext/skeleton/tests/001.phpt b/ext/skeleton/tests/001.phpt index 88f579565082d..445a914936df2 100644 --- a/ext/skeleton/tests/001.phpt +++ b/ext/skeleton/tests/001.phpt @@ -1,21 +1,14 @@ --TEST-- -Check for extname presence +Check if %EXTNAME% is loaded --SKIPIF-- - + --FILE-- --EXPECT-- -extname extension is available +The extension "%EXTNAME%" is available diff --git a/ext/skeleton/tests/002.phpt b/ext/skeleton/tests/002.phpt new file mode 100644 index 0000000000000..0147087ace6f4 --- /dev/null +++ b/ext/skeleton/tests/002.phpt @@ -0,0 +1,17 @@ +--TEST-- +%EXTNAME%_test1() Basic test +--SKIPIF-- + +--FILE-- + +--EXPECT-- +The extension %EXTNAME% is loaded and working! +NULL diff --git a/ext/skeleton/tests/003.phpt b/ext/skeleton/tests/003.phpt new file mode 100644 index 0000000000000..d5a0905fa98e2 --- /dev/null +++ b/ext/skeleton/tests/003.phpt @@ -0,0 +1,16 @@ +--TEST-- +%EXTNAME%_test2() Basic test +--SKIPIF-- + +--FILE-- + +--EXPECT-- +string(11) "Hello World" +string(9) "Hello PHP" diff --git a/ext/soap/package.xml b/ext/soap/package.xml deleted file mode 100644 index 32c5b77ff3489..0000000000000 --- a/ext/soap/package.xml +++ /dev/null @@ -1,63 +0,0 @@ - - - - ext_soap - Provides SOAP Services - - Description of package.... - - beta - - - rodif_bl - Brad Lafountain - rodif_bl@yahoo.com - lead - - - shane - Shane Caraveo - shane@caraveo.com - lead - - - dmitry - Dmitry Stogov - dmitry@zend.com - lead - - - PHP - - 0.1 - 2002-07-07 - alpha - - - First official PEAR/PECL release - - - - - CREDITS - EXPERIMENTAL - TODO - config.m4 - php_encoding.c - php_encoding.h - php_http.c - php_http.h - php_packet_soap.c - php_packet_soap.h - php_schema.c - php_schema.h - php_sdl.c - php_sdl.h - php_soap.h - php_soap.h - php_xml.c - php_xml.h - soap.c - - - diff --git a/ext/soap/php_http.c b/ext/soap/php_http.c index c0b5f612160aa..d8d8f95f2bb38 100644 --- a/ext/soap/php_http.c +++ b/ext/soap/php_http.c @@ -179,7 +179,7 @@ static php_stream* http_connect(zval* this_ptr, php_url *phpurl, int use_ssl, ph port = Z_LVAL_P(proxy_port); *use_proxy = 1; } else { - host = phpurl->host; + host = ZSTR_VAL(phpurl->host); port = phpurl->port; } if ((tmp = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "_connection_timeout", sizeof("_connection_timeout")-1)) != NULL && @@ -243,18 +243,18 @@ static php_stream* http_connect(zval* this_ptr, php_url *phpurl, int use_ssl, ph /* Set peer_name or name verification will try to use the proxy server name */ if (!context || (tmp = php_stream_context_get_option(context, "ssl", "peer_name")) == NULL) { - ZVAL_STRING(&ssl_proxy_peer_name, phpurl->host); + ZVAL_STR_COPY(&ssl_proxy_peer_name, phpurl->host); php_stream_context_set_option(PHP_STREAM_CONTEXT(stream), "ssl", "peer_name", &ssl_proxy_peer_name); zval_ptr_dtor(&ssl_proxy_peer_name); } smart_str_append_const(&soap_headers, "CONNECT "); - smart_str_appends(&soap_headers, phpurl->host); + smart_str_appends(&soap_headers, ZSTR_VAL(phpurl->host)); smart_str_appendc(&soap_headers, ':'); smart_str_append_unsigned(&soap_headers, phpurl->port); smart_str_append_const(&soap_headers, " HTTP/1.1\r\n"); smart_str_append_const(&soap_headers, "Host: "); - smart_str_appends(&soap_headers, phpurl->host); + smart_str_appends(&soap_headers, ZSTR_VAL(phpurl->host)); if (phpurl->port != 80) { smart_str_appendc(&soap_headers, ':'); smart_str_append_unsigned(&soap_headers, phpurl->port); @@ -454,9 +454,9 @@ int make_http_soap_request(zval *this_ptr, } use_ssl = 0; - if (phpurl->scheme != NULL && strcmp(phpurl->scheme, "https") == 0) { + if (phpurl->scheme != NULL && zend_string_equals_literal(phpurl->scheme, "https")) { use_ssl = 1; - } else if (phpurl->scheme == NULL || strcmp(phpurl->scheme, "http") != 0) { + } else if (phpurl->scheme == NULL || !zend_string_equals_literal(phpurl->scheme, "http")) { php_url_free(phpurl); if (request != buf) { zend_string_release(request); @@ -489,10 +489,10 @@ int make_http_soap_request(zval *this_ptr, if ((tmp = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "httpurl", sizeof("httpurl")-1)) != NULL && (orig = (php_url *) zend_fetch_resource_ex(tmp, "httpurl", le_url)) != NULL && ((use_proxy && !use_ssl) || - (((use_ssl && orig->scheme != NULL && strcmp(orig->scheme, "https") == 0) || + (((use_ssl && orig->scheme != NULL && zend_string_equals_literal(orig->scheme, "https")) || (!use_ssl && orig->scheme == NULL) || - (!use_ssl && strcmp(orig->scheme, "https") != 0)) && - strcmp(orig->host, phpurl->host) == 0 && + (!use_ssl && !zend_string_equals_literal(orig->scheme, "https"))) && + strcmp(ZSTR_VAL(orig->host), ZSTR_VAL(phpurl->host)) == 0 && orig->port == phpurl->port))) { } else { php_stream_close(stream); @@ -553,24 +553,24 @@ int make_http_soap_request(zval *this_ptr, smart_str_append_const(&soap_headers, "POST "); if (use_proxy && !use_ssl) { - smart_str_appends(&soap_headers, phpurl->scheme); + smart_str_appends(&soap_headers, ZSTR_VAL(phpurl->scheme)); smart_str_append_const(&soap_headers, "://"); - smart_str_appends(&soap_headers, phpurl->host); + smart_str_appends(&soap_headers, ZSTR_VAL(phpurl->host)); smart_str_appendc(&soap_headers, ':'); smart_str_append_unsigned(&soap_headers, phpurl->port); } if (phpurl->path) { - smart_str_appends(&soap_headers, phpurl->path); + smart_str_appends(&soap_headers, ZSTR_VAL(phpurl->path)); } else { smart_str_appendc(&soap_headers, '/'); } if (phpurl->query) { smart_str_appendc(&soap_headers, '?'); - smart_str_appends(&soap_headers, phpurl->query); + smart_str_appends(&soap_headers, ZSTR_VAL(phpurl->query)); } if (phpurl->fragment) { smart_str_appendc(&soap_headers, '#'); - smart_str_appends(&soap_headers, phpurl->fragment); + smart_str_appends(&soap_headers, ZSTR_VAL(phpurl->fragment)); } if (http_1_1) { smart_str_append_const(&soap_headers, " HTTP/1.1\r\n"); @@ -578,7 +578,7 @@ int make_http_soap_request(zval *this_ptr, smart_str_append_const(&soap_headers, " HTTP/1.0\r\n"); } smart_str_append_const(&soap_headers, "Host: "); - smart_str_appends(&soap_headers, phpurl->host); + smart_str_appends(&soap_headers, ZSTR_VAL(phpurl->host)); if (phpurl->port != (use_ssl?443:80)) { smart_str_appendc(&soap_headers, ':'); smart_str_append_unsigned(&soap_headers, phpurl->port); @@ -702,13 +702,13 @@ int make_http_soap_request(zval *this_ptr, PHP_MD5Init(&md5ctx); PHP_MD5Update(&md5ctx, (unsigned char*)"POST:", sizeof("POST:")-1); if (phpurl->path) { - PHP_MD5Update(&md5ctx, (unsigned char*)phpurl->path, strlen(phpurl->path)); + PHP_MD5Update(&md5ctx, (unsigned char*)ZSTR_VAL(phpurl->path), ZSTR_LEN(phpurl->path)); } else { PHP_MD5Update(&md5ctx, (unsigned char*)"/", 1); } if (phpurl->query) { PHP_MD5Update(&md5ctx, (unsigned char*)"?", 1); - PHP_MD5Update(&md5ctx, (unsigned char*)phpurl->query, strlen(phpurl->query)); + PHP_MD5Update(&md5ctx, (unsigned char*)ZSTR_VAL(phpurl->query), ZSTR_LEN(phpurl->query)); } PHP_MD5Final(hash, &md5ctx); @@ -750,17 +750,17 @@ int make_http_soap_request(zval *this_ptr, } smart_str_append_const(&soap_headers, "\", uri=\""); if (phpurl->path) { - smart_str_appends(&soap_headers, phpurl->path); + smart_str_appends(&soap_headers, ZSTR_VAL(phpurl->path)); } else { smart_str_appendc(&soap_headers, '/'); } if (phpurl->query) { smart_str_appendc(&soap_headers, '?'); - smart_str_appends(&soap_headers, phpurl->query); + smart_str_appends(&soap_headers, ZSTR_VAL(phpurl->query)); } if (phpurl->fragment) { smart_str_appendc(&soap_headers, '#'); - smart_str_appends(&soap_headers, phpurl->fragment); + smart_str_appends(&soap_headers, ZSTR_VAL(phpurl->fragment)); } if ((tmp = zend_hash_str_find(Z_ARRVAL_P(digest), "qop", sizeof("qop")-1)) != NULL && Z_TYPE_P(tmp) == IS_STRING) { @@ -835,10 +835,10 @@ int make_http_soap_request(zval *this_ptr, zval *tmp; if (((tmp = zend_hash_index_find(Z_ARRVAL_P(data), 1)) == NULL || Z_TYPE_P(tmp) != IS_STRING || - strncmp(phpurl->path?phpurl->path:"/",Z_STRVAL_P(tmp),Z_STRLEN_P(tmp)) == 0) && + strncmp(phpurl->path?ZSTR_VAL(phpurl->path):"/",Z_STRVAL_P(tmp),Z_STRLEN_P(tmp)) == 0) && ((tmp = zend_hash_index_find(Z_ARRVAL_P(data), 2)) == NULL || Z_TYPE_P(tmp) != IS_STRING || - in_domain(phpurl->host,Z_STRVAL_P(tmp))) && + in_domain(ZSTR_VAL(phpurl->host),Z_STRVAL_P(tmp))) && (use_ssl || (tmp = zend_hash_index_find(Z_ARRVAL_P(data), 3)) == NULL)) { smart_str_append(&soap_headers, key); smart_str_appendc(&soap_headers, '='); @@ -1006,14 +1006,15 @@ int make_http_soap_request(zval *this_ptr, } } if (!zend_hash_index_exists(Z_ARRVAL(zcookie), 1)) { - char *t = phpurl->path?phpurl->path:"/"; + char *t = phpurl->path?ZSTR_VAL(phpurl->path):"/"; char *c = strrchr(t, '/'); if (c) { add_index_stringl(&zcookie, 1, t, c-t); } } if (!zend_hash_index_exists(Z_ARRVAL(zcookie), 2)) { - add_index_string(&zcookie, 2, phpurl->host); + add_index_str(&zcookie, 2, phpurl->host); + GC_REFCOUNT(phpurl->host)++; } zend_symtable_update(Z_ARRVAL_P(cookies), name.s, &zcookie); @@ -1108,26 +1109,27 @@ int make_http_soap_request(zval *this_ptr, zend_string_release(http_body); efree(loc); if (new_url->scheme == NULL && new_url->path != NULL) { - new_url->scheme = phpurl->scheme ? estrdup(phpurl->scheme) : NULL; - new_url->host = phpurl->host ? estrdup(phpurl->host) : NULL; + new_url->scheme = phpurl->scheme ? zend_string_copy(phpurl->scheme) : NULL; + new_url->host = phpurl->host ? zend_string_copy(phpurl->host) : NULL; new_url->port = phpurl->port; - if (new_url->path && new_url->path[0] != '/') { + if (new_url->path && ZSTR_VAL(new_url->path)[0] != '/') { if (phpurl->path) { - char *t = phpurl->path; + char *t = ZSTR_VAL(phpurl->path); char *p = strrchr(t, '/'); if (p) { - char *s = emalloc((p - t) + strlen(new_url->path) + 2); - strncpy(s, t, (p - t) + 1); - s[(p - t) + 1] = 0; - strcat(s, new_url->path); - efree(new_url->path); + zend_string *s = zend_string_alloc((p - t) + ZSTR_LEN(new_url->path) + 2, 0); + strncpy(ZSTR_VAL(s), t, (p - t) + 1); + ZSTR_VAL(s)[(p - t) + 1] = 0; + strcat(ZSTR_VAL(s), ZSTR_VAL(new_url->path)); + zend_string_release(new_url->path); new_url->path = s; } } else { - char *s = emalloc(strlen(new_url->path) + 2); - s[0] = '/'; s[1] = 0; - strcat(s, new_url->path); - efree(new_url->path); + zend_string *s = zend_string_alloc(ZSTR_LEN(new_url->path) + 2, 0); + ZSTR_VAL(s)[0] = '/'; + ZSTR_VAL(s)[1] = 0; + strcat(ZSTR_VAL(s), ZSTR_VAL(new_url->path)); + zend_string_release(new_url->path); new_url->path = s; } } @@ -1202,13 +1204,13 @@ int make_http_soap_request(zval *this_ptr, add_property_zval_ex(this_ptr, "_digest", sizeof("_digest")-1, &digest); *new_url = *phpurl; - if (phpurl->scheme) phpurl->scheme = estrdup(phpurl->scheme); - if (phpurl->user) phpurl->user = estrdup(phpurl->user); - if (phpurl->pass) phpurl->pass = estrdup(phpurl->pass); - if (phpurl->host) phpurl->host = estrdup(phpurl->host); - if (phpurl->path) phpurl->path = estrdup(phpurl->path); - if (phpurl->query) phpurl->query = estrdup(phpurl->query); - if (phpurl->fragment) phpurl->fragment = estrdup(phpurl->fragment); + if (phpurl->scheme) phpurl->scheme = zend_string_copy(phpurl->scheme); + if (phpurl->user) phpurl->user = zend_string_copy(phpurl->user); + if (phpurl->pass) phpurl->pass = zend_string_copy(phpurl->pass); + if (phpurl->host) phpurl->host = zend_string_copy(phpurl->host); + if (phpurl->path) phpurl->path = zend_string_copy(phpurl->path); + if (phpurl->query) phpurl->query = zend_string_copy(phpurl->query); + if (phpurl->fragment) phpurl->fragment = zend_string_copy(phpurl->fragment); phpurl = new_url; efree(auth); diff --git a/ext/soap/soap.c b/ext/soap/soap.c index 3c7e84796453f..21deb4ec807af 100644 --- a/ext/soap/soap.c +++ b/ext/soap/soap.c @@ -813,7 +813,7 @@ PHP_METHOD(SoapParam, SoapParam) size_t name_length; zval *this_ptr; - if (zend_parse_parameters(ZEND_NUM_ARGS(), "zs", &data, &name, &name_length) == FAILURE) { + if (zend_parse_parameters_throw(ZEND_NUM_ARGS(), "zs", &data, &name, &name_length) == FAILURE) { return; } if (name_length == 0) { @@ -838,7 +838,7 @@ PHP_METHOD(SoapHeader, SoapHeader) zend_bool must_understand = 0; zval *this_ptr; - if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss|zbz", &ns, &ns_len, &name, &name_len, &data, &must_understand, &actor) == FAILURE) { + if (zend_parse_parameters_throw(ZEND_NUM_ARGS(), "ss|zbz", &ns, &ns_len, &name, &name_len, &data, &must_understand, &actor) == FAILURE) { return; } if (ns_len == 0) { @@ -878,7 +878,7 @@ PHP_METHOD(SoapFault, SoapFault) size_t fault_string_len, fault_actor_len = 0, name_len = 0, fault_code_len = 0; zval *code = NULL, *details = NULL, *headerfault = NULL, *this_ptr; - if (zend_parse_parameters(ZEND_NUM_ARGS(), "zs|s!z!s!z", + if (zend_parse_parameters_throw(ZEND_NUM_ARGS(), "zs|s!z!s!z", &code, &fault_string, &fault_string_len, &fault_actor, &fault_actor_len, @@ -982,7 +982,7 @@ PHP_METHOD(SoapVar, SoapVar) char *stype = NULL, *ns = NULL, *name = NULL, *namens = NULL; size_t stype_len = 0, ns_len = 0, name_len = 0, namens_len = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS(), "z!z|ssss", &data, &type, &stype, &stype_len, &ns, &ns_len, &name, &name_len, &namens, &namens_len) == FAILURE) { + if (zend_parse_parameters_throw(ZEND_NUM_ARGS(), "z!z|ssss", &data, &type, &stype, &stype_len, &ns, &ns_len, &name, &name_len, &namens, &namens_len) == FAILURE) { return; } @@ -1134,8 +1134,8 @@ PHP_METHOD(SoapServer, SoapServer) SOAP_SERVER_BEGIN_CODE(); - if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS(), "z|a", &wsdl, &options) == FAILURE) { - php_error_docref(NULL, E_ERROR, "Invalid parameters"); + if (zend_parse_parameters_throw(ZEND_NUM_ARGS(), "z|a", &wsdl, &options) == FAILURE) { + return; } if (Z_TYPE_P(wsdl) != IS_STRING && Z_TYPE_P(wsdl) != IS_NULL) { @@ -1223,8 +1223,7 @@ PHP_METHOD(SoapServer, SoapServer) service->version = version; service->type = SOAP_FUNCTIONS; service->soap_functions.functions_all = FALSE; - service->soap_functions.ft = emalloc(sizeof(HashTable)); - zend_hash_init(service->soap_functions.ft, 0, NULL, ZVAL_PTR_DTOR, 0); + service->soap_functions.ft = zend_new_array(0); if (Z_TYPE_P(wsdl) != IS_NULL) { service->sdl = get_sdl(getThis(), Z_STRVAL_P(wsdl), cache_wsdl); @@ -1415,8 +1414,7 @@ PHP_METHOD(SoapServer, addFunction) if (service->soap_functions.ft == NULL) { service->soap_functions.functions_all = FALSE; - service->soap_functions.ft = emalloc(sizeof(HashTable)); - zend_hash_init(service->soap_functions.ft, zend_hash_num_elements(Z_ARRVAL_P(function_name)), NULL, ZVAL_PTR_DTOR, 0); + service->soap_functions.ft = zend_new_array(zend_hash_num_elements(Z_ARRVAL_P(function_name))); } ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(function_name), tmp_function) { @@ -1455,8 +1453,7 @@ PHP_METHOD(SoapServer, addFunction) } if (service->soap_functions.ft == NULL) { service->soap_functions.functions_all = FALSE; - service->soap_functions.ft = emalloc(sizeof(HashTable)); - zend_hash_init(service->soap_functions.ft, 0, NULL, ZVAL_PTR_DTOR, 0); + service->soap_functions.ft = zend_new_array(0); } ZVAL_STR_COPY(&function_copy, f->common.function_name); @@ -2310,8 +2307,8 @@ PHP_METHOD(SoapClient, SoapClient) SOAP_CLIENT_BEGIN_CODE(); - if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS(), "z|a", &wsdl, &options) == FAILURE) { - php_error_docref(NULL, E_ERROR, "Invalid parameters"); + if (zend_parse_parameters_throw(ZEND_NUM_ARGS(), "z|a", &wsdl, &options) == FAILURE) { + return; } if (Z_TYPE_P(wsdl) != IS_STRING && Z_TYPE_P(wsdl) != IS_NULL) { @@ -2888,8 +2885,7 @@ PHP_METHOD(SoapClient, __call) free_soap_headers = 0; } else if (Z_TYPE_P(headers) == IS_OBJECT && instanceof_function(Z_OBJCE_P(headers), soap_header_class_entry)) { - soap_headers = emalloc(sizeof(HashTable)); - zend_hash_init(soap_headers, 0, NULL, ZVAL_PTR_DTOR, 0); + soap_headers = zend_new_array(0); zend_hash_next_index_insert(soap_headers, headers); Z_ADDREF_P(headers); free_soap_headers = 1; diff --git a/ext/soap/tests/fault001.phpt b/ext/soap/tests/fault001.phpt new file mode 100644 index 0000000000000..221641dc093a7 --- /dev/null +++ b/ext/soap/tests/fault001.phpt @@ -0,0 +1,13 @@ +--TEST-- +is_soap_fault 1: test against null +--SKIPIF-- + +--FILE-- + +--EXPECT-- +bool(false) +bool(true) diff --git a/ext/sockets/package.xml b/ext/sockets/package.xml deleted file mode 100644 index 5fa67d9939f03..0000000000000 --- a/ext/sockets/package.xml +++ /dev/null @@ -1,65 +0,0 @@ - - - - sockets - Socket functions - - - ??? - Chris Vandomelen - chrisv@b0rked.dhs.org - lead - - - sterling - Sterling Hughes - sterling@php.net - lead - - - jason - Jason Greene - jason@php.net - lead - - - ??? - Daniel Beulshausen - daniel@php4win.de - lead - - - -The socket extension implements a low-level interface to the socket -communication functions based on the popular BSD sockets, providing -the possibility to act as a socket server as well as a client. - - PHP - - beta - 5.0.0rc1 - 2004-03-19 - -package.xml added to support installation using pear installer - - - - - - - - - - - - - - - - - - - - diff --git a/ext/spl/package.xml b/ext/spl/package.xml deleted file mode 100755 index 372aaecd9fe26..0000000000000 --- a/ext/spl/package.xml +++ /dev/null @@ -1,75 +0,0 @@ - - - - SPL - Standard PHP Library - - - helly - Marcus Boerger - helly@php.net - lead - - - -SPL is a collection of interfaces and classes that are meant to solve -standard problems. - - PHP - - stable - 0.1-dev - TBA - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/ext/spl/spl_array.c b/ext/spl/spl_array.c index a45197114a1fa..672f40e469581 100644 --- a/ext/spl/spl_array.c +++ b/ext/spl/spl_array.c @@ -845,8 +845,7 @@ static HashTable* spl_array_get_debug_info(zval *obj, int *is_temp) /* {{{ */ HashTable *debug_info; *is_temp = 1; - ALLOC_HASHTABLE(debug_info); - ZEND_INIT_SYMTABLE_EX(debug_info, zend_hash_num_elements(intern->std.properties) + 1, 0); + debug_info = zend_new_array(zend_hash_num_elements(intern->std.properties) + 1); zend_hash_copy(debug_info, intern->std.properties, (copy_ctor_func_t) zval_add_ref); storage = &intern->array; diff --git a/ext/spl/spl_directory.c b/ext/spl/spl_directory.c index 049b517c46def..943b5174a2eb5 100644 --- a/ext/spl/spl_directory.c +++ b/ext/spl/spl_directory.c @@ -99,6 +99,8 @@ static void spl_filesystem_object_destroy_object(zend_object *object) /* {{{ */ } } break; + default: + break; } } /* }}} */ @@ -1235,7 +1237,7 @@ FileInfoFunction(isLink, FS_IS_LINK) SPL_METHOD(SplFileInfo, getLinkTarget) { spl_filesystem_object *intern = Z_SPLFILESYSTEM_P(getThis()); - int ret; + ssize_t ret; char buff[MAXPATHLEN]; zend_error_handling error_handling; @@ -1277,7 +1279,7 @@ SPL_METHOD(SplFileInfo, getLinkTarget) } /* }}} */ -#if (!defined(__BEOS__) && HAVE_REALPATH) || defined(ZTS) +#if HAVE_REALPATH || defined(ZTS) /* {{{ proto string SplFileInfo::getRealPath() Return the resolved path */ SPL_METHOD(SplFileInfo, getRealPath) @@ -1945,7 +1947,7 @@ static const zend_function_entry spl_SplFileInfo_functions[] = { SPL_ME(SplFileInfo, isDir, arginfo_splfileinfo_void, ZEND_ACC_PUBLIC) SPL_ME(SplFileInfo, isLink, arginfo_splfileinfo_void, ZEND_ACC_PUBLIC) SPL_ME(SplFileInfo, getLinkTarget, arginfo_splfileinfo_void, ZEND_ACC_PUBLIC) -#if (!defined(__BEOS__) && HAVE_REALPATH) || defined(ZTS) +#if HAVE_REALPATH || defined(ZTS) SPL_ME(SplFileInfo, getRealPath, arginfo_splfileinfo_void, ZEND_ACC_PUBLIC) #endif SPL_ME(SplFileInfo, getFileInfo, arginfo_info_optinalFileClass, ZEND_ACC_PUBLIC) diff --git a/ext/spl/spl_dllist.c b/ext/spl/spl_dllist.c index c7ac6cecd0baf..fac5007be20e1 100644 --- a/ext/spl/spl_dllist.c +++ b/ext/spl/spl_dllist.c @@ -506,8 +506,7 @@ static HashTable* spl_dllist_object_get_debug_info(zval *obj, int *is_temp) /* { rebuild_object_properties(&intern->std); } - ALLOC_HASHTABLE(debug_info); - zend_hash_init(debug_info, 1, NULL, ZVAL_PTR_DTOR, 0); + debug_info = zend_new_array(1); zend_hash_copy(debug_info, intern->std.properties, (copy_ctor_func_t) zval_add_ref); pnstr = spl_gen_private_prop_name(spl_ce_SplDoublyLinkedList, "flags", sizeof("flags")-1); diff --git a/ext/spl/spl_heap.c b/ext/spl/spl_heap.c index 06e477367702b..3b179c523f73b 100644 --- a/ext/spl/spl_heap.c +++ b/ext/spl/spl_heap.c @@ -490,8 +490,7 @@ static HashTable* spl_heap_object_get_debug_info_helper(zend_class_entry *ce, zv rebuild_object_properties(&intern->std); } - ALLOC_HASHTABLE(debug_info); - ZEND_INIT_SYMTABLE_EX(debug_info, zend_hash_num_elements(intern->std.properties) + 1, 0); + debug_info = zend_new_array(zend_hash_num_elements(intern->std.properties) + 1); zend_hash_copy(debug_info, intern->std.properties, (copy_ctor_func_t) zval_add_ref); pnstr = spl_gen_private_prop_name(ce, "flags", sizeof("flags")-1); diff --git a/ext/spl/spl_observer.c b/ext/spl/spl_observer.c index de33bd5a6baed..c6d366515b3b9 100644 --- a/ext/spl/spl_observer.c +++ b/ext/spl/spl_observer.c @@ -295,8 +295,7 @@ static HashTable* spl_object_storage_debug_info(zval *obj, int *is_temp) /* {{{ props = Z_OBJPROP_P(obj); - ALLOC_HASHTABLE(debug_info); - ZEND_INIT_SYMTABLE_EX(debug_info, zend_hash_num_elements(props) + 1, 0); + debug_info = zend_new_array(zend_hash_num_elements(props) + 1); zend_hash_copy(debug_info, props, (copy_ctor_func_t)zval_add_ref); array_init(&storage); diff --git a/ext/sqlite3/tests/sqlite3_busyTimeout.phpt b/ext/sqlite3/tests/sqlite3_busyTimeout.phpt new file mode 100644 index 0000000000000..3c7c2dc41af87 --- /dev/null +++ b/ext/sqlite3/tests/sqlite3_busyTimeout.phpt @@ -0,0 +1,20 @@ +--TEST-- +public bool SQLite3::busyTimeout ( int $msecs ); +--CREDITS-- +marcosptf - - @phpsp - sao paulo - br +--XFAILIF-- + +--FILE-- +busyTimeout(0)); +var_dump($db->busyTimeout(null)); +var_dump($db->busyTimeout(-1000)); +var_dump($db->busyTimeout(1000)); +$db->close(); +?> +--EXPECT-- +bool(true) +bool(true) +bool(true) +bool(true) diff --git a/ext/standard/array.c b/ext/standard/array.c index 9ddbf1f3bf22a..e55924c66b39f 100644 --- a/ext/standard/array.c +++ b/ext/standard/array.c @@ -2899,7 +2899,7 @@ PHP_FUNCTION(range) goto err; } - lstep = step; + lstep = (zend_ulong)step; Z_TYPE_INFO(tmp) = IS_LONG; if (low > high) { /* Negative steps */ @@ -3992,7 +3992,7 @@ PHP_FUNCTION(array_keys) if (HT_IS_PACKED(arrval) && HT_IS_WITHOUT_HOLES(arrval)) { /* Optimistic case: range(0..n-1) for vector-like packed array */ ZVAL_LONG(&new_val, 0); - for (; Z_LVAL(new_val) < elem_count; ++Z_LVAL(new_val)) { + for (; (zend_ulong)Z_LVAL(new_val) < elem_count; ++Z_LVAL(new_val)) { ZEND_HASH_FILL_ADD(&new_val); } } else { @@ -4408,7 +4408,7 @@ PHP_FUNCTION(array_flip) /* }}} */ /* {{{ proto array array_change_key_case(array input [, int case=CASE_LOWER]) - Retuns an array with all string keys lowercased [or uppercased] */ + Returns an array with all string keys lowercased [or uppercased] */ PHP_FUNCTION(array_change_key_case) { zval *array, *entry; @@ -5738,7 +5738,7 @@ PHP_FUNCTION(array_rand) if (num_req == 1) { HashTable *ht = Z_ARRVAL_P(input); - if (num_avail < ht->nNumUsed - (ht->nNumUsed>>1)) { + if ((uint32_t)num_avail < ht->nNumUsed - (ht->nNumUsed>>1)) { /* If less than 1/2 of elements are used, don't sample. Instead search for a * specific offset using linear scan. */ zend_long i = 0, randval = php_mt_rand_range(0, num_avail - 1); diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c index 383e988090af1..fdcc50b86021b 100644 --- a/ext/standard/basic_functions.c +++ b/ext/standard/basic_functions.c @@ -962,7 +962,7 @@ ZEND_BEGIN_ARG_INFO(arginfo_gethostname, 0) ZEND_END_ARG_INFO() #endif -#if defined(PHP_WIN32) || (HAVE_DNS_SEARCH_FUNC && !defined(__BEOS__)) +#if defined(PHP_WIN32) || HAVE_DNS_SEARCH_FUNC ZEND_BEGIN_ARG_INFO_EX(arginfo_dns_check_record, 0, 0, 1) ZEND_ARG_INFO(0, host) ZEND_ARG_INFO(0, type) @@ -984,7 +984,7 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_dns_get_mx, 0, 0, 2) ZEND_END_ARG_INFO() # endif -#endif /* defined(PHP_WIN32) || (HAVE_DNS_SEARCH_FUNC && !defined(__BEOS__)) */ +#endif /* defined(PHP_WIN32) || HAVE_DNS_SEARCH_FUNC */ /* }}} */ /* {{{ exec.c */ @@ -1204,7 +1204,7 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_fgetcsv, 0, 0, 1) ZEND_ARG_INFO(0, escape) ZEND_END_ARG_INFO() -#if (!defined(__BEOS__) && HAVE_REALPATH) || defined(ZTS) +#if HAVE_REALPATH || defined(ZTS) ZEND_BEGIN_ARG_INFO(arginfo_realpath, 0) ZEND_ARG_INFO(0, path) ZEND_END_ARG_INFO() @@ -3060,7 +3060,7 @@ const zend_function_entry basic_functions[] = { /* {{{ */ PHP_FE(gethostname, arginfo_gethostname) #endif -#if defined(PHP_WIN32) || (HAVE_DNS_SEARCH_FUNC && !defined(__BEOS__)) +#if defined(PHP_WIN32) || HAVE_DNS_SEARCH_FUNC PHP_FE(dns_check_record, arginfo_dns_check_record) PHP_FALIAS(checkdnsrr, dns_check_record, arginfo_dns_check_record) @@ -3189,7 +3189,7 @@ const zend_function_entry basic_functions[] = { /* {{{ */ PHP_FALIAS(socket_get_status, stream_get_meta_data, arginfo_stream_get_meta_data) -#if (!defined(__BEOS__) && HAVE_REALPATH) || defined(ZTS) +#if HAVE_REALPATH || defined(ZTS) PHP_FE(realpath, arginfo_realpath) #endif @@ -3700,7 +3700,7 @@ PHP_MINIT_FUNCTION(basic) /* {{{ */ php_register_url_stream_wrapper("http", &php_stream_http_wrapper); php_register_url_stream_wrapper("ftp", &php_stream_ftp_wrapper); -#if defined(PHP_WIN32) || (HAVE_DNS_SEARCH_FUNC && !defined(__BEOS__)) +#if defined(PHP_WIN32) || HAVE_DNS_SEARCH_FUNC # if defined(PHP_WIN32) || HAVE_FULL_DNS_FUNCS BASIC_MINIT_SUBMODULE(dns) # endif @@ -4149,7 +4149,7 @@ PHP_FUNCTION(putenv) pe.key_len = (int)strlen(pe.key); #ifdef PHP_WIN32 if (equals) { - if (pe.key_len < setting_len - 1) { + if ((size_t)pe.key_len < setting_len - 1) { value = p + 1; } else { /* empty string*/ @@ -5411,9 +5411,9 @@ PHP_FUNCTION(ini_get_all) } /* }}} */ -static int php_ini_check_path(char *option_name, int option_len, char *new_option_name, int new_option_len) /* {{{ */ +static int php_ini_check_path(char *option_name, size_t option_len, char *new_option_name, size_t new_option_len) /* {{{ */ { - if (option_len != (new_option_len - 1)) { + if (option_len + 1 != new_option_len) { return 0; } @@ -5434,7 +5434,7 @@ PHP_FUNCTION(ini_set) Z_PARAM_STR(new_value) ZEND_PARSE_PARAMETERS_END(); - old_value = zend_ini_string(ZSTR_VAL(varname), (int)ZSTR_LEN(varname), 0); + old_value = zend_ini_string(ZSTR_VAL(varname), ZSTR_LEN(varname), 0); /* copy to return here, because alter might free it! */ if (old_value) { @@ -5451,7 +5451,7 @@ PHP_FUNCTION(ini_set) RETVAL_FALSE; } -#define _CHECK_PATH(var, var_len, ini) php_ini_check_path(var, (int)var_len, ini, sizeof(ini)) +#define _CHECK_PATH(var, var_len, ini) php_ini_check_path(var, var_len, ini, sizeof(ini)) /* open basedir check */ if (PG(open_basedir)) { if (_CHECK_PATH(ZSTR_VAL(varname), ZSTR_LEN(varname), "error_log") || @@ -5466,6 +5466,7 @@ PHP_FUNCTION(ini_set) } } } +#undef _CHECK_PATH if (zend_alter_ini_entry_ex(varname, new_value, PHP_INI_USER, PHP_INI_STAGE_RUNTIME, 0) == FAILURE) { zval_dtor(return_value); @@ -5917,7 +5918,7 @@ static void php_simple_ini_parser_cb(zval *arg1, zval *arg2, zval *arg3, int cal } if (!(Z_STRLEN_P(arg1) > 1 && Z_STRVAL_P(arg1)[0] == '0') && is_numeric_string(Z_STRVAL_P(arg1), Z_STRLEN_P(arg1), NULL, NULL, 0) == IS_LONG) { - zend_ulong key = (zend_ulong) zend_atol(Z_STRVAL_P(arg1), (int)Z_STRLEN_P(arg1)); + zend_ulong key = (zend_ulong) zend_atol(Z_STRVAL_P(arg1), Z_STRLEN_P(arg1)); if ((find_hash = zend_hash_index_find(Z_ARRVAL_P(arr), key)) == NULL) { array_init(&hash); find_hash = zend_hash_index_update(Z_ARRVAL_P(arr), key, &hash); diff --git a/ext/standard/browscap.c b/ext/standard/browscap.c index 9967031f09716..cc126d77be8a2 100644 --- a/ext/standard/browscap.c +++ b/ext/standard/browscap.c @@ -101,7 +101,7 @@ static uint8_t browscap_compute_prefix_len(zend_string *pattern) { break; } } - return MIN(i, UINT8_MAX); + return (uint8_t)MIN(i, UINT8_MAX); } static size_t browscap_compute_contains( @@ -119,7 +119,7 @@ static size_t browscap_compute_contains( } } } - *contains_start = i; + *contains_start = (uint16_t)i; /* Find first placeholder character after that */ for (; i < ZSTR_LEN(pattern); i++) { @@ -127,7 +127,7 @@ static size_t browscap_compute_contains( break; } } - *contains_len = MIN(i - *contains_start, UINT8_MAX); + *contains_len = (uint8_t)MIN(i - *contains_start, UINT8_MAX); return i; } @@ -276,9 +276,7 @@ static HashTable *browscap_entry_to_array(browser_data *bdata, browscap_entry *e zval tmp; uint32_t i; - HashTable *ht; - ALLOC_HASHTABLE(ht); - zend_hash_init(ht, 8, NULL, ZVAL_PTR_DTOR, 0); + HashTable *ht = zend_new_array(8); ZVAL_STR(&tmp, browscap_convert_pattern(entry->pattern, 0)); zend_hash_str_add(ht, "browser_name_regex", sizeof("browser_name_regex")-1, &tmp); diff --git a/ext/standard/credits.c b/ext/standard/credits.c index 59b3def4f742d..80bf9832e75ae 100644 --- a/ext/standard/credits.c +++ b/ext/standard/credits.c @@ -106,7 +106,7 @@ PHPAPI void php_print_credits(int flag) /* {{{ */ if (flag & PHP_CREDITS_QA) { php_info_print_table_start(); php_info_print_table_header(1, "PHP Quality Assurance Team"); - php_info_print_table_row(1, "Ilia Alshanetsky, Joerg Behrens, Antony Dovgal, Stefan Esser, Moriyoshi Koizumi, Magnus Maatta, Sebastian Nohn, Derick Rethans, Melvyn Sopacua, Jani Taskinen, Pierre-Alain Joye, Dmitry Stogov, Felipe Pena, David Soria Parra, Stanislav Malyshev, Julien Pauli, Stephen Zarkos, Anatol Belski, Remi Collet, Ferenc Kovacs"); + php_info_print_table_row(1, "Ilia Alshanetsky, Joerg Behrens, Antony Dovgal, Stefan Esser, Moriyoshi Koizumi, Magnus Maatta, Sebastian Nohn, Derick Rethans, Melvyn Sopacua, Pierre-Alain Joye, Dmitry Stogov, Felipe Pena, David Soria Parra, Stanislav Malyshev, Julien Pauli, Stephen Zarkos, Anatol Belski, Remi Collet, Ferenc Kovacs"); php_info_print_table_end(); } diff --git a/ext/standard/dir.c b/ext/standard/dir.c index 3cbc7cca2cedc..cc5c6d44ae1b4 100644 --- a/ext/standard/dir.c +++ b/ext/standard/dir.c @@ -511,7 +511,7 @@ PHP_FUNCTION(glob) } array_init(return_value); - for (n = 0; n < globbuf.gl_pathc; n++) { + for (n = 0; n < (size_t)globbuf.gl_pathc; n++) { if (PG(open_basedir) && *PG(open_basedir)) { if (php_check_open_basedir_ex(globbuf.gl_pathv[n], 0)) { basedir_limit = 1; diff --git a/ext/standard/dl.c b/ext/standard/dl.c index f7407927a9701..5459eaad4b66a 100644 --- a/ext/standard/dl.c +++ b/ext/standard/dl.c @@ -110,7 +110,7 @@ PHPAPI int php_load_extension(char *filename, int type, int start_now) char *libpath; zend_module_entry *module_entry; zend_module_entry *(*get_module)(void); - int error_type, slash_suffix = NULL; + int error_type, slash_suffix; char *extension_dir; char *err1, *err2; diff --git a/ext/standard/dns.c b/ext/standard/dns.c index ee03a31e25a9a..68ac495353ba6 100644 --- a/ext/standard/dns.c +++ b/ext/standard/dns.c @@ -304,7 +304,7 @@ static zend_string *php_gethostbyname(char *name) #endif /* HAVE_FULL_DNS_FUNCS || defined(PHP_WIN32) */ /* Note: These functions are defined in ext/standard/dns_win32.c for Windows! */ -#if !defined(PHP_WIN32) && (HAVE_DNS_SEARCH_FUNC && !defined(__BEOS__)) +#if !defined(PHP_WIN32) && HAVE_DNS_SEARCH_FUNC #ifndef HFIXEDSZ #define HFIXEDSZ 12 /* fixed data in header */ @@ -1114,7 +1114,7 @@ PHP_FUNCTION(dns_get_mx) } /* }}} */ #endif /* HAVE_FULL_DNS_FUNCS */ -#endif /* !defined(PHP_WIN32) && (HAVE_DNS_SEARCH_FUNC && !defined(__BEOS__)) */ +#endif /* !defined(PHP_WIN32) && HAVE_DNS_SEARCH_FUNC */ #if HAVE_FULL_DNS_FUNCS || defined(PHP_WIN32) PHP_MINIT_FUNCTION(dns) { diff --git a/ext/standard/file.c b/ext/standard/file.c index d82c2c513e928..6e76f235e2924 100644 --- a/ext/standard/file.c +++ b/ext/standard/file.c @@ -2340,7 +2340,7 @@ PHPAPI void php_fgetcsv(php_stream *stream, char delimiter, char enclosure, char } /* }}} */ -#if (!defined(__BEOS__) && HAVE_REALPATH) || defined(ZTS) +#if HAVE_REALPATH || defined(ZTS) /* {{{ proto string realpath(string path) Return the resolved path */ PHP_FUNCTION(realpath) diff --git a/ext/standard/file.h b/ext/standard/file.h index 4a014c7617a8d..94eafc6daf7fb 100644 --- a/ext/standard/file.h +++ b/ext/standard/file.h @@ -62,7 +62,7 @@ PHP_FUNCTION(get_meta_tags); PHP_FUNCTION(flock); PHP_FUNCTION(fd_set); PHP_FUNCTION(fd_isset); -#if (!defined(__BEOS__) && HAVE_REALPATH) || defined(ZTS) +#if HAVE_REALPATH || defined(ZTS) PHP_FUNCTION(realpath); #endif #ifdef HAVE_FNMATCH diff --git a/ext/standard/filestat.c b/ext/standard/filestat.c index b0d6a9813fddf..c762d30e0d46c 100644 --- a/ext/standard/filestat.c +++ b/ext/standard/filestat.c @@ -894,7 +894,7 @@ PHPAPI void php_stat(const char *filename, size_t filename_length, int type, zva case S_IFDIR: RETURN_STRING("dir"); case S_IFBLK: RETURN_STRING("block"); case S_IFREG: RETURN_STRING("file"); -#if defined(S_IFSOCK) && !defined(ZEND_WIN32)&&!defined(__BEOS__) +#if defined(S_IFSOCK) && !defined(PHP_WIN32) case S_IFSOCK: RETURN_STRING("socket"); #endif } diff --git a/ext/standard/ftp_fopen_wrapper.c b/ext/standard/ftp_fopen_wrapper.c index d54f2f6ced6dd..b548dddc5fd89 100644 --- a/ext/standard/ftp_fopen_wrapper.c +++ b/ext/standard/ftp_fopen_wrapper.c @@ -135,7 +135,7 @@ static php_stream *php_ftp_fopen_connect(php_stream_wrapper *wrapper, const char { php_stream *stream = NULL, *reuseid = NULL; php_url *resource = NULL; - int result, use_ssl, use_ssl_on_data = 0, tmp_len; + int result, use_ssl, use_ssl_on_data = 0; char tmp_line[512]; char *transport; int transport_len; @@ -148,13 +148,13 @@ static php_stream *php_ftp_fopen_connect(php_stream_wrapper *wrapper, const char return NULL; } - use_ssl = resource->scheme && (strlen(resource->scheme) > 3) && resource->scheme[3] == 's'; + use_ssl = resource->scheme && (ZSTR_LEN(resource->scheme) > 3) && ZSTR_VAL(resource->scheme)[3] == 's'; /* use port 21 if one wasn't specified */ if (resource->port == 0) resource->port = 21; - transport_len = (int)spprintf(&transport, 0, "tcp://%s:%d", resource->host, resource->port); + transport_len = (int)spprintf(&transport, 0, "tcp://%s:%d", ZSTR_VAL(resource->host), resource->port); stream = php_stream_xport_create(transport, transport_len, REPORT_ERRORS, STREAM_XPORT_CLIENT | STREAM_XPORT_CONNECT, NULL, NULL, context, NULL, NULL); efree(transport); if (stream == NULL) { @@ -245,11 +245,11 @@ static php_stream *php_ftp_fopen_connect(php_stream_wrapper *wrapper, const char /* send the user name */ if (resource->user != NULL) { - tmp_len = (int)php_raw_url_decode(resource->user, (int)strlen(resource->user)); + ZSTR_LEN(resource->user) = php_raw_url_decode(ZSTR_VAL(resource->user), ZSTR_LEN(resource->user)); - PHP_FTP_CNTRL_CHK(resource->user, tmp_len, "Invalid login %s") + PHP_FTP_CNTRL_CHK(ZSTR_VAL(resource->user), ZSTR_LEN(resource->user), "Invalid login %s") - php_stream_printf(stream, "USER %s\r\n", resource->user); + php_stream_printf(stream, "USER %s\r\n", ZSTR_VAL(resource->user)); } else { php_stream_write_string(stream, "USER anonymous\r\n"); } @@ -262,11 +262,11 @@ static php_stream *php_ftp_fopen_connect(php_stream_wrapper *wrapper, const char php_stream_notify_info(context, PHP_STREAM_NOTIFY_AUTH_REQUIRED, tmp_line, 0); if (resource->pass != NULL) { - tmp_len = (int)php_raw_url_decode(resource->pass, (int)strlen(resource->pass)); + ZSTR_LEN(resource->pass) = php_raw_url_decode(ZSTR_VAL(resource->pass), ZSTR_LEN(resource->pass)); - PHP_FTP_CNTRL_CHK(resource->pass, tmp_len, "Invalid password %s") + PHP_FTP_CNTRL_CHK(resource->pass, ZSTR_LEN(resource->pass), "Invalid password %s") - php_stream_printf(stream, "PASS %s\r\n", resource->pass); + php_stream_printf(stream, "PASS %s\r\n", ZSTR_VAL(resource->pass)); } else { /* if the user has configured who they are, send that as the password */ @@ -548,11 +548,11 @@ php_stream * php_stream_url_wrap_ftp(php_stream_wrapper *wrapper, const char *pa /* Append */ memcpy(tmp_line, "APPE", sizeof("APPE")); } - php_stream_printf(stream, "%s %s\r\n", tmp_line, (resource->path != NULL ? resource->path : "/")); + php_stream_printf(stream, "%s %s\r\n", tmp_line, (resource->path != NULL ? ZSTR_VAL(resource->path) : "/")); /* open the data channel */ if (hoststart == NULL) { - hoststart = resource->host; + hoststart = ZSTR_VAL(resource->host); } transport_len = (int)spprintf(&transport, 0, "tcp://%s:%d", hoststart, portno); datastream = php_stream_xport_create(transport, transport_len, REPORT_ERRORS, STREAM_XPORT_CLIENT | STREAM_XPORT_CONNECT, NULL, NULL, context, NULL, NULL); @@ -719,7 +719,7 @@ php_stream * php_stream_ftp_opendir(php_stream_wrapper *wrapper, const char *pat /* open the data channel */ if (hoststart == NULL) { - hoststart = resource->host; + hoststart = ZSTR_VAL(resource->host); } datastream = php_stream_sock_open_host(hoststart, portno, SOCK_STREAM, 0, 0); @@ -727,7 +727,7 @@ php_stream * php_stream_ftp_opendir(php_stream_wrapper *wrapper, const char *pat goto opendir_errexit; } - php_stream_printf(stream, "NLST %s\r\n", (resource->path != NULL ? resource->path : "/")); + php_stream_printf(stream, "NLST %s\r\n", (resource->path != NULL ? ZSTR_VAL(resource->path) : "/")); result = GET_FTP_RESULT(stream); if (result != 150 && result != 125) { @@ -792,7 +792,7 @@ static int php_stream_ftp_url_stat(php_stream_wrapper *wrapper, const char *url, } ssb->sb.st_mode = 0644; /* FTP won't give us a valid mode, so approximate one based on being readable */ - php_stream_printf(stream, "CWD %s\r\n", (resource->path != NULL ? resource->path : "/")); /* If we can CWD to it, it's a directory (maybe a link, but we can't tell) */ + php_stream_printf(stream, "CWD %s\r\n", (resource->path != NULL ? ZSTR_VAL(resource->path) : "/")); /* If we can CWD to it, it's a directory (maybe a link, but we can't tell) */ result = GET_FTP_RESULT(stream); if (result < 200 || result > 299) { ssb->sb.st_mode |= S_IFREG; @@ -808,7 +808,7 @@ static int php_stream_ftp_url_stat(php_stream_wrapper *wrapper, const char *url, goto stat_errexit; } - php_stream_printf(stream, "SIZE %s\r\n", (resource->path != NULL ? resource->path : "/")); + php_stream_printf(stream, "SIZE %s\r\n", (resource->path != NULL ? ZSTR_VAL(resource->path) : "/")); result = GET_FTP_RESULT(stream); if (result < 200 || result > 299) { /* Failure either means it doesn't exist @@ -823,7 +823,7 @@ static int php_stream_ftp_url_stat(php_stream_wrapper *wrapper, const char *url, ssb->sb.st_size = atoi(tmp_line + 4); } - php_stream_printf(stream, "MDTM %s\r\n", (resource->path != NULL ? resource->path : "/")); + php_stream_printf(stream, "MDTM %s\r\n", (resource->path != NULL ? ZSTR_VAL(resource->path) : "/")); result = GET_FTP_RESULT(stream); if (result == 213) { char *p = tmp_line + 4; @@ -922,7 +922,7 @@ static int php_stream_ftp_unlink(php_stream_wrapper *wrapper, const char *url, i } /* Attempt to delete the file */ - php_stream_printf(stream, "DELE %s\r\n", (resource->path != NULL ? resource->path : "/")); + php_stream_printf(stream, "DELE %s\r\n", (resource->path != NULL ? ZSTR_VAL(resource->path) : "/")); result = GET_FTP_RESULT(stream); if (result < 200 || result > 299) { @@ -965,10 +965,10 @@ static int php_stream_ftp_rename(php_stream_wrapper *wrapper, const char *url_fr !resource_to || !resource_from->scheme || !resource_to->scheme || - strcmp(resource_from->scheme, resource_to->scheme) || + !zend_string_equals(resource_from->scheme, resource_to->scheme) || !resource_from->host || !resource_to->host || - strcmp(resource_from->host, resource_to->host) || + !zend_string_equals(resource_from->host, resource_to->host) || (resource_from->port != resource_to->port && resource_from->port * resource_to->port != 0 && resource_from->port + resource_to->port != 21) || @@ -980,13 +980,13 @@ static int php_stream_ftp_rename(php_stream_wrapper *wrapper, const char *url_fr stream = php_ftp_fopen_connect(wrapper, url_from, "r", 0, NULL, context, NULL, NULL, NULL, NULL); if (!stream) { if (options & REPORT_ERRORS) { - php_error_docref(NULL, E_WARNING, "Unable to connect to %s", resource_from->host); + php_error_docref(NULL, E_WARNING, "Unable to connect to %s", ZSTR_VAL(resource_from->host)); } goto rename_errexit; } /* Rename FROM */ - php_stream_printf(stream, "RNFR %s\r\n", (resource_from->path != NULL ? resource_from->path : "/")); + php_stream_printf(stream, "RNFR %s\r\n", (resource_from->path != NULL ? ZSTR_VAL(resource_from->path) : "/")); result = GET_FTP_RESULT(stream); if (result < 300 || result > 399) { @@ -997,7 +997,7 @@ static int php_stream_ftp_rename(php_stream_wrapper *wrapper, const char *url_fr } /* Rename TO */ - php_stream_printf(stream, "RNTO %s\r\n", (resource_to->path != NULL ? resource_to->path : "/")); + php_stream_printf(stream, "RNTO %s\r\n", (resource_to->path != NULL ? ZSTR_VAL(resource_to->path) : "/")); result = GET_FTP_RESULT(stream); if (result < 200 || result > 299) { @@ -1051,14 +1051,14 @@ static int php_stream_ftp_mkdir(php_stream_wrapper *wrapper, const char *url, in } if (!recursive) { - php_stream_printf(stream, "MKD %s\r\n", resource->path); + php_stream_printf(stream, "MKD %s\r\n", ZSTR_VAL(resource->path)); result = GET_FTP_RESULT(stream); } else { /* we look for directory separator from the end of string, thus hopefuly reducing our work load */ char *p, *e, *buf; - buf = estrdup(resource->path); - e = buf + strlen(buf); + buf = estrndup(ZSTR_VAL(resource->path), ZSTR_LEN(resource->path)); + e = buf + ZSTR_LEN(resource->path); /* find a top level directory we need to create */ while ((p = strrchr(buf, '/'))) { @@ -1071,7 +1071,7 @@ static int php_stream_ftp_mkdir(php_stream_wrapper *wrapper, const char *url, in } } if (p == buf) { - php_stream_printf(stream, "MKD %s\r\n", resource->path); + php_stream_printf(stream, "MKD %s\r\n", ZSTR_VAL(resource->path)); result = GET_FTP_RESULT(stream); } else { php_stream_printf(stream, "MKD %s\r\n", buf); diff --git a/ext/standard/http_fopen_wrapper.c b/ext/standard/http_fopen_wrapper.c index d803593a6311b..78131fbcc5aa8 100644 --- a/ext/standard/http_fopen_wrapper.c +++ b/ext/standard/http_fopen_wrapper.c @@ -152,7 +152,8 @@ static php_stream *php_stream_url_wrap_http_ex(php_stream_wrapper *wrapper, return NULL; } - if (strncasecmp(resource->scheme, "http", sizeof("http")) && strncasecmp(resource->scheme, "https", sizeof("https"))) { + if (!zend_string_equals_literal_ci(resource->scheme, "http") && + !zend_string_equals_literal_ci(resource->scheme, "https")) { if (!context || (tmpzval = php_stream_context_get_option(context, wrapper->wops->label, "proxy")) == NULL || Z_TYPE_P(tmpzval) != IS_STRING || @@ -176,7 +177,7 @@ static php_stream *php_stream_url_wrap_http_ex(php_stream_wrapper *wrapper, return NULL; } - use_ssl = resource->scheme && (strlen(resource->scheme) > 4) && resource->scheme[4] == 's'; + use_ssl = resource->scheme && (ZSTR_LEN(resource->scheme) > 4) && ZSTR_VAL(resource->scheme)[4] == 's'; /* choose default ports */ if (use_ssl && resource->port == 0) resource->port = 443; @@ -191,7 +192,7 @@ static php_stream *php_stream_url_wrap_http_ex(php_stream_wrapper *wrapper, transport_len = Z_STRLEN_P(tmpzval); transport_string = estrndup(Z_STRVAL_P(tmpzval), Z_STRLEN_P(tmpzval)); } else { - transport_len = spprintf(&transport_string, 0, "%s://%s:%d", use_ssl ? "ssl" : "tcp", resource->host, resource->port); + transport_len = spprintf(&transport_string, 0, "%s://%s:%d", use_ssl ? "ssl" : "tcp", ZSTR_VAL(resource->host), resource->port); } } @@ -234,13 +235,13 @@ static php_stream *php_stream_url_wrap_http_ex(php_stream_wrapper *wrapper, /* Set peer_name or name verification will try to use the proxy server name */ if (!context || (tmpzval = php_stream_context_get_option(context, "ssl", "peer_name")) == NULL) { - ZVAL_STRING(&ssl_proxy_peer_name, resource->host); + ZVAL_STR_COPY(&ssl_proxy_peer_name, resource->host); php_stream_context_set_option(PHP_STREAM_CONTEXT(stream), "ssl", "peer_name", &ssl_proxy_peer_name); zval_ptr_dtor(&ssl_proxy_peer_name); } smart_str_appendl(&header, "CONNECT ", sizeof("CONNECT ")-1); - smart_str_appends(&header, resource->host); + smart_str_appends(&header, ZSTR_VAL(resource->host)); smart_str_appendc(&header, ':'); smart_str_append_unsigned(&header, resource->port); smart_str_appendl(&header, " HTTP/1.0\r\n", sizeof(" HTTP/1.0\r\n")-1); @@ -388,8 +389,8 @@ static php_stream *php_stream_url_wrap_http_ex(php_stream_wrapper *wrapper, /* Send the traditional /path/to/file?query_string */ /* file */ - if (resource->path && *resource->path) { - smart_str_appends(&req_buf, resource->path); + if (resource->path && ZSTR_LEN(resource->path)) { + smart_str_appends(&req_buf, ZSTR_VAL(resource->path)); } else { smart_str_appendc(&req_buf, '/'); } @@ -397,7 +398,7 @@ static php_stream *php_stream_url_wrap_http_ex(php_stream_wrapper *wrapper, /* query string */ if (resource->query) { smart_str_appendc(&req_buf, '?'); - smart_str_appends(&req_buf, resource->query); + smart_str_appends(&req_buf, ZSTR_VAL(resource->query)); } } @@ -531,15 +532,15 @@ static php_stream *php_stream_url_wrap_http_ex(php_stream_wrapper *wrapper, zend_string *stmp; /* decode the strings first */ - php_url_decode(resource->user, strlen(resource->user)); + php_url_decode(ZSTR_VAL(resource->user), ZSTR_LEN(resource->user)); - strcpy(scratch, resource->user); + strcpy(scratch, ZSTR_VAL(resource->user)); strcat(scratch, ":"); /* Note: password is optional! */ if (resource->pass) { - php_url_decode(resource->pass, strlen(resource->pass)); - strcat(scratch, resource->pass); + php_url_decode(ZSTR_VAL(resource->pass), ZSTR_LEN(resource->pass)); + strcat(scratch, ZSTR_VAL(resource->pass)); } stmp = php_base64_encode((unsigned char*)scratch, strlen(scratch)); @@ -564,7 +565,7 @@ static php_stream *php_stream_url_wrap_http_ex(php_stream_wrapper *wrapper, /* Send Host: header so name-based virtual hosts work */ if ((have_header & HTTP_HEADER_HOST) == 0) { smart_str_appends(&req_buf, "Host: "); - smart_str_appends(&req_buf, resource->host); + smart_str_appends(&req_buf, ZSTR_VAL(resource->host)); if ((use_ssl && resource->port != 443 && resource->port != 0) || (!use_ssl && resource->port != 80 && resource->port != 0)) { smart_str_appendc(&req_buf, ':'); @@ -855,21 +856,24 @@ static php_stream *php_stream_url_wrap_http_ex(php_stream_wrapper *wrapper, { if (*location != '/') { if (*(location+1) != '\0' && resource->path) { - char *s = strrchr(resource->path, '/'); + char *s = strrchr(ZSTR_VAL(resource->path), '/'); if (!s) { - s = resource->path; - if (!s[0]) { - efree(s); - s = resource->path = estrdup("/"); + s = ZSTR_VAL(resource->path); + if (!ZSTR_LEN(resource->path)) { + zend_string_release(resource->path); + resource->path = zend_string_init("/", 1, 0); + s = ZSTR_VAL(resource->path); } else { *s = '/'; } } s[1] = '\0'; - if (resource->path && *(resource->path) == '/' && *(resource->path + 1) == '\0') { - snprintf(loc_path, sizeof(loc_path) - 1, "%s%s", resource->path, location); + if (resource->path && + ZSTR_VAL(resource->path)[0] == '/' && + ZSTR_VAL(resource->path)[1] == '\0') { + snprintf(loc_path, sizeof(loc_path) - 1, "%s%s", ZSTR_VAL(resource->path), location); } else { - snprintf(loc_path, sizeof(loc_path) - 1, "%s/%s", resource->path, location); + snprintf(loc_path, sizeof(loc_path) - 1, "%s/%s", ZSTR_VAL(resource->path), location); } } else { snprintf(loc_path, sizeof(loc_path) - 1, "/%s", location); @@ -878,9 +882,9 @@ static php_stream *php_stream_url_wrap_http_ex(php_stream_wrapper *wrapper, strlcpy(loc_path, location, sizeof(loc_path)); } if ((use_ssl && resource->port != 443) || (!use_ssl && resource->port != 80)) { - snprintf(new_path, sizeof(new_path) - 1, "%s://%s:%d%s", resource->scheme, resource->host, resource->port, loc_path); + snprintf(new_path, sizeof(new_path) - 1, "%s://%s:%d%s", ZSTR_VAL(resource->scheme), ZSTR_VAL(resource->host), resource->port, loc_path); } else { - snprintf(new_path, sizeof(new_path) - 1, "%s://%s%s", resource->scheme, resource->host, loc_path); + snprintf(new_path, sizeof(new_path) - 1, "%s://%s%s", ZSTR_VAL(resource->scheme), ZSTR_VAL(resource->host), loc_path); } } else { strlcpy(new_path, location, sizeof(new_path)); @@ -896,9 +900,8 @@ static php_stream *php_stream_url_wrap_http_ex(php_stream_wrapper *wrapper, #define CHECK_FOR_CNTRL_CHARS(val) { \ if (val) { \ unsigned char *s, *e; \ - size_t l; \ - l = php_url_decode(val, strlen(val)); \ - s = (unsigned char*)val; e = s + l; \ + ZSTR_LEN(val) = php_url_decode(ZSTR_VAL(val), ZSTR_LEN(val)); \ + s = (unsigned char*)ZSTR_VAL(val); e = s + ZSTR_LEN(val); \ while (s < e) { \ if (iscntrl(*s)) { \ php_stream_wrapper_log_error(wrapper, options, "Invalid redirect URL! %s", new_path); \ @@ -910,9 +913,9 @@ static php_stream *php_stream_url_wrap_http_ex(php_stream_wrapper *wrapper, } /* check for control characters in login, password & path */ if (strncasecmp(new_path, "http://", sizeof("http://") - 1) || strncasecmp(new_path, "https://", sizeof("https://") - 1)) { - CHECK_FOR_CNTRL_CHARS(resource->user) - CHECK_FOR_CNTRL_CHARS(resource->pass) - CHECK_FOR_CNTRL_CHARS(resource->path) + CHECK_FOR_CNTRL_CHARS(resource->user); + CHECK_FOR_CNTRL_CHARS(resource->pass); + CHECK_FOR_CNTRL_CHARS(resource->path); } stream = php_stream_url_wrap_http_ex( wrapper, new_path, mode, options, opened_path, context, diff --git a/ext/standard/image.c b/ext/standard/image.c index 9deb5a8a7401b..5cd95ad4001c2 100644 --- a/ext/standard/image.c +++ b/ext/standard/image.c @@ -1186,7 +1186,7 @@ PHPAPI char * php_image_type_to_mime_type(int image_type) case IMAGE_FILETYPE_PSD: return "image/psd"; case IMAGE_FILETYPE_BMP: - return "image/x-ms-bmp"; + return "image/bmp"; case IMAGE_FILETYPE_TIFF_II: case IMAGE_FILETYPE_TIFF_MM: return "image/tiff"; diff --git a/ext/standard/iptc.c b/ext/standard/iptc.c index e92e721b88eeb..797e2a2ecaba6 100644 --- a/ext/standard/iptc.c +++ b/ext/standard/iptc.c @@ -275,7 +275,7 @@ PHP_FUNCTION(iptcembed) iptcdata_len++; /* make the length even */ } - psheader[ 2 ] = (iptcdata_len+28)>>8; + psheader[ 2 ] = (char) (iptcdata_len+28)>>8; psheader[ 3 ] = (iptcdata_len+28)&0xff; for (inx = 0; inx < 28; inx++) { diff --git a/ext/standard/lcg.c b/ext/standard/lcg.c index af826c547bc0e..f8b7e8d340a5b 100644 --- a/ext/standard/lcg.c +++ b/ext/standard/lcg.c @@ -118,6 +118,9 @@ PHP_MINIT_FUNCTION(lcg) /* {{{ */ Returns a value from the combined linear congruential generator */ PHP_FUNCTION(lcg_value) { + if (zend_parse_parameters_none() == FAILURE) { + return; + } RETURN_DOUBLE(php_combined_lcg()); } /* }}} */ diff --git a/ext/standard/link.c b/ext/standard/link.c index c55e6f4b0aac5..7e0a6d3876309 100644 --- a/ext/standard/link.c +++ b/ext/standard/link.c @@ -57,7 +57,7 @@ PHP_FUNCTION(readlink) char *link; size_t link_len; char buff[MAXPATHLEN]; - int ret; + ssize_t ret; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_PATH(link, link_len) diff --git a/ext/standard/link_win32.c b/ext/standard/link_win32.c index 53ce7fbb4d8cd..406526128f3d9 100644 --- a/ext/standard/link_win32.c +++ b/ext/standard/link_win32.c @@ -63,7 +63,7 @@ PHP_FUNCTION(readlink) { char *link; - size_t link_len; + ssize_t link_len; char target[MAXPATHLEN]; if (zend_parse_parameters(ZEND_NUM_ARGS(), "p", &link, &link_len) == FAILURE) { @@ -74,7 +74,8 @@ PHP_FUNCTION(readlink) RETURN_FALSE; } - if (php_sys_readlink(link, target, MAXPATHLEN) == -1) { + link_len = php_sys_readlink(link, target, MAXPATHLEN); + if (link_len == -1) { php_error_docref(NULL, E_WARNING, "readlink failed to read the symbolic link (%s), error %d)", link, GetLastError()); RETURN_FALSE; } diff --git a/ext/standard/math.c b/ext/standard/math.c index 6f7bede332ace..8285edeeda7dc 100644 --- a/ext/standard/math.c +++ b/ext/standard/math.c @@ -1193,7 +1193,7 @@ PHPAPI zend_string *_php_math_number_format_ex(double d, int dec, char *dec_poin * we requested due to internal buffer limitations */ if (dec) { size_t declen = (dp ? s - dp : 0); - size_t topad = dec > declen ? dec - declen : 0; + size_t topad = (size_t)dec > declen ? dec - declen : 0; /* pad with '0's */ while (topad--) { diff --git a/ext/standard/microtime.c b/ext/standard/microtime.c index 0373a32a5dad7..aa63a6e42e9da 100644 --- a/ext/standard/microtime.c +++ b/ext/standard/microtime.c @@ -136,7 +136,7 @@ PHP_FUNCTION(getrusage) #ifdef PHP_WIN32 /* Windows only implements a limited amount of fields from the rusage struct */ PHP_RUSAGE_PARA(ru_majflt); PHP_RUSAGE_PARA(ru_maxrss); -#elif !defined( _OSD_POSIX) && !defined(__BEOS__) /* BS2000 has only a few fields in the rusage struct*/ +#elif !defined(_OSD_POSIX) PHP_RUSAGE_PARA(ru_oublock); PHP_RUSAGE_PARA(ru_inblock); PHP_RUSAGE_PARA(ru_msgsnd); diff --git a/ext/standard/password.c b/ext/standard/password.c index 680eed47a807b..d6fc66c610f7e 100644 --- a/ext/standard/password.c +++ b/ext/standard/password.c @@ -415,9 +415,6 @@ PHP_FUNCTION(password_hash) zend_long algo = PHP_PASSWORD_DEFAULT; HashTable *options = NULL; -#if HAVE_ARGON2LIB -#endif - ZEND_PARSE_PARAMETERS_START(2, 3) Z_PARAM_STR(password) Z_PARAM_LONG(algo) diff --git a/ext/standard/php_dns.h b/ext/standard/php_dns.h index a95e2c0d7e918..8905ff97d427f 100644 --- a/ext/standard/php_dns.h +++ b/ext/standard/php_dns.h @@ -65,7 +65,7 @@ PHP_FUNCTION(gethostbynamel); PHP_FUNCTION(gethostname); #endif -#if defined(PHP_WIN32) || (HAVE_DNS_SEARCH_FUNC && !defined(__BEOS__)) +#if defined(PHP_WIN32) || HAVE_DNS_SEARCH_FUNC PHP_FUNCTION(dns_check_record); # if defined(PHP_WIN32) || HAVE_FULL_DNS_FUNCS @@ -74,7 +74,7 @@ PHP_FUNCTION(dns_get_record); PHP_MINIT_FUNCTION(dns); # endif -#endif /* defined(PHP_WIN32) || (HAVE_DNS_SEARCH_FUNC && !defined(__BEOS__)) */ +#endif /* defined(PHP_WIN32) || HAVE_DNS_SEARCH_FUNC */ #ifndef INT16SZ #define INT16SZ 2 diff --git a/ext/standard/php_fopen_wrapper.c b/ext/standard/php_fopen_wrapper.c index 0031440704d10..8e7b95e7399a1 100644 --- a/ext/standard/php_fopen_wrapper.c +++ b/ext/standard/php_fopen_wrapper.c @@ -28,6 +28,7 @@ #include "php.h" #include "php_globals.h" #include "php_standard.h" +#include "php_memory_streams.h" #include "php_fopen_wrappers.h" #include "SAPI.h" @@ -203,20 +204,12 @@ php_stream * php_stream_url_wrap_php(php_stream_wrapper *wrapper, const char *pa return NULL; } } - if (strpbrk(mode, "wa+")) { - mode_rw = TEMP_STREAM_DEFAULT; - } else { - mode_rw = TEMP_STREAM_READONLY; - } + mode_rw = php_stream_mode_from_str(mode); return php_stream_temp_create(mode_rw, max_memory); } if (!strcasecmp(path, "memory")) { - if (strpbrk(mode, "wa+")) { - mode_rw = TEMP_STREAM_DEFAULT; - } else { - mode_rw = TEMP_STREAM_READONLY; - } + mode_rw = php_stream_mode_from_str(mode); return php_stream_memory_create(mode_rw); } @@ -395,7 +388,7 @@ php_stream * php_stream_url_wrap_php(php_stream_wrapper *wrapper, const char *pa return NULL; } -#if defined(S_IFSOCK) && !defined(WIN32) && !defined(__BEOS__) +#if defined(S_IFSOCK) && !defined(PHP_WIN32) do { zend_stat_t st; memset(&st, 0, sizeof(st)); diff --git a/ext/standard/streamsfuncs.c b/ext/standard/streamsfuncs.c index 475fb060be420..afd8088caf28b 100644 --- a/ext/standard/streamsfuncs.c +++ b/ext/standard/streamsfuncs.c @@ -665,8 +665,7 @@ static int stream_array_from_fd_set(zval *stream_array, fd_set *fds) if (Z_TYPE_P(stream_array) != IS_ARRAY) { return 0; } - ZVAL_NEW_ARR(&new_array); - zend_hash_init(Z_ARRVAL(new_array), zend_hash_num_elements(Z_ARRVAL_P(stream_array)), NULL, ZVAL_PTR_DTOR, 0); + array_init_size(&new_array, zend_hash_num_elements(Z_ARRVAL_P(stream_array))); ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(stream_array), num_ind, key, elem) { php_socket_t this_fd; @@ -714,8 +713,7 @@ static int stream_array_emulate_read_fd_set(zval *stream_array) if (Z_TYPE_P(stream_array) != IS_ARRAY) { return 0; } - ZVAL_NEW_ARR(&new_array); - zend_hash_init(Z_ARRVAL(new_array), zend_hash_num_elements(Z_ARRVAL_P(stream_array)), NULL, ZVAL_PTR_DTOR, 0); + array_init_size(&new_array, zend_hash_num_elements(Z_ARRVAL_P(stream_array))); ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(stream_array), elem) { ZVAL_DEREF(elem); @@ -1559,7 +1557,7 @@ PHP_FUNCTION(stream_resolve_include_path) Z_PARAM_PATH(filename, filename_len) ZEND_PARSE_PARAMETERS_END(); - resolved_path = zend_resolve_path(filename, (int)filename_len); + resolved_path = zend_resolve_path(filename, filename_len); if (resolved_path) { RETURN_STR(resolved_path); diff --git a/ext/standard/string.c b/ext/standard/string.c index 6ffc2ae2bb023..55bcca14dbac8 100644 --- a/ext/standard/string.c +++ b/ext/standard/string.c @@ -2789,11 +2789,16 @@ PHP_FUNCTION(chr) /* {{{ php_ucfirst Uppercase the first character of the word in a native string */ -static void php_ucfirst(char *str) +static zend_string* php_ucfirst(zend_string *str) { - register char *r; - r = str; - *r = toupper((unsigned char) *r); + unsigned char r = toupper(ZSTR_VAL(str)[0]); + if (r == ZSTR_VAL(str)[0]) { + return zend_string_copy(str); + } else { + zend_string *s = zend_string_init(ZSTR_VAL(str), ZSTR_LEN(str), 0); + ZSTR_VAL(s)[0] = r; + return s; + } } /* }}} */ @@ -2811,18 +2816,22 @@ PHP_FUNCTION(ucfirst) RETURN_EMPTY_STRING(); } - ZVAL_STRINGL(return_value, ZSTR_VAL(str), ZSTR_LEN(str)); - php_ucfirst(Z_STRVAL_P(return_value)); + RETURN_STR(php_ucfirst(str)); } /* }}} */ /* {{{ Lowercase the first character of the word in a native string */ -static void php_lcfirst(char *str) +static zend_string* php_lcfirst(zend_string *str) { - register char *r; - r = str; - *r = tolower((unsigned char) *r); + unsigned char r = tolower(ZSTR_VAL(str)[0]); + if (r == ZSTR_VAL(str)[0]) { + return zend_string_copy(str); + } else { + zend_string *s = zend_string_init(ZSTR_VAL(str), ZSTR_LEN(str), 0); + ZSTR_VAL(s)[0] = r; + return s; + } } /* }}} */ @@ -2840,8 +2849,7 @@ PHP_FUNCTION(lcfirst) RETURN_EMPTY_STRING(); } - ZVAL_STRINGL(return_value, ZSTR_VAL(str), ZSTR_LEN(str)); - php_lcfirst(Z_STRVAL_P(return_value)); + RETURN_STR(php_lcfirst(str)); } /* }}} */ diff --git a/ext/standard/tests/array/array_change_key_case_variation1.phpt b/ext/standard/tests/array/array_change_key_case_variation1.phpt index 86653930f1b76..cf7369396537b 100644 --- a/ext/standard/tests/array/array_change_key_case_variation1.phpt +++ b/ext/standard/tests/array/array_change_key_case_variation1.phpt @@ -3,7 +3,7 @@ Test array_change_key_case() function : usage variations - Pass different data t --FILE-- int(24) ["mime"]=> - string(14) "image/x-ms-bmp" + string(9) "image/bmp" } ["test12pix.webp"]=> array(6) { @@ -67,7 +67,7 @@ array(16) { ["bits"]=> int(32) ["mime"]=> - string(14) "image/x-ms-bmp" + string(9) "image/bmp" } ["test1pix.bmp"]=> array(6) { @@ -82,7 +82,7 @@ array(16) { ["bits"]=> int(24) ["mime"]=> - string(14) "image/x-ms-bmp" + string(9) "image/bmp" } ["test1pix.jp2"]=> array(7) { diff --git a/ext/standard/tests/image/getimagesize_basic.phpt b/ext/standard/tests/image/getimagesize_basic.phpt index 4d472258180a2..63ae334066ad1 100644 --- a/ext/standard/tests/image/getimagesize_basic.phpt +++ b/ext/standard/tests/image/getimagesize_basic.phpt @@ -138,7 +138,7 @@ array(6) { ["bits"]=> int(24) ["mime"]=> - string(14) "image/x-ms-bmp" + string(9) "image/bmp" } array(0) { } diff --git a/ext/standard/tests/image/image_type_to_mime_type.phpt b/ext/standard/tests/image/image_type_to_mime_type.phpt index 4ae56802389a8..38a90c1bb33f7 100644 --- a/ext/standard/tests/image/image_type_to_mime_type.phpt +++ b/ext/standard/tests/image/image_type_to_mime_type.phpt @@ -27,13 +27,13 @@ image_type_to_mime_type() --EXPECT-- array(16) { ["test-1pix.bmp"]=> - string(14) "image/x-ms-bmp" + string(9) "image/bmp" ["test12pix.webp"]=> string(10) "image/webp" ["test1bpix.bmp"]=> - string(14) "image/x-ms-bmp" + string(9) "image/bmp" ["test1pix.bmp"]=> - string(14) "image/x-ms-bmp" + string(9) "image/bmp" ["test1pix.jp2"]=> string(9) "image/jp2" ["test1pix.jpc"]=> diff --git a/ext/standard/tests/image/image_type_to_mime_type_basic.phpt b/ext/standard/tests/image/image_type_to_mime_type_basic.phpt index 5506570494f32..9ee91961c243d 100644 --- a/ext/standard/tests/image/image_type_to_mime_type_basic.phpt +++ b/ext/standard/tests/image/image_type_to_mime_type_basic.phpt @@ -49,7 +49,7 @@ string(10) "image/jpeg" string(9) "image/png" string(29) "application/x-shockwave-flash" string(9) "image/psd" -string(14) "image/x-ms-bmp" +string(9) "image/bmp" string(10) "image/tiff" string(10) "image/tiff" string(24) "application/octet-stream" diff --git a/ext/standard/tests/image/image_type_to_mime_type_variation3.phpt b/ext/standard/tests/image/image_type_to_mime_type_variation3.phpt index 7b06c0a145b65..1b4f418cdbd1b 100644 --- a/ext/standard/tests/image/image_type_to_mime_type_variation3.phpt +++ b/ext/standard/tests/image/image_type_to_mime_type_variation3.phpt @@ -39,7 +39,7 @@ string\(29\) "application\/x-shockwave-flash" string\(9\) "image\/psd" -- Iteration 6 -- -string\(14\) "image\/x-ms-bmp" +string\(9\) "image\/bmp" -- Iteration 7 -- string\(10\) "image\/tiff" diff --git a/ext/standard/tests/math/lcg_value_basic.phpt b/ext/standard/tests/math/lcg_value_basic.phpt index 6d624d84ab04b..8fc95190c6e78 100644 --- a/ext/standard/tests/math/lcg_value_basic.phpt +++ b/ext/standard/tests/math/lcg_value_basic.phpt @@ -21,36 +21,38 @@ if ($i != 100) { echo "PASSED\n"; } -echo "\n lcg_value error cases..spurious args get ignored\n"; +echo "\n lcg_value error cases..\n"; $res = lcg_value(23); -if (!is_float($res) || $res < 0 || $res > 1) { - echo "FAILED\n"; -} else { +if (is_null($res)) { echo "PASSED\n"; +} else { + echo "FAILED\n"; } $res = lcg_value(10,false); -if (!is_float($res) || $res < 0 || $res > 1) { - echo "FAILED\n"; -} else { +if (is_null($res)) { echo "PASSED\n"; +} else { + echo "FAILED\n"; } echo "MATHS test script completed\n"; ?> ---EXPECT-- +--EXPECTF-- MATHS test script started lcg_value tests... PASSED - lcg_value error cases..spurious args get ignored + lcg_value error cases.. + +Warning: lcg_value() expects exactly 0 parameters, 1 given in %slcg_value_basic.php on line %d PASSED + +Warning: lcg_value() expects exactly 0 parameters, 2 given in %slcg_value_basic.php on line %d PASSED MATHS test script completed - - diff --git a/ext/standard/tests/math/rand_inverted_order.phpt b/ext/standard/tests/math/rand_inverted_order.phpt new file mode 100644 index 0000000000000..ac904b21ed7d4 --- /dev/null +++ b/ext/standard/tests/math/rand_inverted_order.phpt @@ -0,0 +1,20 @@ +--TEST-- +Test rand funtion when min and max are in proper or inverted order +--CREDIT-- +PHP TestFEst 2017 - PHPDublin, PHPSP - Joao P V Martins +--FILE-- += $min_value); +var_dump($correct_order <= $max_value); +var_dump($incorrect_order >= $min_value); +var_dump($incorrect_order <= $max_value); +?> +--EXPECT-- +bool(true) +bool(true) +bool(true) +bool(true) diff --git a/ext/standard/tests/setrawcookie_basic_001.phpt b/ext/standard/tests/setrawcookie_basic_001.phpt new file mode 100644 index 0000000000000..4a6fcc8d9baa8 --- /dev/null +++ b/ext/standard/tests/setrawcookie_basic_001.phpt @@ -0,0 +1,10 @@ +--TEST-- +Test setrawcookie basic functionality +--CREDIT-- +PHP TestFEst 2017 - PHPDublin, PHPSP - Joao P V Martins +--FILE-- + +--EXPECT-- +bool(true) diff --git a/ext/standard/tests/setrawcookie_basic_002.phpt b/ext/standard/tests/setrawcookie_basic_002.phpt new file mode 100644 index 0000000000000..fc98c8dcf4f77 --- /dev/null +++ b/ext/standard/tests/setrawcookie_basic_002.phpt @@ -0,0 +1,12 @@ +--TEST-- +Test setrawcookie to fail when output exists before +--CREDIT-- +PHP TestFEst 2017 - PHPDublin, PHPSP - Joao P V Martins +--FILE-- + +--EXPECT-- +output +bool(false) diff --git a/ext/standard/tests/streams/bug75031.phpt b/ext/standard/tests/streams/bug75031.phpt new file mode 100644 index 0000000000000..f0d67a35243fd --- /dev/null +++ b/ext/standard/tests/streams/bug75031.phpt @@ -0,0 +1,25 @@ +--TEST-- +Bug #75031: Append mode in php://temp and php://memory +--FILE-- + +--EXPECT-- +string(5) "world" +string(5) "world" +string(10) "helloworld" +string(10) "helloworld" diff --git a/ext/standard/url.c b/ext/standard/url.c index a3a19a2b22c6f..e909eee34744f 100644 --- a/ext/standard/url.c +++ b/ext/standard/url.c @@ -42,19 +42,19 @@ PHPAPI void php_url_free(php_url *theurl) { if (theurl->scheme) - efree(theurl->scheme); + zend_string_release(theurl->scheme); if (theurl->user) - efree(theurl->user); + zend_string_release(theurl->user); if (theurl->pass) - efree(theurl->pass); + zend_string_release(theurl->pass); if (theurl->host) - efree(theurl->host); + zend_string_release(theurl->host); if (theurl->path) - efree(theurl->path); + zend_string_release(theurl->path); if (theurl->query) - efree(theurl->query); + zend_string_release(theurl->query); if (theurl->fragment) - efree(theurl->fragment); + zend_string_release(theurl->fragment); efree(theurl); } /* }}} */ @@ -124,8 +124,8 @@ PHPAPI php_url *php_url_parse_ex(char const *str, size_t length) } if (e + 1 == ue) { /* only scheme is available */ - ret->scheme = estrndup(s, (e - s)); - php_replace_controlchars_ex(ret->scheme, (e - s)); + ret->scheme = zend_string_init(s, (e - s), 0); + php_replace_controlchars_ex(ZSTR_VAL(ret->scheme), ZSTR_LEN(ret->scheme)); return ret; } @@ -146,18 +146,18 @@ PHPAPI php_url *php_url_parse_ex(char const *str, size_t length) goto parse_port; } - ret->scheme = estrndup(s, (e-s)); - php_replace_controlchars_ex(ret->scheme, (e - s)); + ret->scheme = zend_string_init(s, (e-s), 0); + php_replace_controlchars_ex(ZSTR_VAL(ret->scheme), ZSTR_LEN(ret->scheme)); s = e + 1; goto just_path; } else { - ret->scheme = estrndup(s, (e-s)); - php_replace_controlchars_ex(ret->scheme, (e - s)); + ret->scheme = zend_string_init(s, (e-s), 0); + php_replace_controlchars_ex(ZSTR_VAL(ret->scheme), ZSTR_LEN(ret->scheme)); if (e + 2 < ue && *(e + 2) == '/') { s = e + 3; - if (!strncasecmp("file", ret->scheme, sizeof("file"))) { + if (zend_string_equals_literal_ci(ret->scheme, "file")) { if (e + 3 < ue && *(e + 3) == '/') { /* support windows drive letters as in: file:///c:/somedir/file.txt @@ -193,13 +193,11 @@ PHPAPI php_url *php_url_parse_ex(char const *str, size_t length) s += 2; } } else { - if (ret->scheme) efree(ret->scheme); - efree(ret); + php_url_free(ret); return NULL; } } else if (p == pp && pp == ue) { - if (ret->scheme) efree(ret->scheme); - efree(ret); + php_url_free(ret); return NULL; } else if (s + 1 < ue && *s == '/' && *(s + 1) == '/') { /* relative-scheme URL */ s += 2; @@ -228,15 +226,15 @@ PHPAPI php_url *php_url_parse_ex(char const *str, size_t length) /* check for login and password */ if ((p = zend_memrchr(s, '@', (e-s)))) { if ((pp = memchr(s, ':', (p-s)))) { - ret->user = estrndup(s, (pp-s)); - php_replace_controlchars_ex(ret->user, (pp - s)); + ret->user = zend_string_init(s, (pp-s), 0); + php_replace_controlchars_ex(ZSTR_VAL(ret->user), ZSTR_LEN(ret->user)); pp++; - ret->pass = estrndup(pp, (p-pp)); - php_replace_controlchars_ex(ret->pass, (p-pp)); + ret->pass = zend_string_init(pp, (p-pp), 0); + php_replace_controlchars_ex(ZSTR_VAL(ret->pass), ZSTR_LEN(ret->pass)); } else { - ret->user = estrndup(s, (p-s)); - php_replace_controlchars_ex(ret->user, (p-s)); + ret->user = zend_string_init(s, (p-s), 0); + php_replace_controlchars_ex(ZSTR_VAL(ret->user), ZSTR_LEN(ret->user)); } s = p + 1; @@ -256,10 +254,7 @@ PHPAPI php_url *php_url_parse_ex(char const *str, size_t length) if (!ret->port) { p++; if (e-p > 5) { /* port cannot be longer then 5 characters */ - if (ret->scheme) efree(ret->scheme); - if (ret->user) efree(ret->user); - if (ret->pass) efree(ret->pass); - efree(ret); + php_url_free(ret); return NULL; } else if (e - p > 0) { zend_long port; @@ -269,10 +264,7 @@ PHPAPI php_url *php_url_parse_ex(char const *str, size_t length) if (port > 0 && port <= 65535) { ret->port = (unsigned short)port; } else { - if (ret->scheme) efree(ret->scheme); - if (ret->user) efree(ret->user); - if (ret->pass) efree(ret->pass); - efree(ret); + php_url_free(ret); return NULL; } } @@ -284,15 +276,12 @@ PHPAPI php_url *php_url_parse_ex(char const *str, size_t length) /* check if we have a valid host, if we don't reject the string as url */ if ((p-s) < 1) { - if (ret->scheme) efree(ret->scheme); - if (ret->user) efree(ret->user); - if (ret->pass) efree(ret->pass); - efree(ret); + php_url_free(ret); return NULL; } - ret->host = estrndup(s, (p-s)); - php_replace_controlchars_ex(ret->host, (p - s)); + ret->host = zend_string_init(s, (p-s), 0); + php_replace_controlchars_ex(ZSTR_VAL(ret->host), ZSTR_LEN(ret->host)); if (e == ue) { return ret; @@ -307,8 +296,8 @@ PHPAPI php_url *php_url_parse_ex(char const *str, size_t length) if (p) { p++; if (p < e) { - ret->fragment = estrndup(p, (e - p)); - php_replace_controlchars_ex(ret->fragment, (e - p)); + ret->fragment = zend_string_init(p, (e - p), 0); + php_replace_controlchars_ex(ZSTR_VAL(ret->fragment), ZSTR_LEN(ret->fragment)); } e = p-1; } @@ -317,15 +306,15 @@ PHPAPI php_url *php_url_parse_ex(char const *str, size_t length) if (p) { p++; if (p < e) { - ret->query = estrndup(p, (e - p)); - php_replace_controlchars_ex(ret->query, (e - p)); + ret->query = zend_string_init(p, (e - p), 0); + php_replace_controlchars_ex(ZSTR_VAL(ret->query), ZSTR_LEN(ret->query)); } e = p-1; } if (s < e || s == ue) { - ret->path = estrndup(s, (e - s)); - php_replace_controlchars_ex(ret->path, (e - s)); + ret->path = zend_string_init(s, (e - s), 0); + php_replace_controlchars_ex(ZSTR_VAL(ret->path), ZSTR_LEN(ret->path)); } return ret; @@ -357,28 +346,28 @@ PHP_FUNCTION(parse_url) if (key > -1) { switch (key) { case PHP_URL_SCHEME: - if (resource->scheme != NULL) RETVAL_STRING(resource->scheme); + if (resource->scheme != NULL) RETVAL_STR_COPY(resource->scheme); break; case PHP_URL_HOST: - if (resource->host != NULL) RETVAL_STRING(resource->host); + if (resource->host != NULL) RETVAL_STR_COPY(resource->host); break; case PHP_URL_PORT: if (resource->port != 0) RETVAL_LONG(resource->port); break; case PHP_URL_USER: - if (resource->user != NULL) RETVAL_STRING(resource->user); + if (resource->user != NULL) RETVAL_STR_COPY(resource->user); break; case PHP_URL_PASS: - if (resource->pass != NULL) RETVAL_STRING(resource->pass); + if (resource->pass != NULL) RETVAL_STR_COPY(resource->pass); break; case PHP_URL_PATH: - if (resource->path != NULL) RETVAL_STRING(resource->path); + if (resource->path != NULL) RETVAL_STR_COPY(resource->path); break; case PHP_URL_QUERY: - if (resource->query != NULL) RETVAL_STRING(resource->query); + if (resource->query != NULL) RETVAL_STR_COPY(resource->query); break; case PHP_URL_FRAGMENT: - if (resource->fragment != NULL) RETVAL_STRING(resource->fragment); + if (resource->fragment != NULL) RETVAL_STR_COPY(resource->fragment); break; default: php_error_docref(NULL, E_WARNING, "Invalid URL component identifier " ZEND_LONG_FMT, key); @@ -392,11 +381,11 @@ PHP_FUNCTION(parse_url) /* add the various elements to the array */ if (resource->scheme != NULL) { - ZVAL_STRING(&tmp, resource->scheme); + ZVAL_STR_COPY(&tmp, resource->scheme); zend_hash_add_new(Z_ARRVAL_P(return_value), ZSTR_KNOWN(ZEND_STR_SCHEME), &tmp); } if (resource->host != NULL) { - ZVAL_STRING(&tmp, resource->host); + ZVAL_STR_COPY(&tmp, resource->host); zend_hash_add_new(Z_ARRVAL_P(return_value), ZSTR_KNOWN(ZEND_STR_HOST), &tmp); } if (resource->port != 0) { @@ -404,23 +393,23 @@ PHP_FUNCTION(parse_url) zend_hash_add_new(Z_ARRVAL_P(return_value), ZSTR_KNOWN(ZEND_STR_PORT), &tmp); } if (resource->user != NULL) { - ZVAL_STRING(&tmp, resource->user); + ZVAL_STR_COPY(&tmp, resource->user); zend_hash_add_new(Z_ARRVAL_P(return_value), ZSTR_KNOWN(ZEND_STR_USER), &tmp); } if (resource->pass != NULL) { - ZVAL_STRING(&tmp, resource->pass); + ZVAL_STR_COPY(&tmp, resource->pass); zend_hash_add_new(Z_ARRVAL_P(return_value), ZSTR_KNOWN(ZEND_STR_PASS), &tmp); } if (resource->path != NULL) { - ZVAL_STRING(&tmp, resource->path); + ZVAL_STR_COPY(&tmp, resource->path); zend_hash_add_new(Z_ARRVAL_P(return_value), ZSTR_KNOWN(ZEND_STR_PATH), &tmp); } if (resource->query != NULL) { - ZVAL_STRING(&tmp, resource->query); + ZVAL_STR_COPY(&tmp, resource->query); zend_hash_add_new(Z_ARRVAL_P(return_value), ZSTR_KNOWN(ZEND_STR_QUERY), &tmp); } if (resource->fragment != NULL) { - ZVAL_STRING(&tmp, resource->fragment); + ZVAL_STR_COPY(&tmp, resource->fragment); zend_hash_add_new(Z_ARRVAL_P(return_value), ZSTR_KNOWN(ZEND_STR_FRAGMENT), &tmp); } done: diff --git a/ext/standard/url.h b/ext/standard/url.h index 7a2f20ed2b0a1..8c4e63e60e686 100644 --- a/ext/standard/url.h +++ b/ext/standard/url.h @@ -21,14 +21,14 @@ #define URL_H typedef struct php_url { - char *scheme; - char *user; - char *pass; - char *host; + zend_string *scheme; + zend_string *user; + zend_string *pass; + zend_string *host; unsigned short port; - char *path; - char *query; - char *fragment; + zend_string *path; + zend_string *query; + zend_string *fragment; } php_url; PHPAPI void php_url_free(php_url *theurl); diff --git a/ext/standard/url_scanner_ex.c b/ext/standard/url_scanner_ex.c index 484d5d9c131c6..2698b96f055ed 100644 --- a/ext/standard/url_scanner_ex.c +++ b/ext/standard/url_scanner_ex.c @@ -182,8 +182,6 @@ PHP_INI_END() static inline void append_modified_url(smart_str *url, smart_str *dest, smart_str *url_app, const char *separator) { php_url *url_parts; - char *tmp; - size_t tmp_len; smart_str_0(url); /* FIXME: Bug #70480 php_url_parse_ex() crashes by processing chars exceed len */ url_parts = php_url_parse_ex(ZSTR_VAL(url->s), ZSTR_LEN(url->s)); @@ -196,21 +194,23 @@ static inline void append_modified_url(smart_str *url, smart_str *dest, smart_st /* Check protocol. Only http/https is allowed. */ if (url_parts->scheme - && strcasecmp("http", url_parts->scheme) - && strcasecmp("https", url_parts->scheme)) { + && !zend_string_equals_literal_ci(url_parts->scheme, "http") + && !zend_string_equals_literal_ci(url_parts->scheme, "https")) { smart_str_append_smart_str(dest, url); php_url_free(url_parts); return; } /* Check host whitelist. If it's not listed, do nothing. */ - if (url_parts->host - && (tmp_len = strlen(url_parts->host)) - && (tmp = php_strtolower(url_parts->host, tmp_len)) - && !zend_hash_str_find(&BG(url_adapt_session_hosts_ht), tmp, tmp_len)) { - smart_str_append_smart_str(dest, url); - php_url_free(url_parts); - return; + if (url_parts->host) { + zend_string *tmp = zend_string_tolower(url_parts->host); + if (!zend_hash_exists(&BG(url_adapt_session_hosts_ht), tmp)) { + zend_string_release(tmp); + smart_str_append_smart_str(dest, url); + php_url_free(url_parts); + return; + } + zend_string_release(tmp); } /* @@ -229,32 +229,32 @@ static inline void append_modified_url(smart_str *url, smart_str *dest, smart_st } if (url_parts->scheme) { - smart_str_appends(dest, url_parts->scheme); + smart_str_appends(dest, ZSTR_VAL(url_parts->scheme)); smart_str_appends(dest, "://"); } else if (*(ZSTR_VAL(url->s)) == '/' && *(ZSTR_VAL(url->s)+1) == '/') { smart_str_appends(dest, "//"); } if (url_parts->user) { - smart_str_appends(dest, url_parts->user); + smart_str_appends(dest, ZSTR_VAL(url_parts->user)); if (url_parts->pass) { - smart_str_appends(dest, url_parts->pass); + smart_str_appends(dest, ZSTR_VAL(url_parts->pass)); smart_str_appendc(dest, ':'); } smart_str_appendc(dest, '@'); } if (url_parts->host) { - smart_str_appends(dest, url_parts->host); + smart_str_appends(dest, ZSTR_VAL(url_parts->host)); } if (url_parts->port) { smart_str_appendc(dest, ':'); smart_str_append_unsigned(dest, (long)url_parts->port); } if (url_parts->path) { - smart_str_appends(dest, url_parts->path); + smart_str_appends(dest, ZSTR_VAL(url_parts->path)); } smart_str_appendc(dest, '?'); if (url_parts->query) { - smart_str_appends(dest, url_parts->query); + smart_str_appends(dest, ZSTR_VAL(url_parts->query)); smart_str_appends(dest, separator); smart_str_append_smart_str(dest, url_app); } else { @@ -262,7 +262,7 @@ static inline void append_modified_url(smart_str *url, smart_str *dest, smart_st } if (url_parts->fragment) { smart_str_appendc(dest, '#'); - smart_str_appends(dest, url_parts->fragment); + smart_str_appends(dest, ZSTR_VAL(url_parts->fragment)); } php_url_free(url_parts); } @@ -383,8 +383,8 @@ static int check_host_whitelist(url_adapt_state_ex_t *ctx) if (url_parts->scheme) { /* Only http/https should be handled. A bit hacky check this here, but saves a URL parse. */ - if (strcasecmp(url_parts->scheme, "http") && - strcasecmp(url_parts->scheme, "https")) { + if (!zend_string_equals_literal_ci(url_parts->scheme, "http") && + !zend_string_equals_literal_ci(url_parts->scheme, "https")) { php_url_free(url_parts); return FAILURE; } @@ -394,13 +394,11 @@ static int check_host_whitelist(url_adapt_state_ex_t *ctx) return SUCCESS; } if (!zend_hash_num_elements(allowed_hosts) && - check_http_host(url_parts->host) == SUCCESS) { + check_http_host(ZSTR_VAL(url_parts->host)) == SUCCESS) { php_url_free(url_parts); return SUCCESS; } - if (!zend_hash_str_find(allowed_hosts, - url_parts->host, - strlen(url_parts->host))) { + if (!zend_hash_find(allowed_hosts, url_parts->host)) { php_url_free(url_parts); return FAILURE; } @@ -513,7 +511,7 @@ static inline void xx_mainloop(url_adapt_state_ex_t *ctx, const char *newdata, s state_plain: start = YYCURSOR; -#line 517 "ext/standard/url_scanner_ex.c" +#line 515 "ext/standard/url_scanner_ex.c" { YYCTYPE yych; static const unsigned char yybm[] = { @@ -563,22 +561,22 @@ static inline void xx_mainloop(url_adapt_state_ex_t *ctx, const char *newdata, s if (yybm[0+yych] & 128) { goto yy2; } -#line 520 "ext/standard/url_scanner_ex.re" +#line 518 "ext/standard/url_scanner_ex.re" { passthru(STD_ARGS); goto state_plain; } -#line 569 "ext/standard/url_scanner_ex.c" +#line 567 "ext/standard/url_scanner_ex.c" yy5: ++YYCURSOR; -#line 519 "ext/standard/url_scanner_ex.re" +#line 517 "ext/standard/url_scanner_ex.re" { passthru(STD_ARGS); STATE = STATE_TAG; goto state_tag; } -#line 574 "ext/standard/url_scanner_ex.c" +#line 572 "ext/standard/url_scanner_ex.c" } -#line 521 "ext/standard/url_scanner_ex.re" +#line 519 "ext/standard/url_scanner_ex.re" state_tag: start = YYCURSOR; -#line 582 "ext/standard/url_scanner_ex.c" +#line 580 "ext/standard/url_scanner_ex.c" { YYCTYPE yych; static const unsigned char yybm[] = { @@ -621,9 +619,9 @@ static inline void xx_mainloop(url_adapt_state_ex_t *ctx, const char *newdata, s goto yy11; } ++YYCURSOR; -#line 527 "ext/standard/url_scanner_ex.re" +#line 525 "ext/standard/url_scanner_ex.re" { passthru(STD_ARGS); goto state_plain_begin; } -#line 627 "ext/standard/url_scanner_ex.c" +#line 625 "ext/standard/url_scanner_ex.c" yy11: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); @@ -631,11 +629,11 @@ static inline void xx_mainloop(url_adapt_state_ex_t *ctx, const char *newdata, s if (yybm[0+yych] & 128) { goto yy11; } -#line 526 "ext/standard/url_scanner_ex.re" +#line 524 "ext/standard/url_scanner_ex.re" { handle_tag(STD_ARGS); /* Sets STATE */; passthru(STD_ARGS); if (STATE == STATE_PLAIN) goto state_plain; else goto state_next_arg; } -#line 637 "ext/standard/url_scanner_ex.c" +#line 635 "ext/standard/url_scanner_ex.c" } -#line 528 "ext/standard/url_scanner_ex.re" +#line 526 "ext/standard/url_scanner_ex.re" state_next_arg_begin: @@ -644,7 +642,7 @@ static inline void xx_mainloop(url_adapt_state_ex_t *ctx, const char *newdata, s state_next_arg: start = YYCURSOR; -#line 648 "ext/standard/url_scanner_ex.c" +#line 646 "ext/standard/url_scanner_ex.c" { YYCTYPE yych; static const unsigned char yybm[] = { @@ -700,9 +698,9 @@ static inline void xx_mainloop(url_adapt_state_ex_t *ctx, const char *newdata, s yy16: ++YYCURSOR; yy17: -#line 539 "ext/standard/url_scanner_ex.re" +#line 537 "ext/standard/url_scanner_ex.re" { passthru(STD_ARGS); goto state_plain_begin; } -#line 706 "ext/standard/url_scanner_ex.c" +#line 704 "ext/standard/url_scanner_ex.c" yy18: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); @@ -710,30 +708,30 @@ static inline void xx_mainloop(url_adapt_state_ex_t *ctx, const char *newdata, s if (yybm[0+yych] & 128) { goto yy18; } -#line 537 "ext/standard/url_scanner_ex.re" +#line 535 "ext/standard/url_scanner_ex.re" { passthru(STD_ARGS); goto state_next_arg; } -#line 716 "ext/standard/url_scanner_ex.c" +#line 714 "ext/standard/url_scanner_ex.c" yy21: yych = *++YYCURSOR; if (yych != '>') goto yy17; yy22: ++YYCURSOR; -#line 536 "ext/standard/url_scanner_ex.re" +#line 534 "ext/standard/url_scanner_ex.re" { passthru(STD_ARGS); handle_form(STD_ARGS); goto state_plain_begin; } -#line 724 "ext/standard/url_scanner_ex.c" +#line 722 "ext/standard/url_scanner_ex.c" yy24: ++YYCURSOR; -#line 538 "ext/standard/url_scanner_ex.re" +#line 536 "ext/standard/url_scanner_ex.re" { --YYCURSOR; STATE = STATE_ARG; goto state_arg; } -#line 729 "ext/standard/url_scanner_ex.c" +#line 727 "ext/standard/url_scanner_ex.c" } -#line 540 "ext/standard/url_scanner_ex.re" +#line 538 "ext/standard/url_scanner_ex.re" state_arg: start = YYCURSOR; -#line 737 "ext/standard/url_scanner_ex.c" +#line 735 "ext/standard/url_scanner_ex.c" { YYCTYPE yych; static const unsigned char yybm[] = { @@ -778,9 +776,9 @@ static inline void xx_mainloop(url_adapt_state_ex_t *ctx, const char *newdata, s if (yych <= 'z') goto yy30; yy28: ++YYCURSOR; -#line 546 "ext/standard/url_scanner_ex.re" +#line 544 "ext/standard/url_scanner_ex.re" { passthru(STD_ARGS); STATE = STATE_NEXT_ARG; goto state_next_arg; } -#line 784 "ext/standard/url_scanner_ex.c" +#line 782 "ext/standard/url_scanner_ex.c" yy30: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); @@ -788,17 +786,17 @@ static inline void xx_mainloop(url_adapt_state_ex_t *ctx, const char *newdata, s if (yybm[0+yych] & 128) { goto yy30; } -#line 545 "ext/standard/url_scanner_ex.re" +#line 543 "ext/standard/url_scanner_ex.re" { passthru(STD_ARGS); handle_arg(STD_ARGS); STATE = STATE_BEFORE_VAL; goto state_before_val; } -#line 794 "ext/standard/url_scanner_ex.c" +#line 792 "ext/standard/url_scanner_ex.c" } -#line 547 "ext/standard/url_scanner_ex.re" +#line 545 "ext/standard/url_scanner_ex.re" state_before_val: start = YYCURSOR; -#line 802 "ext/standard/url_scanner_ex.c" +#line 800 "ext/standard/url_scanner_ex.c" { YYCTYPE yych; static const unsigned char yybm[] = { @@ -841,9 +839,9 @@ static inline void xx_mainloop(url_adapt_state_ex_t *ctx, const char *newdata, s if (yych == '=') goto yy38; ++YYCURSOR; yy36: -#line 553 "ext/standard/url_scanner_ex.re" +#line 551 "ext/standard/url_scanner_ex.re" { --YYCURSOR; goto state_next_arg_begin; } -#line 847 "ext/standard/url_scanner_ex.c" +#line 845 "ext/standard/url_scanner_ex.c" yy37: yych = *(YYMARKER = ++YYCURSOR); if (yych == ' ') goto yy41; @@ -855,9 +853,9 @@ static inline void xx_mainloop(url_adapt_state_ex_t *ctx, const char *newdata, s if (yybm[0+yych] & 128) { goto yy38; } -#line 552 "ext/standard/url_scanner_ex.re" +#line 550 "ext/standard/url_scanner_ex.re" { passthru(STD_ARGS); STATE = STATE_VAL; goto state_val; } -#line 861 "ext/standard/url_scanner_ex.c" +#line 859 "ext/standard/url_scanner_ex.c" yy41: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); @@ -867,14 +865,14 @@ static inline void xx_mainloop(url_adapt_state_ex_t *ctx, const char *newdata, s YYCURSOR = YYMARKER; goto yy36; } -#line 554 "ext/standard/url_scanner_ex.re" +#line 552 "ext/standard/url_scanner_ex.re" state_val: start = YYCURSOR; -#line 878 "ext/standard/url_scanner_ex.c" +#line 876 "ext/standard/url_scanner_ex.c" { YYCTYPE yych; static const unsigned char yybm[] = { @@ -927,15 +925,15 @@ static inline void xx_mainloop(url_adapt_state_ex_t *ctx, const char *newdata, s if (yybm[0+yych] & 32) { goto yy46; } -#line 562 "ext/standard/url_scanner_ex.re" +#line 560 "ext/standard/url_scanner_ex.re" { handle_val(STD_ARGS, 0, ' '); goto state_next_arg_begin; } -#line 933 "ext/standard/url_scanner_ex.c" +#line 931 "ext/standard/url_scanner_ex.c" yy49: ++YYCURSOR; yy50: -#line 563 "ext/standard/url_scanner_ex.re" +#line 561 "ext/standard/url_scanner_ex.re" { passthru(STD_ARGS); goto state_next_arg_begin; } -#line 939 "ext/standard/url_scanner_ex.c" +#line 937 "ext/standard/url_scanner_ex.c" yy51: yych = *(YYMARKER = ++YYCURSOR); if (yych == '>') goto yy50; @@ -958,9 +956,9 @@ static inline void xx_mainloop(url_adapt_state_ex_t *ctx, const char *newdata, s goto yy50; yy56: ++YYCURSOR; -#line 560 "ext/standard/url_scanner_ex.re" +#line 558 "ext/standard/url_scanner_ex.re" { handle_val(STD_ARGS, 1, '"'); goto state_next_arg_begin; } -#line 964 "ext/standard/url_scanner_ex.c" +#line 962 "ext/standard/url_scanner_ex.c" yy58: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); @@ -971,11 +969,11 @@ static inline void xx_mainloop(url_adapt_state_ex_t *ctx, const char *newdata, s } if (yych >= '(') goto yy55; ++YYCURSOR; -#line 561 "ext/standard/url_scanner_ex.re" +#line 559 "ext/standard/url_scanner_ex.re" { handle_val(STD_ARGS, 1, '\''); goto state_next_arg_begin; } -#line 977 "ext/standard/url_scanner_ex.c" +#line 975 "ext/standard/url_scanner_ex.c" } -#line 564 "ext/standard/url_scanner_ex.re" +#line 562 "ext/standard/url_scanner_ex.re" stop: @@ -1103,7 +1101,7 @@ static inline void php_url_scanner_session_handler_impl(char *output, size_t out if (ZSTR_LEN(url_state->url_app.s) != 0) { *handled_output = url_adapt_ext(output, output_len, &len, (zend_bool) (mode & (PHP_OUTPUT_HANDLER_END | PHP_OUTPUT_HANDLER_CONT | PHP_OUTPUT_HANDLER_FLUSH | PHP_OUTPUT_HANDLER_FINAL) ? 1 : 0), url_state); - if (sizeof(uint32_t) < sizeof(size_t)) { + if (sizeof(uint) < sizeof(size_t)) { if (len > UINT_MAX) len = UINT_MAX; } @@ -1319,7 +1317,7 @@ static inline int php_url_scanner_reset_var_impl(zend_string *name, int encode, } /* Check preceeding separator */ if (!sep_removed - && start - PG(arg_separator).output >= separator_len + && (size_t)(start - PG(arg_separator).output) >= separator_len && !memcmp(start - separator_len, PG(arg_separator).output, separator_len)) { start -= separator_len; } diff --git a/ext/standard/url_scanner_ex.re b/ext/standard/url_scanner_ex.re index 51a29b5f73d1b..a06e8f24b474f 100644 --- a/ext/standard/url_scanner_ex.re +++ b/ext/standard/url_scanner_ex.re @@ -185,8 +185,6 @@ alphadash = ([a-zA-Z] | "-"); static inline void append_modified_url(smart_str *url, smart_str *dest, smart_str *url_app, const char *separator) { php_url *url_parts; - char *tmp; - size_t tmp_len; smart_str_0(url); /* FIXME: Bug #70480 php_url_parse_ex() crashes by processing chars exceed len */ url_parts = php_url_parse_ex(ZSTR_VAL(url->s), ZSTR_LEN(url->s)); @@ -199,21 +197,23 @@ static inline void append_modified_url(smart_str *url, smart_str *dest, smart_st /* Check protocol. Only http/https is allowed. */ if (url_parts->scheme - && strcasecmp("http", url_parts->scheme) - && strcasecmp("https", url_parts->scheme)) { + && !zend_string_equals_literal_ci(url_parts->scheme, "http") + && !zend_string_equals_literal_ci(url_parts->scheme, "https")) { smart_str_append_smart_str(dest, url); php_url_free(url_parts); return; } /* Check host whitelist. If it's not listed, do nothing. */ - if (url_parts->host - && (tmp_len = strlen(url_parts->host)) - && (tmp = php_strtolower(url_parts->host, tmp_len)) - && !zend_hash_str_find(&BG(url_adapt_session_hosts_ht), tmp, tmp_len)) { - smart_str_append_smart_str(dest, url); - php_url_free(url_parts); - return; + if (url_parts->host) { + zend_string *tmp = zend_string_tolower(url_parts->host); + if (!zend_hash_exists(&BG(url_adapt_session_hosts_ht), tmp)) { + zend_string_release(tmp); + smart_str_append_smart_str(dest, url); + php_url_free(url_parts); + return; + } + zend_string_release(tmp); } /* @@ -232,32 +232,32 @@ static inline void append_modified_url(smart_str *url, smart_str *dest, smart_st } if (url_parts->scheme) { - smart_str_appends(dest, url_parts->scheme); + smart_str_appends(dest, ZSTR_VAL(url_parts->scheme)); smart_str_appends(dest, "://"); } else if (*(ZSTR_VAL(url->s)) == '/' && *(ZSTR_VAL(url->s)+1) == '/') { smart_str_appends(dest, "//"); } if (url_parts->user) { - smart_str_appends(dest, url_parts->user); + smart_str_appends(dest, ZSTR_VAL(url_parts->user)); if (url_parts->pass) { - smart_str_appends(dest, url_parts->pass); + smart_str_appends(dest, ZSTR_VAL(url_parts->pass)); smart_str_appendc(dest, ':'); } smart_str_appendc(dest, '@'); } if (url_parts->host) { - smart_str_appends(dest, url_parts->host); + smart_str_appends(dest, ZSTR_VAL(url_parts->host)); } if (url_parts->port) { smart_str_appendc(dest, ':'); smart_str_append_unsigned(dest, (long)url_parts->port); } if (url_parts->path) { - smart_str_appends(dest, url_parts->path); + smart_str_appends(dest, ZSTR_VAL(url_parts->path)); } smart_str_appendc(dest, '?'); if (url_parts->query) { - smart_str_appends(dest, url_parts->query); + smart_str_appends(dest, ZSTR_VAL(url_parts->query)); smart_str_appends(dest, separator); smart_str_append_smart_str(dest, url_app); } else { @@ -265,7 +265,7 @@ static inline void append_modified_url(smart_str *url, smart_str *dest, smart_st } if (url_parts->fragment) { smart_str_appendc(dest, '#'); - smart_str_appends(dest, url_parts->fragment); + smart_str_appends(dest, ZSTR_VAL(url_parts->fragment)); } php_url_free(url_parts); } @@ -386,8 +386,8 @@ static int check_host_whitelist(url_adapt_state_ex_t *ctx) if (url_parts->scheme) { /* Only http/https should be handled. A bit hacky check this here, but saves a URL parse. */ - if (strcasecmp(url_parts->scheme, "http") && - strcasecmp(url_parts->scheme, "https")) { + if (!zend_string_equals_literal_ci(url_parts->scheme, "http") && + !zend_string_equals_literal_ci(url_parts->scheme, "https")) { php_url_free(url_parts); return FAILURE; } @@ -397,13 +397,11 @@ static int check_host_whitelist(url_adapt_state_ex_t *ctx) return SUCCESS; } if (!zend_hash_num_elements(allowed_hosts) && - check_http_host(url_parts->host) == SUCCESS) { + check_http_host(ZSTR_VAL(url_parts->host)) == SUCCESS) { php_url_free(url_parts); return SUCCESS; } - if (!zend_hash_str_find(allowed_hosts, - url_parts->host, - strlen(url_parts->host))) { + if (!zend_hash_find(allowed_hosts, url_parts->host)) { php_url_free(url_parts); return FAILURE; } @@ -904,7 +902,7 @@ static inline int php_url_scanner_reset_var_impl(zend_string *name, int encode, } /* Check preceeding separator */ if (!sep_removed - && start - PG(arg_separator).output >= separator_len + && (size_t)(start - PG(arg_separator).output) >= separator_len && !memcmp(start - separator_len, PG(arg_separator).output, separator_len)) { start -= separator_len; } diff --git a/ext/standard/var_unserializer.c b/ext/standard/var_unserializer.c index 7e429a40bd315..530c88fb7a3d5 100644 --- a/ext/standard/var_unserializer.c +++ b/ext/standard/var_unserializer.c @@ -571,7 +571,7 @@ static inline int object_common2(UNSERIALIZE_PARAMETER, zend_long elements) && zend_hash_str_exists(&Z_OBJCE_P(rval)->function_table, "__wakeup", sizeof("__wakeup")-1); ht = Z_OBJPROP_P(rval); - if (elements >= HT_MAX_SIZE - zend_hash_num_elements(ht)) { + if (elements >= (zend_long)(HT_MAX_SIZE - zend_hash_num_elements(ht))) { return 0; } diff --git a/ext/standard/var_unserializer.re b/ext/standard/var_unserializer.re index 8db79bed5f0f7..e588a024d8688 100644 --- a/ext/standard/var_unserializer.re +++ b/ext/standard/var_unserializer.re @@ -575,7 +575,7 @@ static inline int object_common2(UNSERIALIZE_PARAMETER, zend_long elements) && zend_hash_str_exists(&Z_OBJCE_P(rval)->function_table, "__wakeup", sizeof("__wakeup")-1); ht = Z_OBJPROP_P(rval); - if (elements >= HT_MAX_SIZE - zend_hash_num_elements(ht)) { + if (elements >= (zend_long)(HT_MAX_SIZE - zend_hash_num_elements(ht))) { return 0; } diff --git a/ext/sysvmsg/package.xml b/ext/sysvmsg/package.xml deleted file mode 100644 index 403e949d359f1..0000000000000 --- a/ext/sysvmsg/package.xml +++ /dev/null @@ -1,40 +0,0 @@ - - - - sysvmsg - Unix System V IPC Message Queues - - - wez - Wez Furlong - wez@php.net - lead - - - -Unix System V IPC Message Queues - - PHP - - stable - 5.0.0rc1 - 2004-03-19 - -package.xml added to support installation using pear installer - - - - - - - - - - - - - - - diff --git a/ext/sysvsem/package.xml b/ext/sysvsem/package.xml deleted file mode 100644 index 6c40af0e3b4d7..0000000000000 --- a/ext/sysvsem/package.xml +++ /dev/null @@ -1,39 +0,0 @@ - - - - sysvsem - Unix System V IPC Semaphores - - - ??? - Tom May - tom@go2net.com - lead - - - -Unix System V IPC Semaphores - - PHP - - beta - 5.0.0rc1 - 2004-03-19 - -package.xml added to support installation using pear installer - - - - - - - - - - - - - - diff --git a/ext/sysvshm/package.xml b/ext/sysvshm/package.xml deleted file mode 100644 index d26986bfa1b91..0000000000000 --- a/ext/sysvshm/package.xml +++ /dev/null @@ -1,40 +0,0 @@ - - - - sysvsem - Unix System V IPC Shared Memory - - - ??? - Cristian Cartus - cartus@atrior.de - lead - - - -Unix System V IPC Shared Memory - - PHP - - beta - 5.0.0rc1 - 2004-03-19 - -package.xml added to support installation using pear installer - - - - - - - - - - - - - - - diff --git a/ext/tidy/package.xml b/ext/tidy/package.xml deleted file mode 100644 index a5b461ce45094..0000000000000 --- a/ext/tidy/package.xml +++ /dev/null @@ -1,65 +0,0 @@ - - - - tidy - Tidy HTML Repairing and Parsing - - - john - John Coggeshall - john@php.net - lead - - - iliaa - Ilia Alshanetsky - ilia@php.net - developer - - - -Tidy is a binding for the Tidy HTML clean and repair utility which -allows you to not only clean and otherwise manipluate HTML documents, -but also traverse the document tree using the Zend Engine 2 OO semantics. - - PHP - - beta - 2.0dev - 2003-11-13 - - Major API changes for PHP 5.0, including the re-introduction of resources, output buffering support, - dual-nature syntax (tidy_clean_repair($tidy_res) or $tidy->clean_repair()) and more. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/ext/tokenizer/package.xml b/ext/tokenizer/package.xml deleted file mode 100644 index c6ad4ff2a7f90..0000000000000 --- a/ext/tokenizer/package.xml +++ /dev/null @@ -1,45 +0,0 @@ - - - - tokenizer - PHP Source code tokenizer - - - andrei - Andrei Zmievski - andrei@php.net - lead - - - -The tokenizer functions provide an interface to the PHP tokenizer -embedded in the Zend Engine. Using these functions you may write -your own PHP source analyzing or modification tools without having -to deal with the language specification at the lexical level. - - PHP - - beta - 5.0.0rc1 - 2004-03-19 - -package.xml added to support installation using pear installer - - - - - - - - - - - - - - - - - diff --git a/ext/wddx/package.xml b/ext/wddx/package.xml deleted file mode 100644 index 9656ed1d167b8..0000000000000 --- a/ext/wddx/package.xml +++ /dev/null @@ -1,43 +0,0 @@ - - - - wddx - WDDX serialization functions - - - andrei - Andrei Zmievski - andrei@php.net - lead - - - -These functions are intended for work with WDDX (http://www.openwddx.org/) - - PHP - - beta - 5.0.0rc1 - 2004-03-19 - -package.xml added to support installation using pear installer - - - - - - - - - - - - - - - - - - diff --git a/ext/xml/package.xml b/ext/xml/package.xml deleted file mode 100644 index ae5e6450d8ff9..0000000000000 --- a/ext/xml/package.xml +++ /dev/null @@ -1,74 +0,0 @@ - - - - xml - XML Parsing functions - - - ssb - Stig Bakken - ssb@php.net - lead - - - thies - Thies Arntzen - thies@php.net - lead - - - sterling - Sterling Hughes - sterling@php.net - lead - - - -This extension lets you create XML parsers and then define -handlers for different XML events. Each XML parser also has -a few parameters you can adjust. - - PHP - - beta - 5.0rc1 - 2004-03-19 - -package.xml added to support installation using pear installer - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/ext/xml/xml.c b/ext/xml/xml.c index 48614ad421a58..4761844f44bec 100644 --- a/ext/xml/xml.c +++ b/ext/xml/xml.c @@ -70,7 +70,7 @@ ZEND_GET_MODULE(xml) /* }}} */ -#define SKIP_TAGSTART(str) ((str) + (parser->toffset > strlen(str) ? strlen(str) : parser->toffset)) +#define SKIP_TAGSTART(str) ((str) + (parser->toffset > (int)strlen(str) ? strlen(str) : parser->toffset)) /* {{{ function prototypes */ diff --git a/ext/xml/xml.mak b/ext/xml/xml.mak deleted file mode 100644 index b712dea1d6f1c..0000000000000 --- a/ext/xml/xml.mak +++ /dev/null @@ -1,172 +0,0 @@ -# Temporarily here -- later may go into some batch file -# which will set this as an environment variable -PROJECT_ROOT = ..\.. - -# Module details -MODULE_NAME = php_xml -MODULE_DESC = "PHP 7 - XML Extension" -VMAJ = 3 -VMIN = 0 -VREV = 0 - -#include the common settings -include $(PROJECT_ROOT)/netware/common.mif - -# Extensions of all input and output files -.SUFFIXES: -.SUFFIXES: .nlm .lib .obj .cpp .c .msg .mlc .mdb .xdc .d - -# Source files -C_SRC = xml.c \ - start.c - -CPP_SRC_NODIR = $(notdir $(CPP_SRC)) -C_SRC_NODIR = $(notdir $(C_SRC)) -SRC_DIR = $(dir $(CPP_SRC) $(C_SRC)) - -# Library files -LIBRARY = - -# Destination directories and files -OBJ_DIR = $(BUILD) -FINAL_DIR = $(BUILD) -MAP_FILE = $(FINAL_DIR)\$(MODULE_NAME).map -OBJECTS = $(addprefix $(OBJ_DIR)/,$(CPP_SRC_NODIR:.c=.obj) $(C_SRC_NODIR:.c=.obj)) -DEPDS = $(addprefix $(OBJ_DIR)/,$(CPP_SRC_NODIR:.c=.d) $(C_SRC_NODIR:.c=.d)) - -# Binary file -ifndef BINARY - BINARY=$(FINAL_DIR)\$(MODULE_NAME).nlm -endif - -# Compile flags -C_FLAGS += -c -maxerrors 25 -msgstyle gcc -C_FLAGS += -wchar_t on -bool on -C_FLAGS += -processor Pentium -C_FLAGS += -nostdinc -nosyspath -C_FLAGS += -relax_pointers # To remove type-casting errors -C_FLAGS += -DNETWARE -DZTS -C_FLAGS += -DNEW_LIBC -C_FLAGS += -DCOMPILE_DL_XML -DHAVE_LIBEXPAT=1 -C_FLAGS += -I. -I- -I$(PROJECT_ROOT) -I$(PROJECT_ROOT)/main -C_FLAGS += -I$(PROJECT_ROOT)/ext/standard -I$(PROJECT_ROOT)/netware -C_FLAGS += -I$(PROJECT_ROOT)/zend -I$(PROJECT_ROOT)/tsrm -C_FLAGS += -I$(SDK_DIR)/include -I$(MWCIncludes) -C_FLAGS += -I$(EXPAT_DIR)/include - -ifndef STACK_SIZE -STACK_SIZE=8192 -endif - -# Extra stuff based on debug / release builds -ifeq '$(BUILD)' 'debug' - SYM_FILE = $(FINAL_DIR)\$(MODULE_NAME).sym - C_FLAGS += -inline smart -sym on -sym codeview4 -opt off -opt intrinsics -sym internal -DDEBUGGING -DDKFBPON - C_FLAGS += -exc cw -DZEND_DEBUG=1 - LD_FLAGS += -sym on -sym codeview4 -osym $(SYM_FILE) - export MWLibraryFiles=$(SDK_DIR)/imports/libcpre.o;mwcrtld.lib -else - C_FLAGS += -opt speed -inline on -inline smart -inline auto -sym off - C_FLAGS += -opt intrinsics - C_FLAGS += -opt level=4 -DZEND_DEBUG=0 - LD_FLAGS += -sym off - export MWLibraryFiles=$(SDK_DIR)/imports/libcpre.o;mwcrtl.lib -endif - -# Dependencies -MODULE = LibC \ - expatlbc \ - phplib -IMPORT = @$(SDK_DIR)/imports/libc.imp \ - @$(SDK_DIR)/imports/ws2nlm.imp \ - @$(MPK_DIR)/import/mpkOrg.imp \ - @$(EXPAT_DIR)/imports/expatlbc.imp \ - @$(PROJECT_ROOT)/netware/phplib.imp -EXPORT = ($(MODULE_NAME)) get_module -API = OutputToScreen - - -# Virtual paths -vpath %.cpp . -vpath %.c . ..\..\netware -vpath %.obj $(OBJ_DIR) - - -all: prebuild project - -.PHONY: all - -prebuild: - @if not exist $(OBJ_DIR) md $(OBJ_DIR) - -project: $(BINARY) - @echo Build complete. - -$(OBJ_DIR)/%.d: %.cpp - @echo Building Dependencies for $( $(basename $@).def -ifdef API - @echo Import $(API) >> $(basename $@).def -endif - @echo Module $(MODULE) >> $(basename $@).def -ifdef EXPORT - @echo Export $(EXPORT) >> $(basename $@).def -endif - @echo AutoUnload >> $(basename $@).def -ifeq '$(BUILD)' 'debug' - @echo Debug >> $(basename $@).def -endif - @echo Flag_On 0x00000008 >> $(basename $@).def - @echo Start _LibCPrelude >> $(basename $@).def - @echo Exit _LibCPostlude >> $(basename $@).def - - $(MPKTOOL) $(XDCFLAGS) $(basename $@).xdc - @echo xdcdata $(basename $@).xdc >> $(basename $@).def - - @echo Linking $@... - @echo $(LD_FLAGS) -commandfile $(basename $@).def > $(basename $@).link - @echo $(LIBRARY) $(OBJECTS) >> $(basename $@).link - - @$(LINK) @$(basename $@).link - - -.PHONY: clean -clean: cleanobj cleanbin - -.PHONY: cleand -cleand: - @echo Deleting all dependency files... - -@del "$(OBJ_DIR)\*.d" - -.PHONY: cleanobj -cleanobj: - @echo Deleting all object files... - -@del "$(OBJ_DIR)\*.obj" - -.PHONY: cleanbin -cleanbin: - @echo Deleting binary files... - -@del "$(FINAL_DIR)\$(MODULE_NAME).nlm" - @echo Deleting MAP, DEF files, etc.... - -@del "$(FINAL_DIR)\$(MODULE_NAME).map" - -@del "$(FINAL_DIR)\$(MODULE_NAME).def" - -@del "$(FINAL_DIR)\$(MODULE_NAME).link" -ifeq '$(BUILD)' 'debug' - -@del $(FINAL_DIR)\$(MODULE_NAME).sym -endif diff --git a/ext/xmlreader/package.xml b/ext/xmlreader/package.xml deleted file mode 100644 index 6536b78c1f1c1..0000000000000 --- a/ext/xmlreader/package.xml +++ /dev/null @@ -1,75 +0,0 @@ - - - - xmlreader - Provides fast, non-cached, forward-only access to XML data under PHP 5. - - This extension wraps the libxml xmlReader API. The reader acts as a cursor - going forward on the document stream and stopping at each node in the way. - xmlReader is similar to SAX though uses a much simpler API. - - PHP License - - - rrichards - Rob Richards - rrichards@php.net - lead - - - chregu - lead - Christian Stocker - chregu@php.net - - - - - 1.0.1 - 2005-04-30 - stable - - Add workaround for next() bug when using libxml 2.6.17 and lower. - - - - - - 1.0 - 2004-07-27 - stable - - Add name parameter to next() to skip to next named sibling node. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - libxml - - diff --git a/ext/xmlwriter/package.xml b/ext/xmlwriter/package.xml deleted file mode 100644 index 01f7ad4424c4a..0000000000000 --- a/ext/xmlwriter/package.xml +++ /dev/null @@ -1,107 +0,0 @@ - - - - xmlwriter - Provides fast, non-cached, forward-only means to write XML data. - This extension wraps the libxml xmlWriter API. Represents a writer that provides a non-cached, forward-only means of generating streams or files containing XML data. - - PHP - - - rrichards - Rob Richards - rrichards@php.net - lead - - - - pajoye - Pierre-Alain Joye - pajoye@php.net - developer - - - 2.0.2 - 2005-12-01 - stable - - fix build under 5.0 -- fix crash when XMLWriter is instantiated but not used -- Switch from BSD-like license to PHP License 3.01 - - - - - 2.0.0 - 2005-08-07 - stable - - fix tests using UTF-8 - move to stable state - - - - - 1.1.0 - 2005-05-24 - beta - - Add OO interface (php5 only) - Add test cases - - - - - 2.0.1 - 2005-11-15 - stable - - Switch from PHP License to BSD-like license -- Allow recursive calls to __get/__set for different properties (ilia) - - - 1.0 - 2005-05-02 - stable - - Many Bug Fixes - Use PHP streams under PHP 4 - Add xmlwriter_flush function to flush buffer - Add support for xmlTextWriterStart/EndComment - - - - 0.1 - 2004-07-20 - alpha - Initial Release - - - 0.2 - 2004-10-08 - alpha - Fix bug 2482 and other function parameters - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/ext/xmlwriter/package2.xml b/ext/xmlwriter/package2.xml deleted file mode 100644 index ec6ef313b160a..0000000000000 --- a/ext/xmlwriter/package2.xml +++ /dev/null @@ -1,94 +0,0 @@ - - - xmlwriter - pecl.php.net - Provides fast, non-cached, forward-only means to write XML data. - This extension wraps the libxml xmlWriter API. Represents a writer that provides a non-cached, forward-only means of generating streams or files containing XML data. - - - Rob Richards - rrichards - rrichards@php.net - yes - - - Pierre-Alain Joye - pajoye - pajoye@php.net - yes - - 2005-12-01 - - 2.0.2 - 2.0.0 - - - stable - stable - - PHP - - fix build under 5.0 -- fix crash when XMLWriter is instantiated but not used -- Switch from BSD-like license to PHP License 3.01 - - - - - - - - - - - - - - - - - - - - - - - 4.3.0 - - - 1.4.0a2 - - - - xmlwriter - - - - - 2.0.1 - 2.0.0 - - - stable - stable - - BSD - - Switch from PHP License to BSD-like license -- Allow recursive calls to __get/__set for different properties (ilia) - - - - 2005-08-07 - - - 2.0.0 - 2.0.0 - - - stable - stable - - PHP License - Promote to stable - - - diff --git a/ext/xsl/php_xsl.c b/ext/xsl/php_xsl.c index b7160232efa1f..61afc3609922f 100644 --- a/ext/xsl/php_xsl.c +++ b/ext/xsl/php_xsl.c @@ -113,10 +113,8 @@ zend_object *xsl_objects_new(zend_class_entry *class_type) zend_object_std_init(&intern->std, class_type); object_properties_init(&intern->std, class_type); - ALLOC_HASHTABLE(intern->parameter); - zend_hash_init(intern->parameter, 0, NULL, ZVAL_PTR_DTOR, 0); - ALLOC_HASHTABLE(intern->registered_phpfunctions); - zend_hash_init(intern->registered_phpfunctions, 0, NULL, ZVAL_PTR_DTOR, 0); + intern->parameter = zend_new_array(0); + intern->registered_phpfunctions = zend_new_array(0); intern->std.handlers = &xsl_object_handlers; return &intern->std; diff --git a/ext/xsl/xsltprocessor.c b/ext/xsl/xsltprocessor.c index 3970e267ba39a..02c436e34058e 100644 --- a/ext/xsl/xsltprocessor.c +++ b/ext/xsl/xsltprocessor.c @@ -343,8 +343,7 @@ static void xsl_ext_function_php(xmlXPathParserContextPtr ctxt, int nargs, int t xmlNode *nodep; dom_object *obj; if (intern->node_list == NULL) { - ALLOC_HASHTABLE(intern->node_list); - zend_hash_init(intern->node_list, 0, NULL, ZVAL_PTR_DTOR, 0); + intern->node_list = zend_new_array(0); } Z_ADDREF(retval); zend_hash_next_index_insert(intern->node_list, &retval); diff --git a/ext/zend_test/test.c b/ext/zend_test/test.c index 9549d28705061..773225a64dbfb 100644 --- a/ext/zend_test/test.c +++ b/ext/zend_test/test.c @@ -240,7 +240,7 @@ const zend_function_entry zend_test_functions[] = { zend_module_entry zend_test_module_entry = { STANDARD_MODULE_HEADER, - "test", + "zend-test", zend_test_functions, PHP_MINIT(zend_test), PHP_MSHUTDOWN(zend_test), diff --git a/ext/zip/config.m4 b/ext/zip/config.m4 index 7ae43250c01ef..f928700c8082e 100644 --- a/ext/zip/config.m4 +++ b/ext/zip/config.m4 @@ -14,7 +14,7 @@ PHP_ARG_WITH(pcre-dir, pcre install prefix, [ --with-pcre-dir ZIP: pcre install prefix], no, no) PHP_ARG_WITH(libzip, libzip, -[ --with-libzip[=DIR] ZIP: use libzip], no, no) +[ --with-libzip[=DIR] ZIP: use libzip], yes, no) if test "$PHP_ZIP" != "no"; then diff --git a/ext/zip/config.w32 b/ext/zip/config.w32 index cdc42bdb1d0ab..010237267cf5d 100644 --- a/ext/zip/config.w32 +++ b/ext/zip/config.w32 @@ -17,39 +17,6 @@ if (PHP_ZIP != "no") { AC_DEFINE('HAVE_ZIP', 1); AC_DEFINE('HAVE_LIBZIP', 1); ADD_FLAG("CFLAGS_ZIP", "/D _WIN32 /D HAVE_ENCRYPTION"); - } else if (CHECK_HEADER_ADD_INCLUDE("zlib.h", "CFLAGS_ZIP", "..\\zlib;" + PHP_ZIP) && - CHECK_HEADER_ADD_INCLUDE("zipconf.h", "CFLAGS_ZIP", configure_module_dirname + "\\lib;" + PHP_ZIP) && - (((PHP_ZLIB=="no") && (CHECK_LIB("zlib_a.lib", "zip", PHP_ZIP) || CHECK_LIB("zlib.lib", "zip", PHP_ZIP))) || - (PHP_ZLIB_SHARED && CHECK_LIB("zlib.lib", "zip", PHP_ZIP)) || (PHP_ZLIB == "yes" && (!PHP_ZLIB_SHARED))) - ) { - EXTENSION('zip', 'php_zip.c zip_stream.c'); - ADD_SOURCES(configure_module_dirname + "/lib", "zip_add.c zip_add_dir.c zip_add_entry.c\ - zip_close.c zip_delete.c zip_dir_add.c zip_dirent.c zip_discard.c zip_entry.c\ - zip_err_str.c zip_error.c zip_error_clear.c zip_error_get.c zip_error_get_sys_type.c\ - zip_error_strerror.c zip_error_to_str.c zip_extra_field.c zip_extra_field_api.c\ - zip_fclose.c zip_fdopen.c zip_file_add.c zip_file_error_clear.c zip_file_error_get.c\ - zip_file_get_comment.c zip_file_get_offset.c zip_file_rename.c zip_file_replace.c\ - zip_file_set_comment.c zip_file_strerror.c zip_filerange_crc.c zip_fopen.c\ - zip_fopen_encrypted.c zip_fopen_index.c zip_fopen_index_encrypted.c zip_fread.c\ - zip_get_archive_comment.c zip_get_archive_flag.c zip_get_compression_implementation.c\ - zip_get_encryption_implementation.c zip_get_file_comment.c zip_get_name.c zip_get_num_entries.c \ - zip_get_num_files.c zip_memdup.c zip_name_locate.c zip_new.c zip_open.c zip_rename.c zip_replace.c\ - zip_hash.c \ - zip_set_archive_comment.c zip_set_archive_flag.c zip_set_default_password.c zip_set_file_comment.c\ - zip_set_file_compression.c zip_set_name.c zip_source_buffer.c zip_source_close.c zip_source_crc.c\ - zip_source_deflate.c zip_source_error.c zip_source_filep.c zip_source_free.c\ - zip_source_function.c zip_source_layered.c zip_source_open.c zip_source_pkware.c \ - zip_source_read.c zip_source_stat.c zip_source_window.c zip_source_zip.c zip_source_zip_new.c\ - zip_stat.c zip_stat_index.c zip_stat_init.c zip_strerror.c zip_string.c zip_unchange.c zip_unchange_all.c\ - zip_unchange_archive.c zip_unchange_data.c zip_utf-8.c mkstemp.c \ - zip_file_set_external_attributes.c zip_file_get_external_attributes.c zip_source_write.c \ - zip_source_call.c zip_source_supports.c zip_buffer.c zip_source_seek.c zip_source_tell.c \ - zip_io_util.c zip_source_remove.c zip_source_rollback_write.c zip_source_commit_write.c \ - zip_source_tell_write.c zip_source_begin_write.c zip_source_seek_write.c \ - zip_source_win32a.c zip_source_win32utf8.c zip_source_win32handle.c zip_source_win32w.c", "zip"); - - AC_DEFINE('HAVE_ZIP', 1); - ADD_FLAG("CFLAGS_ZIP", "/D _WIN32"); } else { WARNING("zip not enabled; libraries and headers not found"); } diff --git a/ext/zip/php_zip.c b/ext/zip/php_zip.c index 2353519be4bd7..d50c73584597d 100644 --- a/ext/zip/php_zip.c +++ b/ext/zip/php_zip.c @@ -137,18 +137,18 @@ static char * php_zip_make_relative_path(char *path, size_t path_len) /* {{{ */ # define CWD_STATE_FREE(s) efree(s) /* {{{ php_zip_extract_file */ -static int php_zip_extract_file(struct zip * za, char *dest, char *file, int file_len) +static int php_zip_extract_file(struct zip * za, char *dest, char *file, size_t file_len) { php_stream_statbuf ssb; struct zip_file *zf; struct zip_stat sb; char b[8192]; - int n, len, ret; + int n, ret; php_stream *stream; char *fullpath; char *file_dirname_fullpath; char file_dirname[MAXPATHLEN]; - size_t dir_len; + size_t dir_len, len; int is_dir_only = 0; char *path_cleaned; size_t path_cleaned_len; @@ -181,7 +181,7 @@ static int php_zip_extract_file(struct zip * za, char *dest, char *file, int fil memcpy(file_dirname, path_cleaned, path_cleaned_len); dir_len = php_dirname(file_dirname, path_cleaned_len); - if (dir_len <= 0 || (dir_len == 1 && file_dirname[0] == '.')) { + if (!dir_len || (dir_len == 1 && file_dirname[0] == '.')) { len = spprintf(&file_dirname_fullpath, 0, "%s", dest); } else { len = spprintf(&file_dirname_fullpath, 0, "%s/%s", dest, file_dirname); diff --git a/ext/zlib/package.xml b/ext/zlib/package.xml deleted file mode 100644 index 7eb9fa0936f24..0000000000000 --- a/ext/zlib/package.xml +++ /dev/null @@ -1,69 +0,0 @@ - - - - zlib - zlib compression management - - - sr - Stefan Roehrich - sr@linux.de - lead - - - rasmus - Rasmus Lerdorf - rasmus@php.net - developer - - - zeev - Zeev Suraski - zeev@php.net - developer - - - ??? - Jade Nicoletti - ???@php.net - developer - - - -This module enables you to transparently read and write -gzip (.gz) compressed files, through versions of most of -the filesystem functions which work with gzip-compressed -files (and uncompressed files, too, but not with sockets). - - PHP - - beta - 5.0.0rc1 - 2004-03-19 - -package.xml added to support installation using pear installer - - - - - - - - - - - - - - - - - - - - - - - diff --git a/ext/zlib/tests/zlib_get_coding_type_basic.phpt b/ext/zlib/tests/zlib_get_coding_type_basic.phpt new file mode 100644 index 0000000000000..e60a97f2d91a5 --- /dev/null +++ b/ext/zlib/tests/zlib_get_coding_type_basic.phpt @@ -0,0 +1,19 @@ +--TEST-- +zlib_get_coding_type() basic call without env +--CREDIT-- +PHP TestFest 2017 - Bergfreunde, Florian Engelhardt +--SKIPIF-- + +--FILE-- + +--EXPECT-- +bool(false) +bool(false) diff --git a/ext/zlib/tests/zlib_get_coding_type_br.phpt b/ext/zlib/tests/zlib_get_coding_type_br.phpt new file mode 100644 index 0000000000000..dca6ad7571b8d --- /dev/null +++ b/ext/zlib/tests/zlib_get_coding_type_br.phpt @@ -0,0 +1,21 @@ +--TEST-- +zlib_get_coding_type() with unsupported encoding +--CREDIT-- +PHP TestFest 2017 - Bergfreunde, Florian Engelhardt +--SKIPIF-- + +--ENV-- +HTTP_ACCEPT_ENCODING=br +--FILE-- + +--EXPECT-- +bool(false) +bool(false) diff --git a/ext/zlib/tests/zlib_get_coding_type_deflate.phpt b/ext/zlib/tests/zlib_get_coding_type_deflate.phpt new file mode 100644 index 0000000000000..bca85e9cb966c --- /dev/null +++ b/ext/zlib/tests/zlib_get_coding_type_deflate.phpt @@ -0,0 +1,21 @@ +--TEST-- +zlib_get_coding_type() with deflate encoding +--CREDIT-- +PHP TestFest 2017 - Bergfreunde, Florian Engelhardt +--SKIPIF-- + +--ENV-- +HTTP_ACCEPT_ENCODING=deflate +--FILE-- + +--EXPECT-- +bool(false) +string(7) "deflate" diff --git a/ext/zlib/tests/zlib_get_coding_type_gzip.phpt b/ext/zlib/tests/zlib_get_coding_type_gzip.phpt new file mode 100644 index 0000000000000..e3d26e5e71523 --- /dev/null +++ b/ext/zlib/tests/zlib_get_coding_type_gzip.phpt @@ -0,0 +1,21 @@ +--TEST-- +zlib_get_coding_type() with gzip encoding +--CREDIT-- +PHP TestFest 2017 - Bergfreunde, Florian Engelhardt +--SKIPIF-- + +--ENV-- +HTTP_ACCEPT_ENCODING=gzip +--FILE-- + +--EXPECT-- +bool(false) +string(4) "gzip" diff --git a/main/build-defs.h.in b/main/build-defs.h.in index fb9bc7f8818d8..c577ea84233c2 100644 --- a/main/build-defs.h.in +++ b/main/build-defs.h.in @@ -73,8 +73,6 @@ #define PHP_LDAP_LFLAGS "" #define PHP_LDAP_INCLUDE "" #define PHP_LDAP_LIBS "" -#define PHP_BIRDSTEP_INCLUDE "" -#define PHP_BIRDSTEP_LIBS "" #define PEAR_INSTALLDIR "@EXPANDED_PEAR_INSTALLDIR@" #define PHP_INCLUDE_PATH "@INCLUDE_PATH@" #define PHP_EXTENSION_DIR "@EXPANDED_EXTENSION_DIR@" diff --git a/main/fastcgi.c b/main/fastcgi.c index 1e8a8064d7017..41770ed2db865 100644 --- a/main/fastcgi.c +++ b/main/fastcgi.c @@ -739,9 +739,9 @@ int fcgi_listen(const char *path, int backlog) return listen_socket; #else - int path_len = strlen(path); + size_t path_len = strlen(path); - if (path_len >= (int)sizeof(sa.sa_unix.sun_path)) { + if (path_len >= sizeof(sa.sa_unix.sun_path)) { fcgi_log(FCGI_ERROR, "Listening socket's path name is too long.\n"); return -1; } diff --git a/main/fopen_wrappers.c b/main/fopen_wrappers.c index 12de33be832eb..06b0eb35fa1d9 100644 --- a/main/fopen_wrappers.c +++ b/main/fopen_wrappers.c @@ -168,11 +168,11 @@ PHPAPI int php_check_specific_open_basedir(const char *basedir, const char *path while (VCWD_REALPATH(path_tmp, resolved_name) == NULL) { #if defined(PHP_WIN32) || defined(HAVE_SYMLINK) if (nesting_level == 0) { - int ret; + ssize_t ret; char buf[MAXPATHLEN]; ret = php_sys_readlink(path_tmp, buf, MAXPATHLEN - 1); - if (ret < 0) { + if (ret == -1) { /* not a broken symlink, move along.. */ } else { /* put the real path into the path buffer */ @@ -355,7 +355,7 @@ PHPAPI int php_fopen_primary_script(zend_file_handle *file_handle) char *path_info; char *filename = NULL; zend_string *resolved_path = NULL; - int length; + size_t length; zend_bool orig_display_errors; path_info = SG(request_info).request_uri; @@ -378,7 +378,7 @@ PHPAPI int php_fopen_primary_script(zend_file_handle *file_handle) pwbuf = emalloc(pwbuflen); #endif length = s - (path_info + 2); - if (length > (int)sizeof(user) - 1) { + if (length > sizeof(user) - 1) { length = sizeof(user) - 1; } memcpy(user, path_info + 2, length); @@ -402,9 +402,9 @@ PHPAPI int php_fopen_primary_script(zend_file_handle *file_handle) } } else #endif - if (PG(doc_root) && path_info && (length = (int)strlen(PG(doc_root))) && + if (PG(doc_root) && path_info && (length = strlen(PG(doc_root))) && IS_ABSOLUTE_PATH(PG(doc_root), length)) { - int path_len = (int)strlen(path_info); + size_t path_len = strlen(path_info); filename = emalloc(length + path_len + 2); memcpy(filename, PG(doc_root), length); if (!IS_SLASH(filename[length - 1])) { /* length is never 0 */ @@ -420,7 +420,7 @@ PHPAPI int php_fopen_primary_script(zend_file_handle *file_handle) if (filename) { - resolved_path = zend_resolve_path(filename, (int)strlen(filename)); + resolved_path = zend_resolve_path(filename, strlen(filename)); } if (!resolved_path) { @@ -472,7 +472,7 @@ PHPAPI int php_fopen_primary_script(zend_file_handle *file_handle) /* {{{ php_resolve_path * Returns the realpath for given filename according to include path */ -PHPAPI zend_string *php_resolve_path(const char *filename, int filename_length, const char *path) +PHPAPI zend_string *php_resolve_path(const char *filename, size_t filename_length, const char *path) { char resolved_path[MAXPATHLEN]; char trypath[MAXPATHLEN]; @@ -532,7 +532,7 @@ PHPAPI zend_string *php_resolve_path(const char *filename, int filename_length, } end = strchr(p, DEFAULT_DIR_SEPARATOR); if (end) { - if (filename_length > (MAXPATHLEN - 2) || (end-ptr) > MAXPATHLEN || (end-ptr) + 1 + (size_t)filename_length + 1 >= MAXPATHLEN) { + if (filename_length > (MAXPATHLEN - 2) || (end-ptr) > MAXPATHLEN || (end-ptr) + 1 + filename_length + 1 >= MAXPATHLEN) { ptr = end + 1; continue; } @@ -543,7 +543,7 @@ PHPAPI zend_string *php_resolve_path(const char *filename, int filename_length, } else { size_t len = strlen(ptr); - if (filename_length > (MAXPATHLEN - 2) || len > MAXPATHLEN || len + 1 + (size_t)filename_length + 1 >= MAXPATHLEN) { + if (filename_length > (MAXPATHLEN - 2) || len > MAXPATHLEN || len + 1 + filename_length + 1 >= MAXPATHLEN) { break; } memcpy(trypath, ptr, len); @@ -624,7 +624,7 @@ PHPAPI FILE *php_fopen_with_path(const char *filename, const char *mode, const c char *pathbuf, *ptr, *end; char trypath[MAXPATHLEN]; FILE *fp; - int filename_length; + size_t filename_length; zend_string *exec_filename; if (opened_path) { @@ -635,7 +635,7 @@ PHPAPI FILE *php_fopen_with_path(const char *filename, const char *mode, const c return NULL; } - filename_length = (int)strlen(filename); + filename_length = strlen(filename); #ifndef PHP_WIN32 (void) filename_length; #endif @@ -761,14 +761,14 @@ PHPAPI char *expand_filepath_with_mode(const char *filepath, char *real_path, co { cwd_state new_state; char cwd[MAXPATHLEN]; - int copy_len; - int path_len; + size_t copy_len; + size_t path_len; if (!filepath[0]) { return NULL; } - path_len = (int)strlen(filepath); + path_len = strlen(filepath); if (IS_ABSOLUTE_PATH(filepath, path_len)) { cwd[0] = '\0'; @@ -811,7 +811,7 @@ PHPAPI char *expand_filepath_with_mode(const char *filepath, char *real_path, co } new_state.cwd = estrdup(cwd); - new_state.cwd_length = (int)strlen(cwd); + new_state.cwd_length = strlen(cwd); if (virtual_file_ex(&new_state, filepath, NULL, realpath_mode)) { efree(new_state.cwd); diff --git a/main/fopen_wrappers.h b/main/fopen_wrappers.h index 5e1544c513ec0..cdded57938ed0 100644 --- a/main/fopen_wrappers.h +++ b/main/fopen_wrappers.h @@ -39,7 +39,7 @@ PHPAPI int php_check_specific_open_basedir(const char *basedir, const char *path PHPAPI int php_check_safe_mode_include_dir(const char *path); -PHPAPI zend_string *php_resolve_path(const char *filename, int filename_len, const char *path); +PHPAPI zend_string *php_resolve_path(const char *filename, size_t filename_len, const char *path); PHPAPI FILE *php_fopen_with_path(const char *filename, const char *mode, const char *path, zend_string **opened_path); diff --git a/main/main.c b/main/main.c index a84f7cdb6ff6f..e4c97f686dfac 100644 --- a/main/main.c +++ b/main/main.c @@ -184,7 +184,7 @@ static PHP_INI_MH(OnSetSerializePrecision) static PHP_INI_MH(OnChangeMemoryLimit) { if (new_value) { - PG(memory_limit) = zend_atol(ZSTR_VAL(new_value), (int)ZSTR_LEN(new_value)); + PG(memory_limit) = zend_atol(ZSTR_VAL(new_value), ZSTR_LEN(new_value)); } else { PG(memory_limit) = 1<<30; /* effectively, no limit */ } @@ -337,7 +337,7 @@ static PHP_INI_MH(OnUpdateTimeout) /* {{{ php_get_display_errors_mode() helper function */ -static int php_get_display_errors_mode(char *value, int value_length) +static int php_get_display_errors_mode(char *value, size_t value_length) { int mode; @@ -370,7 +370,7 @@ static int php_get_display_errors_mode(char *value, int value_length) */ static PHP_INI_MH(OnUpdateDisplayErrors) { - PG(display_errors) = (zend_bool) php_get_display_errors_mode(ZSTR_VAL(new_value), (int)ZSTR_LEN(new_value)); + PG(display_errors) = (zend_bool) php_get_display_errors_mode(ZSTR_VAL(new_value), ZSTR_LEN(new_value)); return SUCCESS; } @@ -380,15 +380,16 @@ static PHP_INI_MH(OnUpdateDisplayErrors) */ static PHP_INI_DISP(display_errors_mode) { - int mode, tmp_value_length, cgi_or_cli; + int mode, cgi_or_cli; + size_t tmp_value_length; char *tmp_value; if (type == ZEND_INI_DISPLAY_ORIG && ini_entry->modified) { tmp_value = (ini_entry->orig_value ? ZSTR_VAL(ini_entry->orig_value) : NULL ); - tmp_value_length = (int)(ini_entry->orig_value? ZSTR_LEN(ini_entry->orig_value) : 0); + tmp_value_length = (ini_entry->orig_value? ZSTR_LEN(ini_entry->orig_value) : 0); } else if (ini_entry->value) { tmp_value = ZSTR_VAL(ini_entry->value); - tmp_value_length = (int)ZSTR_LEN(ini_entry->value); + tmp_value_length = ZSTR_LEN(ini_entry->value); } else { tmp_value = NULL; tmp_value_length = 0; @@ -1008,10 +1009,10 @@ PHPAPI ZEND_COLD void php_win32_docref2_from_error(DWORD error, const char *para php_error_docref2(NULL, param1, param2, E_WARNING, "%s", strerror(errno)); } else { char buf[PHP_WIN32_ERROR_MSG_BUFFER_SIZE + 1]; - int buf_len; + size_t buf_len; FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, NULL, error, 0, buf, PHP_WIN32_ERROR_MSG_BUFFER_SIZE, NULL); - buf_len = (int)strlen(buf); + buf_len = strlen(buf); if (buf_len >= 2) { buf[buf_len - 1] = '\0'; buf[buf_len - 2] = '\0'; @@ -1452,7 +1453,7 @@ PHPAPI int php_stream_open_for_zend_ex(const char *filename, zend_file_handle *h } /* }}} */ -static zend_string *php_resolve_path_for_zend(const char *filename, int filename_len) /* {{{ */ +static zend_string *php_resolve_path_for_zend(const char *filename, size_t filename_len) /* {{{ */ { return php_resolve_path(filename, filename_len, PG(include_path)); } diff --git a/main/network.c b/main/network.c index 763a84be94abc..ab328e7b4f08c 100644 --- a/main/network.c +++ b/main/network.c @@ -271,22 +271,19 @@ PHPAPI int php_network_getaddresses(const char *host, int socktype, struct socka #define O_NONBLOCK O_NDELAY #endif -#if !defined(__BEOS__) -# define HAVE_NON_BLOCKING_CONNECT 1 -# ifdef PHP_WIN32 +#ifdef PHP_WIN32 typedef u_long php_non_blocking_flags_t; # define SET_SOCKET_BLOCKING_MODE(sock, save) \ save = TRUE; ioctlsocket(sock, FIONBIO, &save) # define RESTORE_SOCKET_BLOCKING_MODE(sock, save) \ ioctlsocket(sock, FIONBIO, &save) -# else +#else typedef int php_non_blocking_flags_t; # define SET_SOCKET_BLOCKING_MODE(sock, save) \ save = fcntl(sock, F_GETFL, 0); \ fcntl(sock, F_SETFL, save | O_NONBLOCK) # define RESTORE_SOCKET_BLOCKING_MODE(sock, save) \ fcntl(sock, F_SETFL, save) -# endif #endif /* Connect to a socket using an interruptible connect with optional timeout. @@ -302,7 +299,6 @@ PHPAPI int php_network_connect_socket(php_socket_t sockfd, zend_string **error_string, int *error_code) { -#if HAVE_NON_BLOCKING_CONNECT php_non_blocking_flags_t orig_flags; int n; int error = 0; @@ -380,12 +376,6 @@ PHPAPI int php_network_connect_socket(php_socket_t sockfd, } } return ret; -#else - if (asynchronous) { - php_error_docref(NULL, E_WARNING, "Asynchronous connect() not supported on this platform"); - } - return (connect(sockfd, addr, addrlen) == 0) ? 0 : -1; -#endif } /* }}} */ diff --git a/main/php.h b/main/php.h index 388317ddd92de..6dc05caea7d96 100644 --- a/main/php.h +++ b/main/php.h @@ -101,9 +101,7 @@ typedef int gid_t; typedef char * caddr_t; typedef unsigned int uint; typedef unsigned long ulong; -# if !NSAPI typedef int pid_t; -# endif # ifndef PHP_DEBUG # ifdef inline diff --git a/main/php_memory_streams.h b/main/php_memory_streams.h index f8989d261bf7b..271a9276e0f3b 100644 --- a/main/php_memory_streams.h +++ b/main/php_memory_streams.h @@ -25,9 +25,10 @@ #define PHP_STREAM_MAX_MEM 2 * 1024 * 1024 -#define TEMP_STREAM_DEFAULT 0 -#define TEMP_STREAM_READONLY 1 -#define TEMP_STREAM_TAKE_BUFFER 2 +#define TEMP_STREAM_DEFAULT 0x0 +#define TEMP_STREAM_READONLY 0x1 +#define TEMP_STREAM_TAKE_BUFFER 0x2 +#define TEMP_STREAM_APPEND 0x4 #define php_stream_memory_create(mode) _php_stream_memory_create((mode) STREAMS_CC) #define php_stream_memory_create_rel(mode) _php_stream_memory_create((mode) STREAMS_REL_CC) @@ -41,6 +42,7 @@ #define php_stream_temp_open(mode, max_memory_usage, buf, length) _php_stream_temp_open((mode), (max_memory_usage), (buf), (length) STREAMS_CC) BEGIN_EXTERN_C() + PHPAPI php_stream *_php_stream_memory_create(int mode STREAMS_DC); PHPAPI php_stream *_php_stream_memory_open(int mode, char *buf, size_t length STREAMS_DC); PHPAPI char *_php_stream_memory_get_buffer(php_stream *stream, size_t *length STREAMS_DC); @@ -48,6 +50,10 @@ PHPAPI char *_php_stream_memory_get_buffer(php_stream *stream, size_t *length ST PHPAPI php_stream *_php_stream_temp_create(int mode, size_t max_memory_usage STREAMS_DC); PHPAPI php_stream *_php_stream_temp_create_ex(int mode, size_t max_memory_usage, const char *tmpdir STREAMS_DC); PHPAPI php_stream *_php_stream_temp_open(int mode, size_t max_memory_usage, char *buf, size_t length STREAMS_DC); + +PHPAPI int php_stream_mode_from_str(const char *mode); +PHPAPI const char *_php_stream_mode_to_str(int mode); + END_EXTERN_C() extern PHPAPI php_stream_ops php_stream_memory_ops; diff --git a/main/php_open_temporary_file.c b/main/php_open_temporary_file.c index f2303882f4b02..71354654b5bb0 100644 --- a/main/php_open_temporary_file.c +++ b/main/php_open_temporary_file.c @@ -125,7 +125,7 @@ static int php_do_open_temporary_file(const char *path, const char *pfx, zend_st } new_state.cwd = estrdup(cwd); - new_state.cwd_length = (int)strlen(cwd); + new_state.cwd_length = strlen(cwd); if (virtual_file_ex(&new_state, path, NULL, CWD_REALPATH)) { efree(new_state.cwd); @@ -216,7 +216,7 @@ PHPAPI const char* php_get_temporary_directory(void) { char *sys_temp_dir = PG(sys_temp_dir); if (sys_temp_dir) { - int len = (int)strlen(sys_temp_dir); + size_t len = strlen(sys_temp_dir); if (len >= 2 && sys_temp_dir[len - 1] == DEFAULT_SLASH) { PG(php_sys_temp_dir) = estrndup(sys_temp_dir, len - 1); return PG(php_sys_temp_dir); @@ -237,7 +237,10 @@ PHPAPI const char* php_get_temporary_directory(void) wchar_t sTemp[MAXPATHLEN]; char *tmp; size_t len = GetTempPathW(MAXPATHLEN, sTemp); - assert(0 < len); /* should *never* fail! */ + + if (!len) { + return NULL; + } if (NULL == (tmp = php_win32_ioutil_conv_w_to_any(sTemp, len, &len))) { return NULL; @@ -253,7 +256,7 @@ PHPAPI const char* php_get_temporary_directory(void) { char* s = getenv("TMPDIR"); if (s && *s) { - int len = strlen(s); + size_t len = strlen(s); if (s[len - 1] == DEFAULT_SLASH) { PG(php_sys_temp_dir) = estrndup(s, len - 1); diff --git a/main/php_reentrancy.h b/main/php_reentrancy.h index f66f3c5e3ace9..6689662c943a3 100644 --- a/main/php_reentrancy.h +++ b/main/php_reentrancy.h @@ -91,7 +91,7 @@ char *asctime_r(const struct tm *tm, char *buf); #endif -#if !defined(HAVE_GMTIME_R) && defined(HAVE_GMTIME) || defined(__BEOS__) +#if !defined(HAVE_GMTIME_R) && defined(HAVE_GMTIME) #define PHP_NEED_REENTRANCY 1 PHPAPI struct tm *php_gmtime_r(const time_t *const timep, struct tm *p_tm); #else diff --git a/main/php_syslog.c b/main/php_syslog.c new file mode 100644 index 0000000000000..63b23c2363002 --- /dev/null +++ b/main/php_syslog.c @@ -0,0 +1,92 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 7 | + +----------------------------------------------------------------------+ + | Copyright (c) 2017 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: Philip Prindeville | + +----------------------------------------------------------------------+ +*/ + +/* $Id$ */ + +#include +#include +#include +#include +#include "php.h" +#include "php_syslog.h" + +#include "zend.h" +#include "zend_smart_string.h" + +/* + * The SCO OpenServer 5 Development System (not the UDK) + * defines syslog to std_syslog. + */ + +#ifdef HAVE_STD_SYSLOG +#define syslog std_syslog +#endif + +#ifdef PHP_WIN32 +PHPAPI void php_syslog(int priority, const char *format, ...) /* {{{ */ +{ + va_list args; + + va_start(args, format); + vsyslog(priority, format, args); + va_end(args); +} +/* }}} */ +#else +PHPAPI void php_syslog(int priority, const char *format, ...) /* {{{ */ +{ + const char *ptr; + unsigned char c; + smart_string fbuf = {0}; + smart_string sbuf = {0}; + va_list args; + + va_start(args, format); + zend_printf_to_smart_string(&fbuf, format, args); + smart_string_0(&fbuf); + va_end(args); + + for (ptr = fbuf.c; ; ++ptr) { + c = *ptr; + if (c == '\0') { + syslog(priority, "%.*s", (int)sbuf.len, sbuf.c); + break; + } + + if (c != '\n') + smart_string_appendc(&sbuf, c); + else { + syslog(priority, "%.*s", (int)sbuf.len, sbuf.c); + smart_string_reset(&sbuf); + } + } + + smart_string_free(&fbuf); + smart_string_free(&sbuf); +} +/* }}} */ +#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/main/php_syslog.h b/main/php_syslog.h index be68cc499a83e..4c4ca4eeb1154 100644 --- a/main/php_syslog.h +++ b/main/php_syslog.h @@ -21,6 +21,8 @@ #ifndef PHP_SYSLOG_H #define PHP_SYSLOG_H +#include "php.h" + #ifdef PHP_WIN32 #include "win32/syslog.h" #else @@ -30,26 +32,12 @@ #endif #endif -/* - * The SCO OpenServer 5 Development System (not the UDK) - * defines syslog to std_syslog. - */ - -#ifdef syslog - -#ifdef HAVE_STD_SYSLOG -#define php_syslog std_syslog -#endif - -#undef syslog +BEGIN_EXTERN_C() +PHPAPI void php_syslog(int, const char *format, ...); +END_EXTERN_C() #endif -#ifndef php_syslog -#define php_syslog syslog -#endif - -#endif /* * Local variables: * tab-width: 4 diff --git a/main/php_version.h b/main/php_version.h index 62cdcfceda3be..e81c51524990b 100644 --- a/main/php_version.h +++ b/main/php_version.h @@ -1,8 +1,8 @@ /* automatically generated by configure */ /* edit configure.ac to change version number */ #define PHP_MAJOR_VERSION 7 -#define PHP_MINOR_VERSION 2 +#define PHP_MINOR_VERSION 3 #define PHP_RELEASE_VERSION 0 #define PHP_EXTRA_VERSION "-dev" -#define PHP_VERSION "7.2.0-dev" -#define PHP_VERSION_ID 70200 +#define PHP_VERSION "7.3.0-dev" +#define PHP_VERSION_ID 70300 diff --git a/main/reentrancy.c b/main/reentrancy.c index b95deca262e49..2d2f13078228c 100644 --- a/main/reentrancy.c +++ b/main/reentrancy.c @@ -111,18 +111,6 @@ PHPAPI struct tm *php_gmtime_r(const time_t *const timep, struct tm *p_tm) #endif -#if defined(__BEOS__) - -PHPAPI struct tm *php_gmtime_r(const time_t *const timep, struct tm *p_tm) -{ - /* Modified according to LibC definition */ - if (((struct tm*)gmtime_r(timep, p_tm)) == p_tm) - return (p_tm); - return (NULL); -} - -#endif /* BEOS */ - #if !defined(HAVE_POSIX_READDIR_R) PHPAPI int php_readdir_r(DIR *dirp, struct dirent *entry, diff --git a/main/streams/memory.c b/main/streams/memory.c index 7af87c7efbcdd..c21277815102e 100644 --- a/main/streams/memory.c +++ b/main/streams/memory.c @@ -53,10 +53,11 @@ static size_t php_stream_memory_write(php_stream *stream, const char *buf, size_ if (ms->mode & TEMP_STREAM_READONLY) { return 0; + } else if (ms->mode & TEMP_STREAM_APPEND) { + ms->fpos = ms->fsize; } if (ms->fpos + count > ms->fsize) { char *tmp; - if (!ms->data) { tmp = emalloc(ms->fpos + count); } else { @@ -222,9 +223,6 @@ static int php_stream_memory_stat(php_stream *stream, php_stream_statbuf *ssb) / #ifndef PHP_WIN32 ssb->sb.st_blksize = -1; -#endif - -#if !defined(PHP_WIN32) && !defined(__BEOS__) ssb->sb.st_blocks = -1; #endif @@ -276,6 +274,29 @@ PHPAPI php_stream_ops php_stream_memory_ops = { php_stream_memory_set_option }; +/* {{{ */ +PHPAPI int php_stream_mode_from_str(const char *mode) +{ + if (strpbrk(mode, "a")) { + return TEMP_STREAM_APPEND; + } else if (strpbrk(mode, "w+")) { + return TEMP_STREAM_DEFAULT; + } + return TEMP_STREAM_READONLY; +} +/* }}} */ + +/* {{{ */ +PHPAPI const char *_php_stream_mode_to_str(int mode) +{ + if (mode == TEMP_STREAM_READONLY) { + return "rb"; + } else if (mode == TEMP_STREAM_APPEND) { + return "a+b"; + } + return "w+b"; +} +/* }}} */ /* {{{ */ PHPAPI php_stream *_php_stream_memory_create(int mode STREAMS_DC) @@ -290,7 +311,7 @@ PHPAPI php_stream *_php_stream_memory_create(int mode STREAMS_DC) self->smax = ~0u; self->mode = mode; - stream = php_stream_alloc_rel(&php_stream_memory_ops, self, 0, mode & TEMP_STREAM_READONLY ? "rb" : "w+b"); + stream = php_stream_alloc_rel(&php_stream_memory_ops, self, 0, _php_stream_mode_to_str(mode)); stream->flags |= PHP_STREAM_FLAG_NO_BUFFER; return stream; } @@ -564,7 +585,7 @@ PHPAPI php_stream *_php_stream_temp_create_ex(int mode, size_t max_memory_usage, if (tmpdir) { self->tmpdir = estrdup(tmpdir); } - stream = php_stream_alloc_rel(&php_stream_temp_ops, self, 0, mode & TEMP_STREAM_READONLY ? "rb" : "w+b"); + stream = php_stream_alloc_rel(&php_stream_temp_ops, self, 0, _php_stream_mode_to_str(mode)); stream->flags |= PHP_STREAM_FLAG_NO_BUFFER; self->innerstream = php_stream_memory_create_rel(mode); php_stream_encloses(stream, self->innerstream); diff --git a/main/streams/streams.c b/main/streams/streams.c index dab8505d412af..e768d0f533586 100644 --- a/main/streams/streams.c +++ b/main/streams/streams.c @@ -1996,7 +1996,7 @@ PHPAPI php_stream *_php_stream_open_wrapper_ex(const char *path, const char *mod } if (options & USE_PATH) { - resolved_path = zend_resolve_path(path, (int)strlen(path)); + resolved_path = zend_resolve_path(path, strlen(path)); if (resolved_path) { path = ZSTR_VAL(resolved_path); /* we've found this file, don't re-check include_path or run realpath */ diff --git a/php.ini-development b/php.ini-development index 8ba304b8c0228..4dddd9ff80de1 100644 --- a/php.ini-development +++ b/php.ini-development @@ -1091,8 +1091,6 @@ odbc.defaultlrl = 4096 ; http://php.net/odbc.defaultbinmode odbc.defaultbinmode = 1 -;birdstep.max_links = -1 - [Interbase] ; Allow or prevent persistent links. ibase.allow_persistent = 1 diff --git a/php.ini-production b/php.ini-production index fb08287fa6e11..2b546ddb08f43 100644 --- a/php.ini-production +++ b/php.ini-production @@ -1098,8 +1098,6 @@ odbc.defaultlrl = 4096 ; http://php.net/odbc.defaultbinmode odbc.defaultbinmode = 1 -;birdstep.max_links = -1 - [Interbase] ; Allow or prevent persistent links. ibase.allow_persistent = 1 diff --git a/run-tests.php b/run-tests.php index a32db44bf83f0..c95ef4e54d340 100755 --- a/run-tests.php +++ b/run-tests.php @@ -26,6 +26,15 @@ /* $Id$ */ +define('INIT_DIR', getcwd()); + +// change into the PHP source directory. +if (getenv('TEST_PHP_SRCDIR')) { + @chdir(getenv('TEST_PHP_SRCDIR')); +} +define('TEST_PHP_SRCDIR', getcwd()); + + /* Sanity check to ensure that pcre extension needed by this script is available. * In the event it is not, print a nice error message indicating that this script will * not run without it. @@ -64,29 +73,16 @@ date_default_timezone_set('UTC'); } -// store current directory -$CUR_DIR = getcwd(); - -// change into the PHP source directory. - -if (getenv('TEST_PHP_SRCDIR')) { - @chdir(getenv('TEST_PHP_SRCDIR')); -} - // Delete some security related environment variables putenv('SSH_CLIENT=deleted'); putenv('SSH_AUTH_SOCK=deleted'); putenv('SSH_TTY=deleted'); putenv('SSH_CONNECTION=deleted'); -$cwd = getcwd(); set_time_limit(0); ini_set('pcre.backtrack_limit', PHP_INT_MAX); -$valgrind_version = 0; -$valgrind_header = ''; - // delete as much output buffers as possible while(@ob_end_clean()); if (ob_get_level()) echo "Not all buffers were deleted.\n"; @@ -132,11 +128,11 @@ $php = getenv('TEST_PHP_EXECUTABLE'); if ($php=='auto') { - $php = $cwd . '/sapi/cli/php'; + $php = TEST_PHP_SRCDIR . '/sapi/cli/php'; putenv("TEST_PHP_EXECUTABLE=$php"); if (!getenv('TEST_PHP_CGI_EXECUTABLE')) { - $php_cgi = $cwd . '/sapi/cgi/php-cgi'; + $php_cgi = TEST_PHP_SRCDIR . '/sapi/cgi/php-cgi'; if (file_exists($php_cgi)) { putenv("TEST_PHP_CGI_EXECUTABLE=$php_cgi"); @@ -152,7 +148,7 @@ $php_cgi = getenv('TEST_PHP_CGI_EXECUTABLE'); if ($php_cgi=='auto') { - $php_cgi = $cwd . '/sapi/cgi/php-cgi'; + $php_cgi = TEST_PHP_SRCDIR . '/sapi/cgi/php-cgi'; putenv("TEST_PHP_CGI_EXECUTABLE=$php_cgi"); } @@ -180,7 +176,7 @@ $phpdbg = getenv('TEST_PHPDBG_EXECUTABLE'); if ($phpdbg=='auto') { - $phpdbg = $cwd . '/sapi/phpdbg/phpdbg'; + $phpdbg = TEST_PHP_SRCDIR . '/sapi/phpdbg/phpdbg'; putenv("TEST_PHPDBG_EXECUTABLE=$phpdbg"); } @@ -261,7 +257,7 @@ function verify_config() function write_information() { - global $cwd, $php, $php_cgi, $phpdbg, $php_info, $user_tests, $ini_overwrites, $pass_options, $exts_to_test, $leak_check, $valgrind_header, $no_file_cache; + global $php, $php_cgi, $phpdbg, $php_info, $user_tests, $ini_overwrites, $pass_options, $exts_to_test, $valgrind, $no_file_cache; // Get info from php $info_file = __DIR__ . '/run-test-info.php'; @@ -328,13 +324,13 @@ function write_information() echo " ===================================================================== PHP : $php $php_info $php_cgi_info $phpdbg_info -CWD : $cwd +CWD : ".TEST_PHP_SRCDIR." Extra dirs : "; foreach ($user_tests as $test_dir) { echo "{$test_dir}\n "; } echo " -VALGRIND : " . ($leak_check ? $valgrind_header : 'Not used') . " +VALGRIND : " . ($valgrind ? $valgrind->getHeader() : 'Not used') . " ===================================================================== "; } @@ -347,7 +343,7 @@ function write_information() function save_or_mail_results() { global $sum_results, $just_save_results, $failed_test_summary, - $PHP_FAILED_TESTS, $CUR_DIR, $php, $output_file; + $PHP_FAILED_TESTS, $php, $output_file; /* We got failed Tests, offer the user to send an e-mail to QA team, unless NO_INTERACTION is set */ if (!getenv('NO_INTERACTION') && !TRAVIS_CI) { @@ -419,7 +415,7 @@ function save_or_mail_results() } /* Always use the generated libtool - Mac OSX uses 'glibtool' */ - $libtool = shell_exec($CUR_DIR . '/libtool --version'); + $libtool = shell_exec(INIT_DIR . '/libtool --version'); /* Use shtool to find out if there is glibtool present (MacOSX) */ $sys_libtool_path = shell_exec(__DIR__ . '/build/shtool path glibtool libtool'); @@ -487,10 +483,10 @@ function save_or_mail_results() $pass_option_n = false; $pass_options = ''; -$output_file = $CUR_DIR . '/php_test_results_' . date('Ymd_Hi') . '.txt'; +$output_file = INIT_DIR . '/php_test_results_' . date('Ymd_Hi') . '.txt'; $just_save_results = false; -$leak_check = false; +$valgrind = null; $html_output = false; $html_file = null; $temp_source = null; @@ -603,19 +599,7 @@ function save_or_mail_results() break; //case 'l' case 'm': - $leak_check = true; - $valgrind_cmd = "valgrind --version"; - $valgrind_header = system_with_timeout($valgrind_cmd, $environment); - $replace_count = 0; - if (!$valgrind_header) { - error("Valgrind returned no version info, cannot proceed.\nPlease check if Valgrind is installed."); - } else { - $valgrind_version = preg_replace("/valgrind-(\d+)\.(\d+)\.(\d+)([.\w_-]+)?(\s+)/", '$1.$2.$3', $valgrind_header, 1, $replace_count); - if ($replace_count != 1) { - error("Valgrind returned invalid version info (\"$valgrind_header\"), cannot proceed."); - } - $valgrind_header = trim($valgrind_header); - } + $valgrind = new RuntestsValgrind($environment); break; case 'n': if (!$pass_option_n) { @@ -908,7 +892,7 @@ function save_or_mail_results() } foreach ($test_dirs as $dir) { - find_files("{$cwd}/{$dir}", ($dir == 'ext')); + find_files(TEST_PHP_SRCDIR."/{$dir}", ($dir == 'ext')); } foreach ($user_tests as $dir) { @@ -962,13 +946,11 @@ function test_name($name) function test_sort($a, $b) { - global $cwd; - $a = test_name($a); $b = test_name($b); - $ta = strpos($a, "{$cwd}/tests") === 0 ? 1 + (strpos($a, "{$cwd}/tests/run-test") === 0 ? 1 : 0) : 0; - $tb = strpos($b, "{$cwd}/tests") === 0 ? 1 + (strpos($b, "{$cwd}/tests/run-test") === 0 ? 1 : 0) : 0; + $ta = strpos($a, TEST_PHP_SRCDIR."/tests") === 0 ? 1 + (strpos($a, TEST_PHP_SRCDIR."/tests/run-test") === 0 ? 1 : 0) : 0; + $tb = strpos($b, TEST_PHP_SRCDIR."/tests") === 0 ? 1 + (strpos($b, TEST_PHP_SRCDIR."/tests/run-test") === 0 ? 1 : 0) : 0; if ($ta == $tb) { return strcmp($a, $b); @@ -1116,7 +1098,7 @@ function error_report($testname, $logname, $tested) function system_with_timeout($commandline, $env = null, $stdin = null, $captureStdIn = true, $captureStdOut = true, $captureStdErr = true) { - global $leak_check, $cwd; + global $valgrind; $data = ''; @@ -1135,7 +1117,7 @@ function system_with_timeout($commandline, $env = null, $stdin = null, $captureS if ($captureStdErr) { $descriptorspec[2] = array('pipe', 'w'); } - $proc = proc_open($commandline, $descriptorspec, $pipes, $cwd, $bin_env, array('suppress_errors' => true, 'binary_pipes' => true)); + $proc = proc_open($commandline, $descriptorspec, $pipes, TEST_PHP_SRCDIR, $bin_env, array('suppress_errors' => true, 'binary_pipes' => true)); if (!$proc) { return false; @@ -1149,7 +1131,7 @@ function system_with_timeout($commandline, $env = null, $stdin = null, $captureS unset($pipes[0]); } - $timeout = $leak_check ? 300 : (isset($env['TEST_TIMEOUT']) ? $env['TEST_TIMEOUT'] : 60); + $timeout = $valgrind ? 300 : (isset($env['TEST_TIMEOUT']) ? $env['TEST_TIMEOUT'] : 60); while (true) { /* hide errors from interrupted syscalls */ @@ -1251,11 +1233,10 @@ function show_file_block($file, $block, $section = null) // function run_test($php, $file, $env) { - global $log_format, $ini_overwrites, $cwd, $PHP_FAILED_TESTS; + global $log_format, $ini_overwrites, $PHP_FAILED_TESTS; global $pass_options, $DETAILED, $IN_REDIRECT, $test_cnt, $test_idx; - global $leak_check, $temp_source, $temp_target, $cfg, $environment; + global $valgrind, $temp_source, $temp_target, $cfg, $environment; global $no_clean; - global $valgrind_version; global $SHOW_ONLY_GROUPS; global $no_file_cache; global $slow_min_ms; @@ -1390,7 +1371,7 @@ function run_test($php, $file, $env) } fclose($fp); - $shortname = str_replace($cwd . '/', '', $file); + $shortname = str_replace(TEST_PHP_SRCDIR . '/', '', $file); $tested_file = $shortname; if ($borked) { @@ -1620,7 +1601,7 @@ function run_test($php, $file, $env) $extra = substr(PHP_OS, 0, 3) !== "WIN" ? "unset REQUEST_METHOD; unset QUERY_STRING; unset PATH_TRANSLATED; unset SCRIPT_FILENAME; unset REQUEST_METHOD;": ""; - if ($leak_check) { + if ($valgrind) { $env['USE_ZEND_ALLOC'] = '0'; $env['ZEND_DONT_UNLOAD_MODULES'] = 1; } else { @@ -1915,25 +1896,11 @@ function run_test($php, $file, $env) $cmd = "$php $pass_options $ini_settings -f \"$test_file\" $args$cmdRedirect"; } - if ($leak_check) { + if ($valgrind) { $env['USE_ZEND_ALLOC'] = '0'; $env['ZEND_DONT_UNLOAD_MODULES'] = 1; - $valgrind_cmd = "valgrind -q --tool=memcheck --trace-children=yes"; - if (strpos($test_file, "pcre") !== false) { - $valgrind_cmd .= " --smc-check=all"; - } - - /* --vex-iropt-register-updates=allregs-at-mem-access is necessary for phpdbg watchpoint tests */ - if (version_compare($valgrind_version, '3.8.0', '>=')) { - /* valgrind 3.3.0+ doesn't have --log-file-exactly option */ - $cmd = "$valgrind_cmd --vex-iropt-register-updates=allregs-at-mem-access --log-file=$memcheck_filename $cmd"; - } elseif (version_compare($valgrind_version, '3.3.0', '>=')) { - $cmd = "$valgrind_cmd --vex-iropt-precise-memory-exns=yes --log-file=$memcheck_filename $cmd"; - } else { - $cmd = "$valgrind_cmd --vex-iropt-precise-memory-exns=yes --log-file-exactly=$memcheck_filename $cmd"; - } - + $cmd = $valgrind->wrapCommand($cmd, $memcheck_filename, strpos($test_file, "pcre") !== false); } else { $env['USE_ZEND_ALLOC'] = '1'; $env['ZEND_DONT_UNLOAD_MODULES'] = 0; @@ -1994,7 +1961,7 @@ function run_test($php, $file, $env) $leaked = false; $passed = false; - if ($leak_check) { // leak check + if ($valgrind) { // leak check $leaked = filesize($memcheck_filename) > 0; if (!$leaked) { @@ -2269,7 +2236,7 @@ function run_test($php, $file, $env) $diff = empty($diff) ? '' : preg_replace('/\e/', '', $diff); - junit_mark_test_as($restype, str_replace($cwd . '/', '', $tested_file), $tested, null, $info, $diff); + junit_mark_test_as($restype, str_replace(TEST_PHP_SRCDIR . '/', '', $tested_file), $tested, null, $info, $diff); return $restype[0] . 'ED'; } @@ -2490,7 +2457,7 @@ function compute_summary() function get_summary($show_ext_summary, $show_html) { - global $exts_skipped, $exts_tested, $n_total, $sum_results, $percent_results, $end_time, $start_time, $failed_test_summary, $PHP_FAILED_TESTS, $leak_check; + global $exts_skipped, $exts_tested, $n_total, $sum_results, $percent_results, $end_time, $start_time, $failed_test_summary, $PHP_FAILED_TESTS, $valgrind; $x_total = $n_total - $sum_results['SKIPPED'] - $sum_results['BORKED']; @@ -2535,7 +2502,7 @@ function get_summary($show_ext_summary, $show_html) Tests failed : ' . sprintf('%4d (%5.1f%%)', $sum_results['FAILED'], $percent_results['FAILED']) . ' ' . sprintf('(%5.1f%%)', $x_failed) . ' Expected fail : ' . sprintf('%4d (%5.1f%%)', $sum_results['XFAILED'], $percent_results['XFAILED']) . ' ' . sprintf('(%5.1f%%)', $x_xfailed); - if ($leak_check) { + if ($valgrind) { $summary .= ' Tests leaked : ' . sprintf('%4d (%5.1f%%)', $sum_results['LEAKED'], $percent_results['LEAKED']) . ' ' . sprintf('(%5.1f%%)', $x_leaked); } @@ -2978,6 +2945,54 @@ function junit_finish_timer($file_name) { unset($JUNIT['files'][$file_name]['start']); } +class RuntestsValgrind { + protected $version = ''; + protected $header = ''; + protected $version_3_3_0 = false; + protected $verison_3_8_0 = false; + + public function getVersion() { + return $this->version; + } + + public function getHeader() { + return $this->header; + } + + public function __construct(array $environment) { + $header = system_with_timeout('valgrind --version', $environment); + if (!$header) { + error("Valgrind returned no version info, cannot proceed.\nPlease check if Valgrind is installed."); + } + $count = 0; + $version = preg_replace("/valgrind-(\d+)\.(\d+)\.(\d+)([.\w_-]+)?(\s+)/", '$1.$2.$3', $header, 1, $count); + if ($count != 1) { + error("Valgrind returned invalid version info (\"{$header}\"), cannot proceed."); + } + $this->version = $version; + $this->header = trim($header); + $this->version_3_3_0 = version_compare($version, '3.3.0', '>='); + $this->version_3_8_0 = version_compare($version, '3.8.0', '>='); + } + + public function wrapCommand($cmd, $memcheck_filename, $check_all) { + $vcmd = 'valgrind -q --tool=memcheck --trace-children=yes'; + if ($check_all) { + $vcmd .= ' --smc-check=all'; + } + + /* --vex-iropt-register-updates=allregs-at-mem-access is necessary for phpdbg watchpoint tests */ + if ($this->version_3_8_0) { + /* valgrind 3.3.0+ doesn't have --log-file-exactly option */ + return "$vcmd --vex-iropt-register-updates=allregs-at-mem-access --log-file=$memcheck_filename $cmd"; + } elseif ($this->version_3_3_0) { + return "$vcmd --vex-iropt-precise-memory-exns=yes --log-file=$memcheck_filename $cmd"; + } else { + return "$vcmd --vex-iropt-precise-memory-exns=yes --log-file-exactly=$memcheck_filename $cmd"; + } + } +} + /* * Local variables: * tab-width: 4 diff --git a/sapi/apache2handler/config.m4 b/sapi/apache2handler/config.m4 index 2e64b215e5cb5..317670028753a 100644 --- a/sapi/apache2handler/config.m4 +++ b/sapi/apache2handler/config.m4 @@ -103,13 +103,6 @@ if test "$PHP_APXS2" != "no"; then SAPI_SHARED=libs/libphp7.so INSTALL_IT="$INSTALL_IT $SAPI_SHARED" ;; - *beos*) - if test -f _APP_; then `rm _APP_`; fi - `ln -s $APXS_BINDIR/httpd _APP_` - EXTRA_LIBS="$EXTRA_LIBS _APP_" - PHP_SELECT_SAPI(apache2handler, shared, mod_php7.c sapi_apache2.c apache_config.c php_functions.c, $APACHE_CFLAGS) - INSTALL_IT="$INSTALL_IT $SAPI_LIBTOOL" - ;; *) PHP_SELECT_SAPI(apache2handler, shared, mod_php7.c sapi_apache2.c apache_config.c php_functions.c, $APACHE_CFLAGS) INSTALL_IT="$INSTALL_IT $SAPI_LIBTOOL" diff --git a/sapi/cli/TODO b/sapi/cli/TODO deleted file mode 100644 index 22e6689001f09..0000000000000 --- a/sapi/cli/TODO +++ /dev/null @@ -1,2 +0,0 @@ -TODO: - diff --git a/sapi/cli/tests/012-2.phpt b/sapi/cli/tests/012-2.phpt new file mode 100644 index 0000000000000..34be9367085ba --- /dev/null +++ b/sapi/cli/tests/012-2.phpt @@ -0,0 +1,52 @@ +--TEST-- +more invalid arguments and error messages +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +string(57) "Either execute direct code, process stdin or use a file. +" +string(57) "Either execute direct code, process stdin or use a file. +" +string(1) "3" +string(57) "Either execute direct code, process stdin or use a file. +" +string(57) "Either execute direct code, process stdin or use a file. +" +string(57) "Either execute direct code, process stdin or use a file. +" +string(57) "Either execute direct code, process stdin or use a file. +" +string(57) "Either execute direct code, process stdin or use a file. +" +string(42) "Source highlighting only works for files. +" +string(39) "Source stripping only works for files. +" +string(57) "Either execute direct code, process stdin or use a file. +" +Done diff --git a/sapi/cli/tests/cli_get_process_title_basic.phpt b/sapi/cli/tests/cli_get_process_title_basic.phpt new file mode 100644 index 0000000000000..66d1d4f3a7cfd --- /dev/null +++ b/sapi/cli/tests/cli_get_process_title_basic.phpt @@ -0,0 +1,18 @@ +--TEST-- +cli_get_process_title() function : basic functionality +--CREDITS-- +Patrick Allaert patrickallaert@php.net +@nephp #nephp17 +--SKIPIF-- + +--FILE-- + +--EXPECT-- +Title correctly retrieved! diff --git a/sapi/cli/tests/cli_get_process_title_error.phpt b/sapi/cli/tests/cli_get_process_title_error.phpt new file mode 100644 index 0000000000000..67274db26ce13 --- /dev/null +++ b/sapi/cli/tests/cli_get_process_title_error.phpt @@ -0,0 +1,16 @@ +--TEST-- +cli_get_process_title() function : error conditions +--CREDITS-- +Patrick Allaert patrickallaert@php.net +@nephp #nephp17 +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +Warning: cli_get_process_title() expects exactly 0 parameters, 1 given in %scli_get_process_title_error.php on line 2 diff --git a/sapi/cli/tests/cli_set_process_title_basic.phpt b/sapi/cli/tests/cli_set_process_title_basic.phpt new file mode 100644 index 0000000000000..9899f3456b166 --- /dev/null +++ b/sapi/cli/tests/cli_set_process_title_basic.phpt @@ -0,0 +1,19 @@ +--TEST-- +cli_set_process_title() function : basic functionality +--CREDITS-- +Patrick Allaert patrickallaert@php.net +@nephp #nephp17 +--SKIPIF-- + +--FILE-- + +--EXPECT-- +Successfully set title diff --git a/sapi/cli/tests/cli_set_process_title_error.phpt b/sapi/cli/tests/cli_set_process_title_error.phpt new file mode 100644 index 0000000000000..025c73015bffa --- /dev/null +++ b/sapi/cli/tests/cli_set_process_title_error.phpt @@ -0,0 +1,19 @@ +--TEST-- +cli_set_process_title() function : error conditions +--CREDITS-- +Patrick Allaert patrickallaert@php.net +@nephp #nephp17 +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +Warning: cli_set_process_title() expects exactly 1 parameter, 0 given in %scli_set_process_title_error.php on line 2 + +Warning: cli_set_process_title() expects exactly 1 parameter, 2 given in %scli_set_process_title_error.php on line 3 diff --git a/sapi/fpm/fpm/fpm_sockets.c b/sapi/fpm/fpm/fpm_sockets.c index d58a8f82b6cc1..f16bdfb9387d9 100644 --- a/sapi/fpm/fpm/fpm_sockets.c +++ b/sapi/fpm/fpm/fpm_sockets.c @@ -179,7 +179,7 @@ static int fpm_sockets_new_listening_socket(struct fpm_worker_pool_s *wp, struct if (wp->listen_address_domain == FPM_AF_UNIX) { if (fpm_socket_unix_test_connect((struct sockaddr_un *)sa, socklen) == 0) { - zlog(ZLOG_ERROR, "An another FPM instance seems to already listen on %s", ((struct sockaddr_un *) sa)->sun_path); + zlog(ZLOG_ERROR, "Another FPM instance seems to already listen on %s", ((struct sockaddr_un *) sa)->sun_path); close(sock); return -1; } diff --git a/travis/compile.sh b/travis/compile.sh index b2d29b99df670..0017026c1b81f 100755 --- a/travis/compile.sh +++ b/travis/compile.sh @@ -45,6 +45,7 @@ $TS \ --with-png-dir=/usr \ --enable-exif \ --enable-zip \ +--without-libzip \ --with-zlib \ --with-zlib-dir=/usr \ --enable-soap \ diff --git a/win32/build/config.w32 b/win32/build/config.w32 index 43b03626a422f..71cf49156f84f 100644 --- a/win32/build/config.w32 +++ b/win32/build/config.w32 @@ -60,29 +60,32 @@ DEFINE("BASE_INCLUDES", "/I . /I main /I Zend /I TSRM /I ext "); toolset_setup_common_cflags(); -ARG_WITH('mp', 'Tell Visual Studio use up to [n,auto,disable] processes for compilation', 'auto'); -var PHP_MP_DISABLED = true; -if (VS_TOOLSET && PHP_MP != 'disable') { - if(PHP_DEBUG == 'yes') { - STDOUT.WriteLine('WARNING: Debug builds cannot be built using multi processing'); - } else { - // no from disable-all - if(PHP_MP == 'auto' || PHP_MP == 'no') { - ADD_FLAG('CFLAGS', ' /MP '); - PHP_MP_DISABLED = false; +if (VS_TOOLSET) { + ARG_WITH('mp', 'Tell Visual Studio use up to [n,auto,disable] processes for compilation', 'auto'); + var PHP_MP_DISABLED = true; + + if (PHP_MP != 'disable') { + if(PHP_DEBUG == 'yes') { + STDOUT.WriteLine('WARNING: Debug builds cannot be built using multi processing'); } else { - if(parseInt(PHP_MP) != 0) { - ADD_FLAG('CFLAGS', ' /MP'+ PHP_MP +' '); + // no from disable-all + if(PHP_MP == 'auto' || PHP_MP == 'no') { + ADD_FLAG('CFLAGS', ' /MP '); PHP_MP_DISABLED = false; } else { - STDOUT.WriteLine('WARNING: Invalid argument for MP: ' + PHP_MP); + if(parseInt(PHP_MP) != 0) { + ADD_FLAG('CFLAGS', ' /MP'+ PHP_MP +' '); + PHP_MP_DISABLED = false; + } else { + STDOUT.WriteLine('WARNING: Invalid argument for MP: ' + PHP_MP); + } } } } -} -if (!PHP_MP_DISABLED) { - STDOUT.WriteLine('Enabling multi process build'); + if (!PHP_MP_DISABLED) { + STDOUT.WriteLine('Enabling multi process build'); + } } // General link flags @@ -241,7 +244,8 @@ ADD_FLAG("CFLAGS_BD_ZEND", "/D ZEND_ENABLE_STATIC_TSRMLS_CACHE=1"); ADD_SOURCES("main", "main.c snprintf.c spprintf.c getopt.c fopen_wrappers.c \ php_scandir.c php_ini.c SAPI.c rfc1867.c php_content_types.c strlcpy.c \ strlcat.c mergesort.c reentrancy.c php_variables.c php_ticks.c network.c \ - php_open_temporary_file.c output.c internal_functions.c php_sprintf.c"); + php_open_temporary_file.c output.c internal_functions.c php_sprintf.c \ + php_syslog.c"); ADD_FLAG("CFLAGS_BD_MAIN", "/D ZEND_ENABLE_STATIC_TSRMLS_CACHE=1"); AC_DEFINE('HAVE_STRNLEN', 1); diff --git a/win32/build/confutils.js b/win32/build/confutils.js index aa7bf8017bd99..33f03d0b30a32 100644 --- a/win32/build/confutils.js +++ b/win32/build/confutils.js @@ -62,6 +62,9 @@ var sapi_enabled = new Array(); /* Store the headers to install */ var headers_install = new Array(); +/* Store unknown configure options */ +var INVALID_CONFIG_ARGS = new Array(); + /* Mapping CL version > human readable name */ var VC_VERSIONS = new Array(); VC_VERSIONS[1700] = 'MSVC11 (Visual C++ 2012)'; @@ -101,10 +104,10 @@ if (typeof(CWD) == "undefined") { /* defaults; we pick up the precise versions from configure.ac */ var PHP_VERSION = 7; -var PHP_MINOR_VERSION = 2; +var PHP_MINOR_VERSION = 3; var PHP_RELEASE_VERSION = 0; var PHP_EXTRA_VERSION = ""; -var PHP_VERSION_STRING = "7.2.0"; +var PHP_VERSION_STRING = "7.3.0"; /* Get version numbers and DEFINE as a string */ function get_version_numbers() @@ -402,11 +405,15 @@ function conf_process_args() } } if (!found) { - STDERR.WriteLine("Unknown option " + argname + "; please try configure.js --help for a list of valid options"); - WScript.Quit(2); + INVALID_CONFIG_ARGS[INVALID_CONFIG_ARGS.length] = argname; } } + if (PHP_SNAPSHOT_BUILD != 'no' && INVALID_CONFIG_ARGS.length) { + STDERR.WriteLine('Unknown option ' + INVALID_CONFIG_ARGS[0] + '; please try configure.js --help for a list of valid options'); + WScript.Quit(2); + } + if (configure_help_mode) { STDOUT.WriteLine(word_wrap_and_indent(0, "Options that enable extensions and SAPI will accept \ @@ -2006,6 +2013,17 @@ function generate_files() STDOUT.WriteBlankLines(1); write_summary(); + if (INVALID_CONFIG_ARGS.length) { + STDOUT.WriteLine('WARNING'); + STDOUT.WriteLine('The following arguments is invalid, and therefore ignored:'); + + for (var i = 0; i < INVALID_CONFIG_ARGS.length; ++i) { + STDOUT.WriteLine(' ' + INVALID_CONFIG_ARGS[i]); + } + + STDOUT.WriteBlankLines(2); + } + if (PHP_SNAPSHOT_BUILD != "no") { STDOUT.WriteLine("Type 'nmake snap' to build a PHP snapshot"); } else { diff --git a/win32/build/mkdist.php b/win32/build/mkdist.php index 804fcf758554f..bf91b8b36093e 100644 --- a/win32/build/mkdist.php +++ b/win32/build/mkdist.php @@ -46,12 +46,6 @@ function get_depends($module) /* apache 2 */ 'libhttpd.dll', 'libapr.dll', 'libaprutil.dll','libapr-1.dll', 'libaprutil-1.dll', - /* pi3web */ - 'piapi.dll', 'pi3api.dll', - - /* nsapi */ - 'ns-httpd30.dll', 'ns-httpd35.dll', 'ns-httpd36.dll', 'ns-httpd40.dll', - /* oracle */ 'oci.dll', 'ociw32.dll', @@ -253,10 +247,10 @@ function extract_file_from_tarball($pkg, $filename, $dest_dir) /* {{{ */ $text_files = array( "LICENSE" => "license.txt", "NEWS" => "news.txt", + "INSTALL" => "install.txt", "README.REDIST.BINS" => "readme-redist-bins.txt", "php.ini-development" => "php.ini-development", - "php.ini-production" => "php.ini-production", - "win32/install.txt" => "install.txt", + "php.ini-production" => "php.ini-production" ); foreach ($text_files as $src => $dest) { diff --git a/win32/install.txt b/win32/install.txt deleted file mode 100644 index 0b989e8fe975b..0000000000000 --- a/win32/install.txt +++ /dev/null @@ -1,1797 +0,0 @@ -Installing PHP - __________________________________________________________________ - - Table of Contents - Preface - 1. General Installation Considerations - 2. Installation on Windows systems - - Manual Installation Steps - ActiveScript - Microsoft IIS - Apache 1.3.x on Microsoft Windows - Apache 2.0.x on Microsoft Windows - Sun, iPlanet and Netscape servers on Microsoft Windows - OmniHTTPd Server - Sambar Server on Microsoft Windows - Xitami on Microsoft Windows - Installation of extensions on Windows - - 3. Installation of PECL extensions - - Introduction to PECL Installations - Downloading PECL extensions - PECL for Windows users - Compiling shared PECL extensions with the pecl command - Compiling shared PECL extensions with phpize - Compiling PECL extensions statically into PHP - - 4. Problems? - - Read the FAQ - Other problems - Bug reports - - 5. Runtime Configuration - - The configuration file - How to change configuration settings - - 6. Installation FAQ - __________________________________________________________________ - -Preface - - These installation instructions were generated from the HTML version of - the PHP Manual so formatting and linking have been altered. See the - online and updated version at: http://php.net/install.windows - __________________________________________________________________ - -Chapter 1. General Installation Considerations - - Before starting the installation, first you need to know what do you - want to use PHP for. There are three main fields you can use PHP, as - described in the What can PHP do? section: - - * Websites and web applications (server-side scripting) - * Command line scripting - * Desktop (GUI) applications - - For the first and most common form, you need three things: PHP itself, - a web server and a web browser. You probably already have a web - browser, and depending on your operating system setup, you may also - have a web server (e.g. Apache on Linux and MacOS X; IIS on Windows). - You may also rent webspace at a company. This way, you don't need to - set up anything on your own, only write your PHP scripts, upload it to - the server you rent, and see the results in your browser. - - In case of setting up the server and PHP on your own, you have two - choices for the method of connecting PHP to the server. For many - servers PHP has a direct module interface (also called SAPI). These - servers include Apache, Microsoft Internet Information Server, Netscape - and iPlanet servers. Many other servers have support for ISAPI, the - Microsoft module interface (OmniHTTPd for example). If PHP has no - module support for your web server, you can always use it as a CGI or - FastCGI processor. This means you set up your server to use the CGI - executable of PHP to process all PHP file requests on the server. - - If you are also interested to use PHP for command line scripting (e.g. - write scripts autogenerating some images for you offline, or processing - text files depending on some arguments you pass to them), you always - need the command line executable. For more information, read the - section about writing command line PHP applications. In this case, you - need no server and no browser. - - With PHP you can also write desktop GUI applications using the PHP-GTK - extension. This is a completely different approach than writing web - pages, as you do not output any HTML, but manage Windows and objects - within them. For more information about PHP-GTK, please visit the site - dedicated to this extension. PHP-GTK is not included in the official - PHP distribution. - - From now on, this section deals with setting up PHP for web servers on - Unix and Windows with server module interfaces and CGI executables. You - will also find information on the command line executable in the - following sections. - - PHP source code and binary distributions for Windows can be found at - http://www.php.net/downloads.php. We recommend you to choose a mirror - nearest to you for downloading the distributions. - __________________________________________________________________ - -Chapter 2. Installation on Windows systems - - This section applies to Windows 98/Me and Windows NT/2000/XP/2003. PHP - will not work on 16 bit platforms such as Windows 3.1 and sometimes we - refer to the supported Windows platforms as Win32. Windows 95 is no - longer supported as of PHP 4.3.0. - - If you have Microsoft Visual Studio, you can also build PHP from the - original source code. - - Once you have PHP installed on your Windows system, you may also want - to load various extensions for added functionality. - - Warning - - There are several all-in-one installers over the Internet, but none of - those are endorsed by PHP.net, as we believe that the manual - installation is the best choice to have your system secure and - optimised. - __________________________________________________________________ - -Manual Installation Steps - - This install guide will help you manually install and configure PHP - with a web server on Microsoft Windows. To get started you'll need to - download the zip binary distribution from the downloads page at - http://www.php.net/downloads.php. - - Although there are many all-in-one installation kits, we recommend you - take the time to setup PHP yourself as this will provide you with a - better understanding of the system, and enables you to install PHP - extensions easily when needed. - - Upgrading from a previous PHP version: Previous editions of the - manual suggest moving various ini and DLL files into your SYSTEM - (i.e. C:\WINDOWS) folder and while this simplifies the installation - procedure it makes upgrading difficult. We advise you remove all of - these files (like php.ini and PHP related DLLs from the Windows - SYSTEM folder) before moving on with a new PHP installation. Be sure - to backup these files as you might break the entire system. The old - php.ini might be useful in setting up the new PHP as well. And as - you'll soon learn, the preferred method for installing PHP is to - keep all PHP related files in one directory and have this directory - available to your systems PATH. - - MDAC requirements: If you use Microsoft Windows 98/NT4 download the - latest version of the Microsoft Data Access Components (MDAC) for - your platform. MDAC is available at http://msdn.microsoft.com/data/. - This requirement exists because ODBC is built into the distributed - Windows binaries. - - The following steps should be completed on all installations before any - server specific instructions are performed: - - Extract the distribution file into a directory of your choice. If you - are installing PHP 4, extract to C:\, as the zip file expands to a - foldername like php-4.3.7-Win32. If you are installing PHP 7, extract - to C:\php as the zip file doesn't expand as in PHP 4. You may choose a - different location but do not have spaces in the path (like C:\Program - Files\PHP) as some web servers will crash if you do. - - The directory structure extracted from the zip is different for PHP - versions 4 and 5 and look like as follows: - - Example 2-2. PHP 7 package structure -c:\php - | - +--dev - | | - | |-php7ts.lib - | - +--ext -- extension DLLs for PHP - | | - | |-php_bz2.dll - | | - | |-php_cpdf.dll - | | - | |-.. - | - +--extras - | | - | +--mibs -- support files for SNMP - | | - | +--openssl -- support files for Openssl - | | - | +--pdf-related -- support files for PDF - | | - | |-mime.magic - | - +--pear -- initial copy of PEAR - | - | - |-go-pear.bat -- PEAR setup script - | - |-fdftk.dll - | - |-.. - | - |-php-cgi.exe -- CGI executable - | - |-php-win.exe -- executes scripts without an opened command prompt - | - |-php.exe -- CLI executable - ONLY for command line scripting - | - |-.. - | - |-php.ini-development -- development php.ini settings - | - |-php.ini-production -- recommended php.ini settings for production - | - |-php5activescript.dll - | - |-php7apache2_4.dll - | - |-.. - | - |-php5ts.dll -- core PHP DLL - | - |-... - - Notice the differences and similarities. Both PHP 4 and PHP 5 have a - CGI executable, a CLI executable, and server modules, but they are - located in different folders and/or have different names. While PHP 4 - packages have the server modules in the sapi folder, PHP 5 - distributions have no such directory and instead they're in the PHP - folder root. The supporting DLLs for the PHP 5 extensions are also not - in a separate directory. - - Note: In PHP 4, you should move all files located in the dll and - sapi folders to the main folder (e.g. C:\php). - - Here is a list of server modules shipped with PHP 5: - - * php7apache2_4.dll - Apache 2.4.x module. - - Server modules provide significantly better performance and additional - functionality compared to the CGI binary. The FastCGI is significantly - more stable and can be faster than the ISAPI module with IIS. - The CLI version is designed to let you use PHP for command line - scripting. More information about CLI is available in the chapter - about using PHP from the command line. - - Warning - - The SAPI modules have been significantly improved as of the 4.1 - release, however, in older systems you may encounter server errors or - other server modules failing, such as ASP. - - The CGI and CLI binaries, and the web server modules all require the - php7ts.dll file to be available to them. You have to make - sure that this file can be found by your PHP installation. The search - order for this DLL is as follows: - - * The same directory from where php.exe is called, or in case you use - a SAPI module, the web server's directory (e.g. C:\Program - Files\Apache Group\Apache2\bin). - * Any directory in your Windows PATH environment variable. - - To make php7ts.dll available you have three options: copy - the file to the Windows system directory, copy the file to the web - server's directory, or add your PHP directory, C:\php to the PATH. For - better maintenance, we advise you to follow the last option, add C:\php - to the PATH, because it will be simpler to upgrade PHP in the future. - Read more about how to add your PHP directory to PATH in the - corresponding FAQ entry (and then don't forget to restart the computer - - logoff isn't enough). - - The next step is to set up a valid configuration file for PHP, php.ini. - There are two ini files distributed in the zip file, php.ini-development - and php.ini-production. We advise you to use php.ini-production, - because we optimized the default settings in this file for performance, - and security. Read this well documented file carefully because it has - changes from php.ini-production that will drastically affect your setup. - Some examples are display_errors being off and magic_quotes_gpc being off. - In addition to reading these, study the ini settings and set every - element manually yourself. If you would like to achieve the best - security, then this is the way for you, although PHP works fine with - these default ini files. Copy your chosen ini-file to a directory that - PHP is able to find and rename it to php.ini. PHP searches for php.ini - in the locations described in the Section called The configuration file - in Chapter 5 section. - - If you are running Apache 2, the simpler option is to use the PHPIniDir - directive (read the installation on Apache 2 page), otherwise your best - option is to set the PHPRC environment variable. This process is - explained in the following FAQ entry. - - Note: If you're using NTFS on Windows NT, 2000, XP or 2003, make - sure that the user running the web server has read permissions to - your php.ini (e.g. make it readable by Everyone). - - The following steps are optional: - - * Edit your new php.ini file. If you plan to use OmniHTTPd, do not - follow the next step. Set the doc_root to point to your web servers - document_root. For example: - -doc_root = c:\inetpub\wwwroot // for IIS - -doc_root = c:\apache\htdocs // for Apache - - * Choose the extensions you would like to load when PHP starts. See - the section about Windows extensions, about how to set up one, and - what is already built in. Note that on a new installation it is - advisable to first get PHP working and tested without any - extensions before enabling them in php.ini. - - PHP is now setup on your system. The next step is to choose a web - server, and enable it to run PHP. Choose a web server from the table of - contents. - __________________________________________________________________ - -ActiveScript - - This section contains notes specific to the ActiveScript installation. - - ActiveScript is a Windows only SAPI that enables you to use PHP script - in any ActiveScript compliant host, like Windows Script Host, - ASP/ASP.NET, Windows Script Components or Microsoft Scriptlet control. - - As of PHP 5.0.1, ActiveScript has been moved to the PECL repository. - The DLL for this PECL extension may be downloaded from either the PHP - Downloads page or from http://pecl4win.php.net/ - - Note: You should read the manual installation steps first! - - After installing PHP, you should download the ActiveScript DLL - (php7activescript.dll) and place it in the main PHP folder (e.g. - C:\php). - - After having all the files needed, you must register the DLL on your - system. To achieve this, open a Command Prompt window (located in the - Start Menu). Then go to your PHP directory by typing something like cd - C:\php. To register the DLL just type regsvr32 php7activescript.dll. - - To test if ActiveScript is working, create a new file, named test.wsf - (the extension is very important) and type: - - - - - - - Save and double-click on the file. If you receive a little window - saying "Hello World!" you're done. - - Note: In PHP 4, the engine was named 'ActivePHP', so if you are - using PHP 4, you should replace 'PHPScript' with 'ActivePHP' in the - above example. - - Note: ActiveScript doesn't use the default php.ini file. Instead, it - will look only in the same directory as the .exe that caused it to - load. You should create php-activescript.ini and place it in that - folder, if you wish to load extensions, etc. - __________________________________________________________________ - -Microsoft IIS - - This section contains notes and hints specific to IIS (Microsoft - Internet Information Server). - - Warning - - By using the CGI setup, your server is open to several possible - attacks. Please read our CGI security section to learn how to defend - yourself from those attacks. - __________________________________________________________________ - -General considerations for all installations of PHP with IIS - - * First, read the Manual Installation Instructions. Do not skip this - step as it provides crucial information for installing PHP on - Windows. - * CGI users must set the cgi.force_redirect PHP directive to 0 inside - php.ini. Read the faq on cgi.force_redirect for important details. - Also, CGI users may want to set the cgi.redirect_status_env - directive. When using directives, be sure these directives aren't - commented out inside php.ini. - * The PHP 4 CGI is named php.exe while in PHP 7 it's php-cgi.exe. In - PHP 7, php.exe is the CLI, and not the CGI. - * Modify the Windows PATH environment variable to include the PHP - directory. This way the PHP DLL files and PHP executables can all - remain in the PHP directory without cluttering up the Windows - system directory. For more details, see the FAQ on Setting the - PATH. - * The IIS user (usually IUSR_MACHINENAME) needs permission to read - various files and directories, such as php.ini, docroot, and the - session tmp directory. - * Be sure the extension_dir and doc_root PHP directives are - appropriately set in php.ini. These directives depend on the system - that PHP is being installed on. In PHP 4, the extension_dir is - extensions while with PHP 7 it's ext. So, an example PHP 7 - extensions_dir value is "c:\php\ext" and an example IIS doc_root - value is "c:\Inetpub\wwwroot". - * PHP extension DLL files, such as php_mysql.dll and php_curl.dll, - are found in the zip package of the PHP download. In PHP 7, many - extensions are part of PECL and can be downloaded in the - "Collection of PECL modules" package. Files such as php_zip.dll and - php_ssh2.dll. Download PHP files here. - * When defining the executable, the 'check that file exists' box may - also be checked. For a small performance penalty, the IIS - will check that the script file exists and sort out authentication - before firing up PHP. This means that the web server will provide - sensible 404 style error messages instead of CGI errors complaining - that PHP did not output any data. - __________________________________________________________________ - -Windows NT/200x/XP and IIS 4 or newer - - PHP may be installed as a CGI binary, or with the ISAPI module. In - either case, you need to start the Microsoft Management Console (may - appear as 'Internet Services Manager', either in your Windows NT 4.0 - Option Pack branch or the Control Panel=>Administrative Tools under - Windows 2000/XP). Then right click on your Web server node (this will - most probably appear as 'Default Web Server'), and select 'Properties'. - - If you want to use the CGI binary, do the following: - - * Under 'Home Directory', 'Virtual Directory', or 'Directory', do the - following: - * Change the Execute Permissions to 'Scripts only' - * Click on the 'Configuration' button, and choose the Application - Mappings tab. Click Add and set the Executable path to the - appropriate CGI file. An example PHP 7 value is: C:\php\php-cgi.exe - Supply .php as the extension. Leave 'Method exclusions' blank, and - check the 'Script engine' checkbox. Now, click OK a few times. - * Set up the appropriate security. (This is done in Internet Service - Manager), and if your NT Server uses NTFS file system, add execute - rights for I_USR_ to the directory that contains php.exe / - php-cgi.exe. - - To use the ISAPI module, do the following: - - * If you don't want to perform HTTP Authentication using PHP, you can - (and should) skip this step. Under ISAPI Filters, add a new ISAPI - filter. Use PHP as the filter name, and supply a path to the - php7isapi.dll. - * Under 'Home Directory', 'Virtual Directory', or 'Directory', do the - following: - * Change the Execute Permissions to 'Scripts only' - * Click on the 'Configuration' button, and choose the Application - Mappings tab. Click Add and set the Executable path to the - appropriate ISAPI DLL. An example PHP 7 value is: - C:\php\php7isapi.dll Supply .php as the extension. Leave 'Method - exclusions' blank, and check the 'Script engine' checkbox. Now, - click OK a few times. - * Stop IIS completely (NET STOP iisadmin) - * Start IIS again (NET START w3svc) - - With IIS 6 (2003 Server), open up the IIS Manager, go to Web Service - Extensions, choose "Add a new Web service extension", enter in a name - such as PHP, choose the Add button and for the value browse to either - the ISAPI file (php7isapi.dll) or CGI (php.exe or - php-cgi.exe) then check "Set extension status to Allowed" and click OK. - - In order to use index.php as a default content page, do the following: - From within the Documents tab, choose Add. Type in index.php and click - OK. Adjust the order by choosing Move Up or Move Down. This is similar - to setting DirectoryIndex with Apache. - - The steps above must be repeated for each extension that is to be - associated with PHP scripts. .php is the most common although .php3 may - be required for legacy applications. - - If you experience 100% CPU usage after some time, turn off the IIS - setting Cache ISAPI Application. - __________________________________________________________________ - -Windows and IIS - -See http://www.php.net/install.windows - __________________________________________________________________ - -Apache 1.3.x on Microsoft Windows - - This section contains notes and hints specific to Apache 1.3.x installs - of PHP on Microsoft Windows systems. There are also instructions and - notes for Apache 2 on a separate page. - - Note: Please read the manual installation steps first! - - There are two ways to set up PHP to work with Apache 1.3.x on Windows. - One is to use the CGI binary (php.exe for PHP 4 and php-cgi.exe for PHP - 5), the other is to use the Apache Module DLL. In either case you need - to edit your httpd.conf to configure Apache to work with PHP, and then - restart the server. - - It is worth noting here that now the SAPI module has been made more - stable under Windows, we recommend it's use above the CGI binary, since - it is more transparent and secure. - - Although there can be a few variations of configuring PHP under Apache, - these are simple enough to be used by the newcomer. Please consult the - Apache Documentation for further configuration directives. - - After changing the configuration file, remember to restart the server, - for example, NET STOP APACHE followed by NET START APACHE, if you run - Apache as a Windows Service, or use your regular shortcuts. - - Note: Remember that when adding path values in the Apache - configuration files on Windows, all backslashes such as - c:\directory\file.ext must be converted to forward slashes, as - c:/directory/file.ext. A trailing slash may also be necessary for - directories. - __________________________________________________________________ - -Installing as an Apache module - - You should add the following lines to your Apache httpd.conf file: - - Example 2-3. PHP as an Apache 1.3.x module - - This assumes PHP is installed to c:\php. Adjust the path if this is not - the case. - - For PHP 7: -# Add to the end of the LoadModule section -LoadModule php7_module "C:/php/php7apache.dll" - -# Add to the end of the AddModule section -AddModule mod_php7.c - - For both: -# Add this line inside the conditional brace -AddType application/x-httpd-php .php - -# For syntax highlighted .phps files, also add -AddType application/x-httpd-php-source .phps - __________________________________________________________________ - -Installing as a CGI binary - - If you unzipped the PHP package to C:\php\ as described in the Manual - Installation Steps section, you need to insert these lines to your - Apache configuration file to set up the CGI binary: - - Example 2-4. PHP and Apache 1.3.x as CGI -ScriptAlias /php/ "c:/php/" -AddType application/x-httpd-php .php - -# For PHP 4 -Action application/x-httpd-php "/php/php.exe" - -# For PHP 7 -Action application/x-httpd-php "/php/php-cgi.exe" - -# specify the directory where php.ini is -SetEnv PHPRC C:/php - - Note that the second line in the list above can be found in the actual - versions of httpd.conf, but it is commented out. Remember also to - substitute the c:/php/ for your actual path to PHP. - - Warning - - By using the CGI setup, your server is open to several possible - attacks. Please read our CGI security section to learn how to defend - yourself from those attacks. - - If you would like to present PHP source files syntax highlighted, there - is no such convenient option as with the module version of PHP. If you - chose to configure Apache to use PHP as a CGI binary, you will need to - use the highlight_file() function. To do this simply create a PHP - script file and add this code: . - __________________________________________________________________ - -Apache 2.0.x on Microsoft Windows - - This section contains notes and hints specific to Apache 2.0.x installs - of PHP on Microsoft Windows systems. We also have instructions and - notes for Apache 1.3.x users on a separate page. - - Note: You should read the manual installation steps first! - - Apache 2.2.x Support: Users of Apache 2.2.x may use the - documentation below except the appropriate DLL file is named - php7apache2_2.dll and it only exists as of PHP 7.2.0. See also - http://snaps.php.net/ - - Warning - - We do not recommend using a threaded MPM in production with Apache2. - Use the prefork MPM instead, or use Apache1. For information on why, - read the related FAQ entry on using Apache2 with a threaded MPM - - You are highly encouraged to take a look at the Apache Documentation to - get a basic understanding of the Apache 2.0.x Server. Also consider to - read the Windows specific notes for Apache 2.0.x before reading on - here. - - PHP and Apache 2.0.x compatibility notes: The following versions of - PHP are known to work with the most recent version of Apache 2.0.x: - - * PHP 4.3.0 or later available at http://www.php.net/downloads.php. - * the latest stable development version. Get the source code - http://snaps.php.net/php7-latest.tar.gz or download binaries for - Windows http://snaps.php.net/win32/php7-win32-latest.zip. - * a prerelease version downloadable from http://qa.php.net/. - * you have always the option to obtain PHP through SVN. - - These versions of PHP are compatible to Apache 2.0.40 and later. - - Apache 2.0 SAPI-support started with PHP 4.2.0. PHP 4.2.3 works with - Apache 2.0.39, don't use any other version of Apache with PHP 4.2.3. - However, the recommended setup is to use PHP 4.3.0 or later with the - most recent version of Apache2. - - All mentioned versions of PHP will work still with Apache 1.3.x. - - Warning - - Apache 2.0.x is designed to run on Windows NT 4.0, Windows 2000 or - Windows XP. At this time, support for Windows 9x is incomplete. Apache - 2.0.x is not expected to work on those platforms at this time. - - Download the most recent version of Apache 2.0.x and a fitting PHP - version. Follow the Manual Installation Steps and come back to go on - with the integration of PHP and Apache. - - There are two ways to set up PHP to work with Apache 2.0.x on Windows. - One is to use the CGI binary the other is to use the Apache module DLL. - In either case you need to edit your httpd.conf to configure Apache to - work with PHP and then restart the server. - - Note: Remember that when adding path values in the Apache - configuration files on Windows, all backslashes such as - c:\directory\file.ext must be converted to forward slashes, as - c:/directory/file.ext. A trailing slash may also be necessary for - directories. - __________________________________________________________________ - -Installing as a CGI binary - - You need to insert these three lines to your Apache httpd.conf - configuration file to set up the CGI binary: - - Example 2-5. PHP and Apache 2.0 as CGI -ScriptAlias /php/ "c:/php/" -AddType application/x-httpd-php .php - -# For PHP 4 -Action application/x-httpd-php "/php/php.exe" - -# For PHP 7 -Action application/x-httpd-php "/php/php-cgi.exe" - - Warning - - By using the CGI setup, your server is open to several possible - attacks. Please read our CGI security section to learn how to defend - yourself from those attacks. - __________________________________________________________________ - -Installing as an Apache module - - You need to insert these two lines to your Apache httpd.conf - configuration file to set up the PHP module for Apache 2.0: - - Example 2-6. PHP and Apache 2.0 as Module - -# For PHP 7 do something like this: -LoadModule php7_module "c:/php/php7apache2.dll" -AddType application/x-httpd-php .php - -# configure the path to php.ini -PHPIniDir "C:/php" - - Note: Remember to substitute your actual path to PHP for the c:/php/ - in the above examples. Take care to use either - php5apache2.dll in your LoadModule directive and not php5apache.dll - as the latter ones are designed to run with Apache 1.3.x. - - Note: If you want to use content negotiation, read related FAQ. - - Warning - - Don't mix up your installation with DLL files from different PHP - versions. You have the only choice to use the DLL's and extensions that - ship with your downloaded PHP version. - __________________________________________________________________ - -Sun, iPlanet and Netscape servers on Microsoft Windows - - This section contains notes and hints specific to Sun Java System Web - Server, Sun ONE Web Server, iPlanet and Netscape server installs of PHP - on Windows. - - From PHP 4.3.3 on you can use PHP scripts with the NSAPI module to - generate custom directory listings and error pages. Additional - functions for Apache compatibility are also available. For support in - current web servers read the note about subrequests. - __________________________________________________________________ - -CGI setup on Sun, iPlanet and Netscape servers - - To install PHP as a CGI handler, do the following: - - * Copy php7ts.dll to your systemroot (the directory where you - installed Windows) - * Make a file association from the command line. Type the following - two lines: - -assoc .php=PHPScript -ftype PHPScript=c:\php\php.exe %1 %* - - * In the Netscape Enterprise Administration Server create a dummy - shellcgi directory and remove it just after (this step creates 5 - important lines in obj.conf and allow the web server to handle - shellcgi scripts). - * In the Netscape Enterprise Administration Server create a new mime - type (Category: type, Content-Type: magnus-internal/shellcgi, File - Suffix:php). - * Do it for each web server instance you want PHP to run - - More details about setting up PHP as a CGI executable can be found - here: http://benoit.noss.free.fr/php/install-php.html - __________________________________________________________________ - -NSAPI setup on Sun, iPlanet and Netscape servers - - To install PHP with NSAPI, do the following: - - * Copy php7ts.dll to your systemroot (the directory where you - installed Windows) - * Make a file association from the command line. Type the following - two lines: - -assoc .php=PHPScript -ftype PHPScript=c:\php\php.exe %1 %* - - * In the Netscape Enterprise Administration Server create a new mime - type (Category: type, Content-Type: magnus-internal/x-httpd-php, - File Suffix: php). - * Edit magnus.conf (for servers >= 6) or obj.conf (for servers < 6) - and add the following: You should place the lines after mime types - init. - -Init fn="load-modules" funcs="php7_init,php7_execute,php7_auth_trans" shlib="c:/ -php/sapi/php7nsapi.dll" -Init fn="php7_init" LateInit="yes" errorString="Failed to initialise PHP!" [php_ -ini="c:/path/to/php.ini"] - - The php_ini parameter is optional but with it you - can place your php.ini in your web server configuration directory. - * Configure the default object in obj.conf (for virtual server - classes [Sun Web Server 6.0+] in their vserver.obj.conf): In the - section, place this line necessarily after - all 'ObjectType' and before all 'AddLog' lines: - -Service fn="php7_execute" type="magnus-internal/x-httpd-php" [inikey=value inike -y=value ...] - - As additional parameters you can add some special - php.ini-values, for example you can set a - docroot="/path/to/docroot" specific to the context php7_execute is - called. For boolean ini-keys please use 0/1 as value, not - "On","Off",... (this will not work correctly), e.g. - zlib.output_compression=1 instead of zlib.output_compression="On" - * This is only needed if you want to configure a directory that only - consists of PHP scripts (same like a cgi-bin directory): - - -ObjectType fn="force-type" type="magnus-internal/x-httpd-php" -Service fn=php7_execute [inikey=value inikey=value ...] - - - After that you can configure a directory in the Administration - server and assign it the style x-httpd-php. All files in it will - get executed as PHP. This is nice to hide PHP usage by renaming - files to .html. - * Restart your web service and apply changes - * Do it for each web server instance you want PHP to run - - Note: More details about setting up PHP as an NSAPI filter can be - found here: http://benoit.noss.free.fr/php/install-php4.html - - Note: The stacksize that PHP uses depends on the configuration of - the web server. If you get crashes with very large PHP scripts, it - is recommended to raise it with the Admin Server (in the section - "MAGNUS EDITOR"). - __________________________________________________________________ - -CGI environment and recommended modifications in php.ini - - Important when writing PHP scripts is the fact that Sun JSWS/Sun ONE - WS/iPlanet/Netscape is a multithreaded web server. Because of that all - requests are running in the same process space (the space of the web - server itself) and this space has only one environment. If you want to - get CGI variables like PATH_INFO, HTTP_HOST etc. it is not the correct - way to try this in the old PHP 3.x way with getenv() or a similar way - (register globals to environment, $_ENV). You would only get the - environment of the running web server without any valid CGI variables! - - Note: Why are there (invalid) CGI variables in the environment? - - Answer: This is because you started the web server process from the - admin server which runs the startup script of the web server, you - wanted to start, as a CGI script (a CGI script inside of the admin - server!). This is why the environment of the started web server has - some CGI environment variables in it. You can test this by starting - the web server not from the administration server. Use the command - line as root user and start it manually - you will see there are no - CGI-like environment variables. - __________________________________________________________________ - -Special use for error pages or self-made directory listings (PHP >= 4.3.3) - - You can use PHP to generate the error pages for "404 Not Found" or - similar. Add the following line to the object in obj.conf for every - error page you want to overwrite: -Error fn="php7_execute" code=XXX script="/path/to/script.php" [inikey=value inik -ey=value...] - - where XXX is the HTTP error code. Please delete any other Error - directives which could interfere with yours. If you want to place a - page for all errors that could exist, leave the code parameter out. - Your script can get the HTTP status code with $_SERVER['ERROR_TYPE']. - - Another possibility is to generate self-made directory listings. Just - create a PHP script which displays a directory listing and replace the - corresponding default Service line for type="magnus-internal/directory" - in obj.conf with the following: -Service fn="php7_execute" type="magnus-internal/directory" script="/path/to/scri -pt.php" [inikey=value inikey=value...] - - For both error and directory listing pages the original URI and - translated URI are in the variables $_SERVER['PATH_INFO'] and - $_SERVER['PATH_TRANSLATED']. - __________________________________________________________________ - -Note about nsapi_virtual() and subrequests (PHP >= 4.3.3) - - The NSAPI module now supports the nsapi_virtual() function (alias: - virtual()) to make subrequests on the web server and insert the result - in the web page. The problem is, that this function uses some - undocumented features from the NSAPI library. - - Under Unix this is not a problem, because the module automatically - looks for the needed functions and uses them if available. If not, - nsapi_virtual() is disabled. - - Under Windows limitations in the DLL handling need the use of a - automatic detection of the most recent ns-httpdXX.dll file. This is - tested for servers till version 6.1. If a newer version of the Sun - server is used, the detection fails and nsapi_virtual() is disabled. - - If this is the case, try the following: Add the following parameter to - php7_init in magnus.conf/obj.conf: - Init fn=php7_init ... server_lib="ns-httpdXX.dll" - - where XX is the correct DLL version number. To get it, look in the - server-root for the correct DLL name. The DLL with the biggest filesize - is the right one. - - You can check the status by using the phpinfo() function. - - Note: But be warned: Support for nsapi_virtual() is EXPERIMENTAL!!! - __________________________________________________________________ - -OmniHTTPd Server - - This section contains notes and hints specific to OmniHTTPd on Windows. - - Note: You should read the manual installation steps first! - - Warning - - By using the CGI setup, your server is open to several possible - attacks. Please read our CGI security section to learn how to defend - yourself from those attacks. - - You need to complete the following steps to make PHP work with - OmniHTTPd. This is a CGI executable setup. SAPI is supported by - OmniHTTPd, but some tests have shown that it is not so stable to use - PHP as an ISAPI module. - - Important for CGI users: Read the faq on cgi.force_redirect for - important details. This directive needs to be set to 0. - - 1. Install OmniHTTPd server. - 2. Right click on the blue OmniHTTPd icon in the system tray and - select Properties - 3. Click on Web Server Global Settings - 4. On the 'External' tab, enter: virtual = .php | actual = - c:\php\php.exe (use php-cgi.exe if installing PHP 7), and use the - Add button. - 5. On the Mime tab, enter: virtual = wwwserver/stdcgi | actual = .php, - and use the Add button. - 6. Click OK - - Repeat steps 2 - 6 for each extension you want to associate with PHP. - - __________________________________________________________________ - -Xitami on Microsoft Windows - - This section contains notes and hints specific to Xitami on Windows. - - Note: You should read the manual installation steps first! - - This list describes how to set up the PHP CGI binary to work with - Xitami on Windows. - - Important for CGI users: Read the faq on cgi.force_redirect for - important details. This directive needs to be set to 0. If you want - to use $_SERVER['PHP_SELF'] you have to enable the cgi.fix_pathinfo - directive. - - Warning - - By using the CGI setup, your server is open to several possible - attacks. Please read our CGI security section to learn how to defend - yourself from those attacks. - - * Make sure the web server is running, and point your browser to - xitamis admin console (usually http://127.0.0.1/admin), and click - on Configuration. - * Navigate to the Filters, and put the extension which PHP should - parse (i.e. .php) into the field File extensions (.xxx). - * In Filter command or script put the path and name of your PHP CGI - executable i.e. C:\php\php-cgi.exe. - * Press the 'Save' icon. - * Restart the server to reflect changes. - __________________________________________________________________ - -Installation of extensions on Windows - - After installing PHP and a web server on Windows, you will probably - want to install some extensions for added functionality. You can choose - which extensions you would like to load when PHP starts by modifying - your php.ini. You can also load a module dynamically in your script - using dl(). - - The DLLs for PHP extensions are prefixed with php_. - - Many extensions are built into the Windows version of PHP. This means - additional DLL files, and the extension directive, are not used to load - these extensions. The Windows PHP Extensions table lists extensions - that require, or used to require, additional PHP DLL files. Here's a - list of built in extensions: - - In PHP 7 (updated PHP 5.0.4), the following changes exist. Built in: - DOM, LibXML, Iconv, SimpleXML, SPL and SQLite. And the following are no - longer built in: MySQL and Overload. - - The default location PHP searches for extensions is C:\php7 in PHP 7. - To change this setting to reflect your setup of PHP edit your php.ini - file: - - * You will need to change the extension_dir setting to point to the - directory where your extensions lives, or where you have placed - your php_*.dll files. For example: - -extension_dir = C:\php\extensions - - * Enable the extension(s) in php.ini you want to use by uncommenting - the extension=php_*.dll lines in php.ini. This is done by deleting - the leading ; from the extension you want to load. - - Example 2-8. Enable Bzip2 extension for PHP-Windows -// change the following line from ... -;extension=php_bz2.dll - -// ... to -extension=php_bz2.dll - - * Some of the extensions need extra DLLs to work. Couple of them can - be found in the distribution package, in in the main folder in PHP 5, - but some, for example Oracle (php_oci8.dll) require DLLs which are - not bundled with the distribution package. - * Some of these DLLs are not bundled with the PHP distribution. See - each extensions documentation page for details. Also, read the - manual section titled Installation of PECL extensions for details - on PECL. An increasingly large number of PHP extensions are found - in PECL, and these extensions require a separate download. - - Note: If you are running a server module version of PHP remember to - restart your web server to reflect your changes to php.ini. - - The following table describes some of the extensions available and - required additional dlls. - - Table 2-1. PHP Extensions - Extension Description Notes - php_bz2.dll bzip2 compression functions None - php_calendar.dll Calendar conversion functions - php_cpdf.dll ClibPDF functions None - php_crack.dll Crack functions None - php_ctype.dll ctype family functions - php_curl.dll CURL, Client URL library functions Requires: libeay32.dll, - ssleay32.dll (bundled) - php_db.dll DBM functions Deprecated. Use DBA instead (php_dba.dll) - php_dba.dll DBA: DataBase (dbm-style) Abstraction layer functions None - php_dbase.dll dBase functions None - php_dbx.dll dbx functions - php_exif.dll EXIF functions php_mbstring.dll. And, php_exif.dll must be - loaded after php_mbstring.dll in php.ini. - php_fdf.dll FDF: Forms Data Format functions. Requires: fdftk.dll - (bundled) - php_filepro.dll filePro functions Read-only access - php_ftp.dll FTP functions - php_gd2.dll GD library image functions GD2 - php_gettext.dll Gettext functions, requires libintl-1.dll, - iconv.dll (bundled). - php_iconv.dll ICONV characterset conversion Requires: iconv.dll - php_imap.dll IMAP POP3 and NNTP functions None - php_interbase.dll InterBase functions Requires: gds32.dll (bundled) - php_ldap.dll LDAP functions requires libeay32.dll, ssleay32.dll (bundled) - php_mbstring.dll Multi-Byte String functions None - php_mime_magic.dll Mimetype functions Requires: magic.mime (bundled) - php_ming.dll Ming functions for Flash None - php_msql.dll mSQL functions Requires: msql.dll (bundled) - php_mssql.dll MSSQL functions Requires: ntwdblib.dll (bundled) - php_mysql.dll MySQL functions PHP >= 5.0.0, requires libmysql.dll - (bundled) - php_mysqli.dll MySQLi functions PHP >= 5.0.0, requires libmysql.dll - (libmysqli.dll in PHP <= 5.0.2) (bundled) - php_oci8.dll Oracle 8 functions Requires: Oracle 8.1+ client libraries - php_openssl.dll OpenSSL functions Requires: libeay32.dll (bundled) - php_oracle.dll Oracle functions Requires: Oracle 7 client libraries - php_pgsql.dll PostgreSQL functions None - php_printer.dll Printer functions None - php_shmop.dll Shared Memory functions None - php_snmp.dll SNMP get and walk functions NT only! - php_soap.dll SOAP functions PHP >= 5.0.0 - php_sockets.dll Socket functions None - php_sodium.dll Sodium cryptography library PHP >= 7.2.0 - php_sybase_ct.dll Sybase functions Requires: Sybase client libraries - php_tidy.dll Tidy functions PHP >= 5.0.0 - php_tokenizer.dll Tokenizer functions Built in since PHP 4.3.0 - php_xmlrpc.dll XML-RPC functions PHP >= 4.2.1 requires: iconv.dll - (bundled) - php_xslt.dll XSLT requires libxslt.dll, iconv.dll (bundled). - php_zip.dll Zip File functions - php_zlib.dll ZLib compression functions - __________________________________________________________________ - -Chapter 3. Installation of PECL extensions - -Introduction to PECL Installations - - PECL is a repository of PHP extensions that are made available to you - via the PEAR packaging system. This section of the manual is intended - to demonstrate how to obtain and install PECL extensions. - - These instructions assume /your/phpsrcdir/ is the path to the PHP - source distribution, and that extname is the name of the PECL - extension. Adjust accordingly. These instructions also assume a - familiarity with the pear command. The information in the PEAR manual - for the pear command also applies to the pecl command. - - To be useful, a shared extension must be built, installed, and loaded. - The methods described below provide you with various instructions on - how to build and install the extensions, but they do not automatically - load them. Extensions can be loaded by adding an extension directive. - To this php.ini file, or through the use of the dl() function. - - When building PHP modules, it's important to have known-good versions - of the required tools (autoconf, automake, libtool, etc.) See the - SVN Instructions for details on the required tools, and required - versions. - __________________________________________________________________ - -Downloading PECL extensions - - There are several options for downloading PECL extensions, such as: - - * http://pecl.php.net - The PECL web site contains information about the different - extensions that are offered by the PHP Development Team. The - information available here includes: ChangeLog, release notes, - requirements and other similar details. - * pecl download extname - PECL extensions that have releases listed on the PECL web site are - available for download and installation using the pecl command. - Specific revisions may also be specified. - * SVN - Most PECL extensions also reside in SVN. A web-based view may be - seen at http://svn.php.net/pecl/. To download straight from SVN, - the following sequence of commands may be used. - -$ svn co http://svn.php.net/repository/pecl//trunk - - * Windows downloads - Windows users may find compiled PECL binaries by downloading the - Collection of PECL modules from the PHP Downloads page, or by - retrieving a PECL Snapshot or an extension DLL on PECL4WIN. To - compile PHP under Windows, read the appropriate chapter. - __________________________________________________________________ - -PECL for Windows users - - As with any other PHP extension DLL, installation is as simple as - copying the PECL extension DLLs into the extension_dir folder and - loading them from php.ini. For example, add the following line to your - php.ini: - - extension=php_extname.dll - - After doing this, restart the web server. - __________________________________________________________________ - -Compiling shared PECL extensions with the pecl command - - PECL makes it easy to create shared PHP extensions. Using the pecl - command, do the following: - - $ pecl install extname - - This will download the source for extname, compile, and install - extname.so into your extension_dir. extname.so may then be loaded via - php.ini - - By default, the pecl command will not install packages that are marked - with the alpha or beta state. If no stable packages are available, you - may install a beta package using the following command: - - $ pecl install extname-beta - - You may also install a specific version using this variant: - - $ pecl install extname-0.1 - __________________________________________________________________ - -Compiling shared PECL extensions with phpize - - Sometimes, using the pecl installer is not an option. This could be - because you're behind a firewall, or it could be because the extension - you want to install is not available as a PECL compatible package, such - as unreleased extensions from SVN. If you need to build such an - extension, you can use the lower-level build tools to perform the build - manually. - - The phpize command is used to prepare the build environment for a PHP - extension. In the following sample, the sources for an extension are in - a directory named extname: - -$ cd extname -$ phpize -$ ./configure -$ make -# make install - - A successful install will have created extname.so and put it into the - PHP extensions directory. You'll need to and adjust php.ini and add an - extension=extname.so line before you can use the extension. - - If the system is missing the phpize command, and precompiled packages - (like RPM's) are used, be sure to also install the appropriate devel - version of the PHP package as they often include the phpize command - along with the appropriate header files to build PHP and its - extensions. - - Execute phpize --help to display additional usage information. - __________________________________________________________________ - -Compiling PECL extensions statically into PHP - - You might find that you need to build a PECL extension statically into - your PHP binary. To do this, you'll need to place the extension source - under the php-src/ext/ directory and tell the PHP build system to - regenerate its configure script. - -$ cd /your/phpsrcdir/ext -$ pecl download extname -$ gzip -d < extname.tgz | tar -xvf - -$ mv extname-x.x.x extname - - This will result in the following directory: - - /your/phpsrcdir/ext/extname - - From here, force PHP to rebuild the configure script, and then build - PHP as normal: - -$ cd /your/phpsrcdir -$ rm configure -$ ./buildconf --force -$ ./configure --help -$ ./configure --with-extname --enable-someotherext --with-foobar -$ make -$ make install - - Note: To run the 'buildconf' script you need autoconf 2.13 and - automake 1.4+ (newer versions of autoconf may work, but are not - supported). - - Whether --enable-extname or --with-extname is used depends on the - extension. Typically an extension that does not require external - libraries uses --enable. To be sure, run the following after buildconf: - - $ ./configure --help | grep extname - __________________________________________________________________ - -Chapter 4. Problems? - -Read the FAQ - - Some problems are more common than others. The most common ones are - listed in the PHP FAQ, part of this manual. - __________________________________________________________________ - -Other problems - - If you are still stuck, someone on the PHP installation mailing list - may be able to help you. You should check out the archive first, in - case someone already answered someone else who had the same problem as - you. The archives are available from the support page on - http://www.php.net/support.php. To subscribe to the PHP installation - mailing list, send an empty mail to - php-install-subscribe@lists.php.net. The mailing list address is - php-install@lists.php.net. - - If you want to get help on the mailing list, please try to be precise - and give the necessary details about your environment (which operating - system, what PHP version, what web server, if you are running PHP as - CGI or a server module, safe mode, etc...), and preferably enough code - to make others able to reproduce and test your problem. - __________________________________________________________________ - -Bug reports - - If you think you have found a bug in PHP, please report it. The PHP - developers probably don't know about it, and unless you report it, - chances are it won't be fixed. You can report bugs using the - bug-tracking system at http://bugs.php.net/. Please do not send bug - reports in mailing list or personal letters. The bug system is also - suitable to submit feature requests. - - Read the How to report a bug document before submitting any bug - reports! - __________________________________________________________________ - -Chapter 5. Runtime Configuration - -The configuration file - - The configuration file (called php3.ini in PHP 3, and simply php.ini as - of PHP 4) is read when PHP starts up. For the server module versions of - PHP, this happens only once when the web server is started. For the CGI - and CLI version, it happens on every invocation. - - php.ini is searched in these locations (in order): - - * SAPI module specific location (PHPIniDir directive in Apache 2, -c - command line option in CGI and CLI, php_ini parameter in NSAPI, - PHP_INI_PATH environment variable in THTTPD) - * The PHPRC environment variable. Before PHP 5.2.0 this was checked - after the registry key mentioned below. - * As of PHP 5.2.0, the following registry locations are searched in - order: HKEY_LOCAL_MACHINE\SOFTWARE\PHP\x.y.z\IniFilePath, - HKEY_LOCAL_MACHINE\SOFTWARE\PHP\x.y\IniFilePath and - HKEY_LOCAL_MACHINE\SOFTWARE\PHP\x\IniFilePath, where x, y and z - mean the PHP major, minor and release versions. - * HKEY_LOCAL_MACHINE\SOFTWARE\PHP\IniFilePath (Windows Registry - location) - * Current working directory (except CLI) - * The web server's directory (for SAPI modules), or directory of PHP - (otherwise in Windows) - * Windows directory (C:\windows or C:\winnt) (for Windows), or - --with-config-file-path compile time option - - If php-SAPI.ini exists (where SAPI is used SAPI, so the filename is - e.g. php-cli.ini or php-apache.ini), it's used instead of php.ini. SAPI - name can be determined by php_sapi_name(). - - Note: The Apache web server changes the directory to root at startup - causing PHP to attempt to read php.ini from the root filesystem if - it exists. - - The php.ini directives handled by extensions are documented - respectively on the pages of the extensions themselves. The list of the - core directives is available in the appendix. Probably not all PHP - directives are documented in the manual though. For a complete list of - directives available in your PHP version, please read your well - commented php.ini file. Alternatively, you may find the latest - php.ini from SVN helpful too. - - Example 5-1. php.ini example -; any text on a line after an unquoted semicolon (;) is ignored -[php] ; section markers (text within square brackets) are also ignored -; Boolean values can be set to either: -; true, on, yes -; or false, off, no, none -html_errors = off -track_errors = yes - -; you can enclose strings in double-quotes -include_path = ".:/usr/local/lib/php" - -; backslashes are treated the same as any other character -include_path = ".;c:\php\lib" - - Since PHP 5.1.0, it is possible to refer to existing .ini variables - from within .ini files. Example: open_basedir = ${open_basedir} - ":/new/dir". - __________________________________________________________________ - -How to change configuration settings - -Running PHP as an Apache module - - When using PHP as an Apache module, you can also change the - configuration settings using directives in Apache configuration files - (e.g. httpd.conf) and .htaccess files. You will need "AllowOverride - Options" or "AllowOverride All" privileges to do so. - - With PHP 4 and PHP 7, there are several Apache directives that allow - you to change the PHP configuration from within the Apache - configuration files. For a listing of which directives are PHP_INI_ALL, - PHP_INI_PERDIR, or PHP_INI_SYSTEM, have a look at the List of php.ini - directives appendix. - - Note: With PHP 3, there are Apache directives that correspond to - each configuration setting in the php3.ini name, except the name is - prefixed by "php3_". - - php_value name value - Sets the value of the specified directive. Can be used only with - PHP_INI_ALL and PHP_INI_PERDIR type directives. To clear a - previously set value use none as the value. - - Note: Don't use php_value to set boolean values. php_flag (see - below) should be used instead. - - php_flag name on|off - Used to set a boolean configuration directive. Can be used only - with PHP_INI_ALL and PHP_INI_PERDIR type directives. - - php_admin_value name value - Sets the value of the specified directive. This can not be used - in .htaccess files. Any directive type set with php_admin_value - can not be overridden by .htaccess or virtualhost directives. To - clear a previously set value use none as the value. - - php_admin_flag name on|off - Used to set a boolean configuration directive. This can not be - used in .htaccess files. Any directive type set with - php_admin_flag can not be overridden by .htaccess or virtualhost - directives. - - Example 5-2. Apache configuration example - - php_value include_path ".:/usr/local/lib/php" - php_admin_flag engine on - - - Caution - - PHP constants do not exist outside of PHP. For example, in httpd.conf - you can not use PHP constants such as E_ALL or E_NOTICE to set the - error_reporting directive as they will have no meaning and will - evaluate to 0. Use the associated bitmask values instead. These - constants can be used in php.ini - __________________________________________________________________ - -Changing PHP configuration via the Windows registry - - When running PHP on Windows, the configuration values can be modified - on a per-directory basis using the Windows registry. The configuration - values are stored in the registry key HKLM\SOFTWARE\PHP\Per Directory - Values, in the sub-keys corresponding to the path names. For example, - configuration values for the directory c:\inetpub\wwwroot would be - stored in the key HKLM\SOFTWARE\PHP\Per Directory - Values\c\inetpub\wwwroot. The settings for the directory would be - active for any script running from this directory or any subdirectory - of it. The values under the key should have the name of the PHP - configuration directive and the string value. PHP constants in the - values are not parsed. However, only configuration values changeable in - PHP_INI_USER can be set this way, PHP_INI_PERDIR values can not. - __________________________________________________________________ - -Other interfaces to PHP - - Regardless of how you run PHP, you can change certain values at runtime - of your scripts through ini_set(). See the documentation on the - ini_set() page for more information. - - If you are interested in a complete list of configuration settings on - your system with their current values, you can execute the phpinfo() - function, and review the resulting page. You can also access the values - of individual configuration directives at runtime using ini_get() or - get_cfg_var(). - __________________________________________________________________ - -Chapter 6. Installation FAQ - - This section holds common questions about the way to install PHP. PHP - is available for almost any OS (except maybe for MacOS before OSX), and - almost any web server. - - To install PHP, follow the instructions in Installing PHP. - - 1. Why shouldn't I use Apache2 with a threaded MPM in a production - environment? - - 2. Unix/Windows: Where should my php.ini file be located? - 3. Unix: I installed PHP, but every time I load a document, I get the - message 'Document Contains No Data'! What's going on here? - - 4. Unix: I installed PHP using RPMS, but Apache isn't processing the - PHP pages! What's going on here? - - 5. Unix: I installed PHP 3 using RPMS, but it doesn't compile with the - database support I need! What's going on here? - - 6. Unix: I patched Apache with the FrontPage extensions patch, and - suddenly PHP stopped working. Is PHP incompatible with the - Apache FrontPage extensions? - - 7. Unix/Windows: I have installed PHP, but when I try to access a PHP - script file via my browser, I get a blank screen. - - 8. Unix/Windows: I have installed PHP, but when try to access a PHP - script file via my browser, I get a server 500 error. - - 9. Some operating systems: I have installed PHP without errors, but - when I try to start apache I get undefined symbol errors: - -[mybox:user /src/php7] root# apachectl configtest - apachectl: /usr/local/apache/bin/httpd Undefined symbols: - _compress - _uncompress - - 10. Windows: I have installed PHP, but when I to access a PHP script - file via my browser, I get the error: - -cgi error: - The specified CGI application misbehaved by not - returning a complete set of HTTP headers. - The headers it did return are: - - 11. Windows: I've followed all the instructions, but still can't get - PHP and IIS to work together! - - 12. When running PHP as CGI with IIS, OmniHTTPD or Xitami, I get - the following error: Security Alert! PHP CGI cannot be accessed - directly.. - - 13. How do I know if my php.ini is being found and read? It seems like - it isn't as my changes aren't being implemented. - - 14. How do I add my PHP directory to the PATH on Windows? - 15. How do I make the php.ini file available to PHP on windows? - 16. Is it possible to use Apache content negotiation (MultiViews - option) with PHP? - - 17. Is PHP limited to process GET and POST request methods only? - - 1. Why shouldn't I use Apache2 with a threaded MPM in a production - environment? - - PHP is glue. It is the glue used to build cool web applications by - sticking dozens of 3rd-party libraries together and making it all - appear as one coherent entity through an intuitive and easy to learn - language interface. The flexibility and power of PHP relies on the - stability and robustness of the underlying platform. It needs a working - OS, a working web server and working 3rd-party libraries to glue - together. When any of these stop working PHP needs ways to identify the - problems and fix them quickly. When you make the underlying framework - more complex by not having completely separate execution threads, - completely separate memory segments and a strong sandbox for each - request to play in, feet of clay are introduced into PHP's system. - - If you feel you have to use a threaded MPM, look at a FastCGI - configuration where PHP is running in its own memory space. - - And finally, this warning against using a threaded MPM is not as strong - for Windows systems because most libraries on that platform tend to be - threadsafe. - - 2. Unix/Windows: Where should my php.ini file be located? - - By default on Unix it should be in /usr/local/lib which is - /lib. Most people will want to change this at - compile-time with the --with-config-file-path flag. You would, for - example, set it with something like: - --with-config-file-path=/etc - - And then you would copy php.ini-production from the distribution to - /etc/php.ini and edit it to make any local changes you want. - --with-config-file-scan-dir=PATH - - On Windows the default path for the php.ini file is the Windows - directory. If you're using the Apache webserver, php.ini is first - searched in the Apaches install directory, e.g. c:\program files\apache - group\apache. This way you can have different php.ini files for - different versions of Apache on the same machine. - - See also the chapter about the configuration file. - - 3. Unix: I installed PHP, but every time I load a document, I get the - message 'Document Contains No Data'! What's going on here? - - This probably means that PHP is having some sort of problem and is - core-dumping. Look in your server error log to see if this is the case, - and then try to reproduce the problem with a small test case. If you - know how to use 'gdb', it is very helpful when you can provide a - backtrace with your bug report to help the developers pinpoint the - problem. If you are using PHP as an Apache module try something like: - - * Stop your httpd processes - * gdb httpd - * Stop your httpd processes - * > run -X -f /path/to/httpd.conf - * Then fetch the URL causing the problem with your browser - * > run -X -f /path/to/httpd.conf - * If you are getting a core dump, gdb should inform you of this now - * type: bt - * You should include your backtrace in your bug report. This should - be submitted to http://bugs.php.net/ - - If your script uses the regular expression functions (ereg() and - friends), you should make sure that you compiled PHP and Apache with - the same regular expression package. This should happen automatically - with PHP and Apache 1.3.x - - 4. Unix: I installed PHP using RPMS, but Apache isn't processing the - PHP pages! What's going on here? - - Assuming you installed both Apache and PHP from RPM packages, you need - to uncomment or add some or all of the following lines in your - httpd.conf file: -# Extra Modules -AddModule mod_php.c -AddModule mod_php3.c -AddModule mod_perl.c - -# Extra Modules -LoadModule php_module modules/mod_php.so -LoadModule perl_module modules/libperl.so - - And add: -AddType application/x-httpd-php3 .php3 # for PHP 3 -AddType application/x-httpd-php .php # for PHP 4 - - ... to the global properties, or to the properties of the VirtualDomain - you want to have PHP support added to. - - 5. Unix: I installed PHP 3 using RPMS, but it doesn't compile with the - database support I need! What's going on here? - - Due to the way PHP 3 built, it is not easy to build a complete flexible - PHP RPM. This issue is addressed in PHP 4. For PHP 3, we currently - suggest you use the mechanism described in the INSTALL.REDHAT file in - the PHP distribution. If you insist on using an RPM version of PHP 3, - read on... - - The RPM packagers are setting up the RPMS to install without database - support to simplify installations and because RPMS use /usr/ instead of - the standard /usr/local/ directory for files. You need to tell the RPM - spec file which databases to support and the location of the top-level - of your database server. - - This example will explain the process of adding support for the popular - MySQL database server, using the mod installation for Apache. - - Of course all of this information can be adjusted for any database - server that PHP supports. We will assume you installed MySQL and Apache - completely with RPMS for this example as well. - - * First remove mod_php3 : - -rpm -e mod_php3 - - * Then get the source rpm and INSTALL it, NOT --rebuild - -rpm -Uvh mod_php3-3.0.5-2.src.rpm - - * Then edit the /usr/src/redhat/SPECS/mod_php3.spec file - In the %build section add the database support you want, and the - path. - For MySQL you would add --with-mysql=/usr The %build section will - look something like this: - -./configure --prefix=/usr \ ---with-apxs=/usr/sbin/apxs \ ---with-config-file-path=/usr/lib \ ---enable-debug=no \ ---enable-safe-mode \ ---with-exec-dir=/usr/bin \ ---with-mysql=/usr \ ---with-system-regex - - * Once this modification is made then build the binary rpm as - follows: - -rpm -bb /usr/src/redhat/SPECS/mod_php3.spec - - * Then install the rpm - -rpm -ivh /usr/src/redhat/RPMS/i386/mod_php3-3.0.5-2.i386.rpm - - Make sure you restart Apache, and you now have PHP 3 with MySQL support - using RPM's. Note that it is probably much easier to just build from - the distribution tarball of PHP 3 and follow the instructions in - INSTALL.REDHAT found in that distribution. - - 6. Unix: I patched Apache with the FrontPage extensions patch, and - suddenly PHP stopped working. Is PHP incompatible with the Apache - FrontPage extensions? - - No, PHP works fine with the FrontPage extensions. The problem is that - the FrontPage patch modifies several Apache structures, that PHP relies - on. Recompiling PHP (using 'make clean ; make') after the FP patch is - applied would solve the problem. - - 7. Unix/Windows: I have installed PHP, but when I try to access a PHP - script file via my browser, I get a blank screen. - - Do a 'view source' in the web browser and you will probably find that - you can see the source code of your PHP script. This means that the web - server did not send the script to PHP for interpretation. Something is - wrong with the server configuration - double check the server - configuration against the PHP installation instructions. - - 8. Unix/Windows: I have installed PHP, but when try to access a PHP - script file via my browser, I get a server 500 error. - - Something went wrong when the server tried to run PHP. To get to see a - sensible error message, from the command line, change to the directory - containing the PHP executable (php.exe on Windows) and run php -i. If - PHP has any problems running, then a suitable error message will be - displayed which will give you a clue as to what needs to be done next. - If you get a screen full of HTML codes (the output of the phpinfo() - function) then PHP is working, and your problem may be related to your - server configuration which you should double check. - - 9. Some operating systems: I have installed PHP without errors, but - when I try to start apache I get undefined symbol errors: -[mybox:user /src/php7] root# apachectl configtest - apachectl: /usr/local/apache/bin/httpd Undefined symbols: - _compress - _uncompress - - This has actually nothing to do with PHP, but with the MySQL client - libraries. Some need --with-zlib, others do not. This is also covered - in the MySQL FAQ. - - 10. Windows: I have installed PHP, but when I to access a PHP script - file via my browser, I get the error: -cgi error: - The specified CGI application misbehaved by not - returning a complete set of HTTP headers. - The headers it did return are: - - This error message means that PHP failed to output anything at all. To - get to see a sensible error message, from the command line, change to - the directory containing the PHP executable (php.exe on Windows) and - run php -i. If PHP has any problems running, then a suitable error - message will be displayed which will give you a clue as to what needs - to be done next. If you get a screen full of HTML codes (the output of - the phpinfo() function) then PHP is working. - - Once PHP is working at the command line, try accessing the script via - the browser again. If it still fails then it could be one of the - following: - - * File permissions on your PHP script, php.exe, php7ts.dll, php.ini - or any PHP extensions you are trying to load are such that the - anonymous internet user ISUR_ cannot access them. - * The script file does not exist (or possibly isn't where you think - it is relative to your web root directory). Note that for IIS you - can trap this error by ticking the 'check file exists' box when - setting up the script mappings in the Internet Services Manager. If - a script file does not exist then the server will return a 404 - error instead. There is also the additional benefit that IIS will - do any authentication required for you based on the NTLanMan - permissions on your script file. - - 11. Windows: I've followed all the instructions, but still can't get - PHP and IIS to work together! - - Make sure any user who needs to run a PHP script has the rights to run - php.exe! IIS uses an anonymous user which is added at the time IIS is - installed. This user needs rights to php.exe. Also, any authenticated - user will also need rights to execute php.exe. And for IIS4 you need to - tell it that PHP is a script engine. Also, you will want to read this - faq. - - 12. When running PHP as CGI with IIS, OmniHTTPD or Xitami, I get - the following error: Security Alert! PHP CGI cannot be accessed - directly.. - - You must set the cgi.force_redirect directive to 0. It defaults to 1 so - be sure the directive isn't commented out (with a ;). Like all - directives, this is set in php.ini - - Because the default is 1, it's critical that you're 100% sure that the - correct php.ini file is being read. Read this faq for details. - - 13. How do I know if my php.ini is being found and read? It seems like - it isn't as my changes aren't being implemented. - - To be sure your php.ini is being read by PHP, make a call to phpinfo() - and near the top will be a listing called Configuration File (php.ini). - This will tell you where PHP is looking for php.ini and whether or not - it's being read. If just a directory PATH exists than it's not being - read and you should put your php.ini in that directory. If php.ini is - included within the PATH than it is being read. - - If php.ini is being read and you're running PHP as a module, then be - sure to restart your web server after making changes to php.ini - - 14. How do I add my PHP directory to the PATH on Windows? - - On Windows NT, 2000, XP and 2003: - - * Go to Control Panel and open the System icon (Start -> Settings -> - Control Panel -> System, or just Start -> Control Panel -> System - for Windows XP/2003) - * Go to the Advanced tab - * Click on the 'Environment Variables' button - * Look into the 'System Variables' pane - * Find the Path entry (you may need to scroll to find it) - * Double click on the Path entry - * Enter your PHP directory at the end, including ';' before (e.g. - ;C:\php) - * Press OK and restart your computer - - On Windows 98/Me you need to edit the autoexec.bat file: - - * Open the Notepad (Start -> Run and enter notepad) - * Open the C:\autoexec.bat file - * Locate the line with PATH=C:\WINDOWS;C:\WINDOWS\COMMAND;..... and - add: ;C:\php to the end of the line - * Save the file and restart your computer - - Note: Be sure to reboot after following the steps above to ensure - that the PATH changes are applied. - - The PHP manual used to promote the copying of files into the Windows - system directory, this is because this directory (C:\Windows, C:\WINNT, - etc.) is by default in the systems PATH. Copying files into the Windows - system directory has long since been deprecated and may cause problems. - - 15. How do I make the php.ini file available to PHP on windows? - - There are several ways of doing this. If you are using Apache, read - their installation specific instructions (Apache 1, Apache 2), - otherwise you must set the PHPRC environment variable: - - On Windows NT, 2000, XP and 2003: - - * Go to Control Panel and open the System icon (Start -> Settings -> - Control Panel -> System, or just Start -> Control Panel -> System - for Windows XP/2003) - * Go to the Advanced tab - * Click on the 'Environment Variables' button - * Look into the 'System variables' pane - * Click on 'New' and enter 'PHPRC' as the variable name and the - directory where php.ini is located as the variable value (e.g. - C:\php) - * Press OK and restart your computer - - On Windows 98/Me you need to edit the autoexec.bat file: - - * Open the Notepad (Start -> Run and enter notepad) - * Open the C:\autoexec.bat file - * Add a new line to the end of the file: set PHPRC=C:\php (replace - C:\php with the directory where php.ini is located). Please note - that the path cannot contain spaces. For instance, if you have - installed PHP in C:\Program Files\PHP, you would enter - C:\PROGRA~1\PHP instead. - * Save the file and restart your computer - - 16. Is it possible to use Apache content negotiation (MultiViews - option) with PHP? - - If links to PHP files include extension, everything works perfect. This - FAQ is only for the case when links to PHP files don't include - extension and you want to use content negotiation to choose PHP files - from URL with no extension. In this case, replace the line AddType - application/x-httpd-php .php with: -# PHP 4 -AddHandler php-script php -AddType text/html php - -# PHP 7 -AddHandler php7-script php -AddType text/html php - - This solution doesn't work for Apache 1 as PHP module doesn't catch - php-script. - - 17. Is PHP limited to process GET and POST request methods only? - - No, it is possible to handle any request method, e.g. CONNECT. Proper - response status can be sent with header(). If only GET and POST methods - should be handled, it can be achieved with this Apache configuration: - -Deny from all - diff --git a/win32/ioutil.c b/win32/ioutil.c index aa56b94ee7b5c..65518e1aa5ede 100644 --- a/win32/ioutil.c +++ b/win32/ioutil.c @@ -560,6 +560,8 @@ BOOL php_win32_ioutil_init(void) if (!canonicalize_path_w) { canonicalize_path_w = (MyPathCchCanonicalizeEx)MyPathCchCanonicalizeExFallback; } + + FreeLibrary(hMod); } else { canonicalize_path_w = (MyPathCchCanonicalizeEx)MyPathCchCanonicalizeExFallback; } diff --git a/win32/select.c b/win32/select.c index bdc53e8181b3b..33e5fb2aa2907 100644 --- a/win32/select.c +++ b/win32/select.c @@ -66,7 +66,7 @@ PHPAPI int php_select(php_socket_t max_fd, fd_set *rfds, fd_set *wfds, fd_set *e FD_ZERO(&sock_except); /* build an array of handles for non-sockets */ - for (i = 0; i < max_fd; i++) { + for (i = 0; (uint32_t)i < max_fd; i++) { if (SAFE_FD_ISSET(i, rfds) || SAFE_FD_ISSET(i, wfds) || SAFE_FD_ISSET(i, efds)) { handles[n_handles] = (HANDLE)(zend_uintptr_t)_get_osfhandle(i); if (handles[n_handles] == INVALID_HANDLE_VALUE) { diff --git a/win32/syslog.h b/win32/syslog.h index 104c4b75ff3cf..3220ed66b66d2 100644 --- a/win32/syslog.h +++ b/win32/syslog.h @@ -73,6 +73,7 @@ extern void closelog(void); extern void openlog(const char *, int, int); extern void syslog(int, const char *, ...); +extern void vsyslog(int, const char *, va_list ap); #endif /* SYSLOG_H */ diff --git a/win32/wsyslog.c b/win32/wsyslog.c index 6b0f03e8eab05..e13ef05d87814 100644 --- a/win32/wsyslog.c +++ b/win32/wsyslog.c @@ -58,6 +58,7 @@ #include "php_win32_globals.h" #include "wsyslog.h" +#include "codepage.h" void closelog(void) { @@ -80,10 +81,19 @@ void closelog(void) void syslog(int priority, const char *message, ...) { va_list args; + + va_start(args, message); /* initialize vararg mechanism */ + vsyslog(priority, message, args); + va_end(args); +} + +void vsyslog(int priority, const char *message, va_list args) +{ LPTSTR strs[2]; unsigned short etype; char *tmp = NULL; DWORD evid; + wchar_t *strsw[2]; /* default event source */ if (INVALID_HANDLE_VALUE == PW32G(log_source)) @@ -102,13 +112,28 @@ void syslog(int priority, const char *message, ...) etype = EVENTLOG_WARNING_TYPE; evid = PHP_SYSLOG_WARNING_TYPE; } - va_start(args, message); /* initialize vararg mechanism */ + vspprintf(&tmp, 0, message, args); /* build message */ + + strsw[0] = php_win32_cp_any_to_w(PW32G(log_header)); + strsw[1] = php_win32_cp_any_to_w(tmp); + + /* report the event */ + if (strsw[0] && strsw[1]) { + ReportEventW(PW32G(log_source), etype, (unsigned short) priority, evid, NULL, 2, 0, strsw, NULL); + free(strsw[0]); + free(strsw[1]); + efree(tmp); + return; + } + + free(strsw[0]); + free(strsw[1]); + strs[0] = PW32G(log_header); /* write header */ strs[1] = tmp; /* then the message */ - /* report the event */ - ReportEvent(PW32G(log_source), etype, (unsigned short) priority, evid, NULL, 2, 0, strs, NULL); - va_end(args); + + ReportEventA(PW32G(log_source), etype, (unsigned short) priority, evid, NULL, 2, 0, strs, NULL); efree(tmp); } @@ -127,7 +152,6 @@ void openlog(const char *ident, int logopt, int facility) PW32G(log_source) = RegisterEventSource(NULL, "PHP-" PHP_VERSION); spprintf(&PW32G(log_header), 0, (logopt & LOG_PID) ? "%s[%d]" : "%s", ident, getpid()); } - /* * Local variables: * tab-width: 4