Build your Exception Rules System

Build your Exception Rules System – or how to fix invalid values

Who need to fix error ?

Since version 1.9.0, PHP_CompatInfo (aka PCI) used a full data dictionary system based on source files (set of versions.xml) used by the PHP Manual generation itself.

Of course, if extensions files reference (of phpdoc) changed, you have to wait a new release of PCI to see bugs/changes fixed.

If you can't wait a new PCI release, or because reference (phpdoc) files are fake and not yet fixed, there is an alternative solution named Exception Rules System (aka ERS).

Procedure to build your ERS for PHP4 users

This procedure is not secure, because you can lose your changes if you install a new PCI release that did not included your fixes.

End-users have to fix the wrong values in data dictionaries themself (by hand).

Procedure to build your ERS for PHP5 users

This procedure is pretty secure, and minimize risk to lose informations.

Version 1.9.0 of PCI used itself the ERS to fix data still missing in phpdoc reference.

Reason: Migration from monolithic http://cvs.php.net/viewvc.cgi/phpdoc/phpbook/phpbook-xsl/version.xml to specific extension file http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/*/version.xml is not yet over !

pciconf CLI script build data dictionary from source below :

  1. the phpdoc reference mirror files installed in PCI data directory @data_dir@/PHP_CompatInfo/data/phpdocref/, where @data_dir@ identify your PEAR data directory.

  2. a list of Exception Rules installed in @php_dir@/scripts/pciconf/, where @php_dir@ identify your PEAR directory.

Default Exception Rules are provided by a set of file s named *_func_exception.php, *_const_exception.php, *_class_exception.php, where * means for the extension name (case sensitive).

Exception Rules files have the same structure as data dictionary. Only the array php variable name is different.

  • $function_exceptions for the related extension functions list

  • $constant_exceptions for the related extension constants list

  • $class_exceptions for the related extension classes list

pciconf detect presence of Exception Rules by the exceptions.conf.php file.

This file implement a required function

mixed getExceptions ( string $extension , string $type )

First argument $extension identify the extension name, while second argument $type identify the kind of exception (version, class, function, constant) to proceed.

If function return FALSE, that means there are no value to apply/merge with the phpdoc base reference. Otherwise, function should return a compatible data dictionary structure (array) what contains all news/changes to apply.

To use your own ERS, you have to tell it to the pciconf script with the --exception switch.

Example: pciconf --exception /home/users/farell/myERS.php

In summary:

  • Build your own ERS to be free to fix all errors you found without to wait a PHP Manual/PCI new version.

  • Use a directory acessible in your include_path to store result of data dictionaries corresponding to your platform, and avoid to overwrite the default PCI installation.

or how to improve detection (Previous) Reference guide (Next)
Last updated: Sat, 16 Feb 2019 — Download Documentation
Do you think that something on this page is wrong? Please file a bug report.
View this page in:
  • English

User Notes:

There are no user contributed notes for this page.