The PHP Interpreter
C PHP C++ M4 Objective-C Shell Other
Pull request Compare This branch is 96 commits ahead, 30457 commits behind php:master.
Latest commit 1d5970b Jul 22, 2012 @nikic nikic committed with Also had to fix up some tokenizer tests that were affected by the token
number changes.

(cherry picked from commit 99f93dd)
Signed-off-by: Lior Kaplan <[email protected]>
Permalink
Failed to load latest commit information.
TSRM Fix bug #72513: Stack-based buffer overflow vulnerability in virtual_… Sep 22, 2016
Zend Fix bug #73052: Memory Corruption in During Deserialized-object Destr… Sep 22, 2016
build Fix bug #67091: make install fails to install libphp5.so on FreeBSD 10.0 Jun 29, 2014
ext Also had to fix up some tokenizer tests that were affected by the token Sep 22, 2016
main Fix bug #72573: HTTP_PROXY is improperly trusted by some PHP librarie… Sep 22, 2016
netware Bump year Jan 3, 2014
pear Removed safe_mode Apr 26, 2010
sapi Fix bug #70755: fpm_log.c memory leak and buffer overflow Sep 22, 2016
scripts typofixes Aug 17, 2014
tests Fixed wrong XFAIL test - already fixed Jun 15, 2014
win32 Fixed bug #69134 (Per Directory Values overrides PHP_INI_SYSTEM confi… Mar 17, 2015
.gdbinit Now we can set the tsrm_ls manually Oct 1, 2012
.gitattributes Enable $ replacement in exif, ldap, pdo_pgsql and tidy Jul 20, 2014
.gitignore ignore signatures for packages too Aug 2, 2015
.travis.yml Exclude Travis build for 5.3 and 5.4 Mar 28, 2013
CODING_STANDARDS Fix English and improve by Stas. Thanks :) Jan 27, 2014
CREDITS Let's pretend this is up-to-date now Apr 22, 2002
EXTENSIONS Add hash to EXTENSIONS file Oct 3, 2014
INSTALL Updated INSTALL. Generated from the XML Docs. Aug 23, 2012
LICENSE Update copyright year for the license Oct 5, 2010
Makefile.frag MFB 5.3: Rest of the changes for re2c merge Mar 26, 2008
Makefile.gcov fix race condition in find (it was finding the copied files over and … Feb 20, 2012
Makefile.global Update gitignore and Makefile for additional entries Jan 24, 2014
NEWS Add NEWS entries from PHP 5.6.26 Sep 22, 2016
README.EXTENSIONS Update source docs Jan 27, 2014
README.EXT_SKEL Fix English and improve by Stas. Thanks :) Jan 27, 2014
README.GIT-RULES Adjust Git-Rules Jul 29, 2015
README.MAILINGLIST_RULES MFH Jan 17, 2008
README.NEW-OUTPUT-API fix protos, and unintential double-patched content May 31, 2010
README.PARAMETER_PARSING_API typo fixes (accommodate, parameter) Jun 10, 2013
README.PHP4-TO-PHP5-THIN-CHANGES new incompatibilities. maybe someone from the doc group will update the Aug 24, 2004
README.REDIST.BINS - update blowfish to 1.2 (Solar Designer) Jul 18, 2011
README.RELEASE_PROCESS phpweb now publishes SHA256s -- and please don't cc php-announce@ - m… Apr 17, 2015
README.SELF-CONTAINED-EXTENSIONS added notes about the PECL site conformity Oct 14, 2013
README.STREAMS Added notes about locking functions. Mar 4, 2003
README.SUBMITTING_PATCH Fix English and improve by Stas. Thanks :) Jan 27, 2014
README.TESTING Merge branch 'pull-request/341' Jun 10, 2013
README.TESTING2 Fixed bug#46445 (run-tests2.php is missing or README.TESTING2 is unne… Nov 5, 2008
README.UNIX-BUILD-SYSTEM Update documentation for PHP 5. Jul 3, 2003
README.WIN32-BUILD-SYSTEM - if they are outdated/wrong, no need to confuse the users Feb 4, 2010
README.input_filter Merge branch 'PHP-5.3' into PHP-5.4 Mar 20, 2012
README.namespaces drop exec perm on doc files Jun 5, 2014
UPGRADING Fix bug #72573: HTTP_PROXY is improperly trusted by some PHP librarie… Sep 22, 2016
UPGRADING.INTERNALS UPGRADING note about bug #67072 Apr 18, 2014
acinclude.m4 typofixes Aug 17, 2014
buildconf Make "buildconf --force" more robust, per IRC chat. Not backported to… Mar 6, 2012
buildconf.bat MFH: Check if configure script was copied, and output an error if it … Jan 2, 2009
config.guess - Fixed bug #63451 (config.guess file does not have AIX 7 defined, sh… Nov 9, 2012
config.sub add support for ppc64p7 arch (Power7 optimized) Feb 26, 2013
configure.in 5.4.45 Sep 1, 2015
footer consistent with the used style Feb 20, 2003
genfiles MFB53: genfiles update Mar 26, 2008
header Update copyright year to 2014 Jun 16, 2014
ltmain.sh - Upgraded bundled libtool to 1.5.26 Nov 23, 2009
makedist Merge branch 'PHP-5.3' into PHP-5.4 Jun 22, 2012
makerpm - Change from PHP5 -> PHP 5 Feb 8, 2004
php.gif change these in HEAD too Mar 7, 2006
php.ini-development Fixed bug #67033 Remove reference to Windows 95 Apr 14, 2014
php.ini-production Fixed bug #67033 Remove reference to Windows 95 Apr 14, 2014
php5.spec.in - Renamed all *php4* files to *php5*, changed all php4/PHP4 to php5/PHP5 Jan 17, 2004
run-tests.php make sure that we don't truncate the stack trace and cause false test… Dec 2, 2014
server-tests-config.php typofixes Aug 17, 2014
server-tests.php Merge branch 'pull-request/341' Jun 10, 2013
snapshot Integration of -ng changes. Changes: Dec 30, 1999
stamp-h.in # Fix ColorResolve bogosity Nov 21, 1999
stub.c Add newline. Recent GCC snapshots segfault, if the input file is comp… Dec 1, 2000
svnclean.bat - rename to svn Jul 13, 2009
vcsclean MFH: dropped some more mime types, svnclean -> clean for multiple VCS Jul 16, 2009

README.EXT_SKEL

(NOTE: you may also want to take a look at the pear package
	     PECL_Gen, a PHP-only alternative for this script that
			 supports way more extension writing tasks and is 
			 supposed to replace ext_skel completely in the long run ...)

WHAT IT IS

  It's a tool for automatically creating the basic framework for a PHP module
  and writing C code handling arguments passed to your functions from a simple
  configuration file. See an example at the end of this file.

HOW TO USE IT

  Very simple. First, change to the ext/ directory of the PHP 4 sources. If
  you just need the basic framework and will be writing all the code in your
  functions yourself, you can now do

   ./ext_skel --extname=module_name

  and everything you need is placed in directory module_name. 

  [ Note that GNU awk is likely required for this script to work.  Debian 
    systems seem to default to using mawk, so you may need to change the 
    #! line in skeleton/create_stubs and the cat $proto | awk line in
    ext_skel to use gawk explicitly. ]

  If you don't need to test the existence of any external header files, 
  libraries or functions in them, the module is already almost ready to be 
  compiled in PHP.  Just remove 3 comments in your_module_name/config.m4, 
  change back up to PHP sources top directory, and do

    ./buildconf; ./configure --enable-module_name; make

  The definition of PHP_MODULE_NAME_VERSION will be present in the
  php_module_name.h and injected into the zend_module_entry definition. This
  is required by the PECL website for the version string conformity checks
  against package.xml

  But if you already have planned the overall scheme of your module, what
  functions it will contain, their return types and the arguments they take
  (a very good idea) and don't want to bother yourself with creating function
  definitions and handling arguments passed yourself, it's time to create a
  function definitions file, which you will give as an argument to ext_skel
  with option

    --proto=filename.

SOURCE AND HEADER FILE NAME

  ./ext_skel generates 'module_name.c' and 'php_module_name.h' as main source
  and header files. Keep these names.

  Module functions (User functions) must be named

  module_name_function()

  When you need to expose module functions to other modules, expose functions
  strictly needed by others. Exposed internal function must be named

  php_module_name_function()

  See also CODING_STANDARDS.


FORMAT OF FUNCTION DEFINITIONS FILE

  All the definitions must be on one line. In it's simplest form, it's just
  the function name, e.g.

    module_name_function

  but then you'll be left with an almost empty function body without any
  argument handling.

  Arguments are given in parenthesis after the function name, and are of
  the form 'argument_type argument_name'. Arguments are separated from each
  other with a comma and optional space. Argument_type can be one of int,
  bool, double, float, string, array, object or mixed.

  An optional argument is separated from the previous by an optional space,
  then '[' and of course comma and optional space, like all the other
  arguments. You should close a row of optional arguments with same amount of
  ']'s as there where '['s. Currently, it does not harm if you forget to do it
  or there is a wrong amount of ']'s, but this may change in the future.

	An additional short description may be added after the parameters. 
  If present it will be filled into the 'proto' header comments in the stubs
  code and the <refpurpose> tag in the XML documentation.

  An example:

    module_name_function(int arg1, int arg2 [, int arg3 [, int arg4]])

  Arguments arg1 and arg2 are required.
  Arguments arg3 and arg4 are optional.

  If possible, the function definition should also contain it's return type
  in front of the definition. It's not actually used for any C code generating
  purposes but PHP in-source documentation instead, and as such, very useful.
  It can be any of int, double, string, bool, array, object, resource, mixed
  or void.

  The file must contain nothing else but function definitions, no comments or
  empty lines.

OTHER OPTIONS

    --no-help

  By default, ext_skel creates both comments in the source code and a test
  function to help first time module writers to get started and testing
  configuring and compiling their module. This option turns off all such things
  which may just annoy experienced PHP module coders. Especially useful with

    --stubs=file

  which will leave out also all module specific stuff and write just function
  stubs with function value declarations and passed argument handling, and
  function entries and definitions at the end of the file, for copying and
  pasting into an already existing module.

    --xml[=file]

  Creates the basics for phpdoc .xml file.

    --full-xml

  Not implemented yet. When or if there will ever be created a framework for
  self-contained extensions to use phpdoc system for their documentation, this
  option enables it on the created xml file.

CURRENT LIMITATIONS, BUGS AND OTHER ODDITIES

  Only arguments of types int, bool, double, float, string and array are
  handled. For other types you must write the code yourself. And for type
  mixed, it wouldn't even be possible to write anything, because only you
  know what to expect.
  
  It can't handle correctly, and probably never will, variable list of
  of arguments. (void foo(int bar [, ...])

  Don't trust the generated code too much. It tries to be useful in most of
  the situations you might encounter, but automatic code generation will never
  beat a programmer who knows the real situation at hand. ext_skel is generally
  best suited for quickly generating a wrapper for c-library functions you
  might want to have available in PHP too.

  This program doesn't have a --help option. It has --no-help instead.

EXAMPLE

  The following _one_ line

  bool module_name_drawtext(resource image, string text, resource font, int x, int y [, int color])

  will create this function definition for you (note that there are a few
  question marks to be replaced by you, and you must of course add your own
  value definitions too):

/* {{{ proto bool module_name_drawtext(resource image, string text, resource font, int x, int y [, int color])
    */
PHP_FUNCTION(module_name_drawtext)
{
    char *text = NULL;
    int argc = ZEND_NUM_ARGS();
    int image_id = -1;
    int text_len;
    int font_id = -1;
    long x;
    long y;
    long color;
    zval *image = NULL;
    zval *font = NULL;

    if (zend_parse_parameters(argc TSRMLS_CC, "rsrll|l", &image, &text, &text_len, &font, &x, &y, &color) == FAILURE)
        return;

    if (image) {
        ZEND_FETCH_RESOURCE(???, ???, image, image_id, "???", ???_rsrc_id);
    }
    if (font) {
        ZEND_FETCH_RESOURCE(???, ???, font, font_id, "???", ???_rsrc_id);
    }

    php_error(E_WARNING, "module_name_drawtext: not yet implemented");
}
/* }}} */