Remove support for PHP5
PHP5 is no longer actively supported by the PHP developers and security support for it ends completely at the end of 2018, so it doesn't make sense to include support for it in the upcoming SWIG 4.0.0 release. See #701.
This commit is contained in:
parent
f7a255c38a
commit
d6d5db122b
201 changed files with 94 additions and 11358 deletions
|
|
@ -104,11 +104,6 @@ matrix:
|
|||
env: SWIGLANG=perl5
|
||||
sudo: required
|
||||
dist: trusty
|
||||
- compiler: gcc
|
||||
os: linux
|
||||
env: SWIGLANG=php5
|
||||
sudo: required
|
||||
dist: trusty
|
||||
- compiler: gcc
|
||||
os: linux
|
||||
env: SWIGLANG=php VER=7.0
|
||||
|
|
@ -308,9 +303,6 @@ matrix:
|
|||
- compiler: clang
|
||||
os: osx
|
||||
env: SWIGLANG=perl5
|
||||
- compiler: clang
|
||||
os: osx
|
||||
env: SWIGLANG=php5
|
||||
- compiler: clang
|
||||
os: osx
|
||||
env: SWIGLANG=python
|
||||
|
|
|
|||
|
|
@ -7,6 +7,12 @@ the issue number to the end of the URL: https://github.com/swig/swig/issues/
|
|||
Version 4.0.0 (in progress)
|
||||
===========================
|
||||
|
||||
2018-06-07: olly
|
||||
[PHP5] Support for PHP5 has been removed. PHP5 is no longer
|
||||
actively supported by the PHP developers and security support for
|
||||
it ends completely at the end of 2018, so it doesn't make sense
|
||||
to include support for it in the upcoming SWIG 4.0.0 release.
|
||||
|
||||
2018-06-06: olly
|
||||
[Lua] Improve configure probes for Lua headers and libs used in testsuite.
|
||||
|
||||
|
|
|
|||
|
|
@ -50,20 +50,13 @@
|
|||
|
||||
|
||||
<p>
|
||||
In this chapter, we discuss SWIG's support of PHP. The PHP module
|
||||
was extensively rewritten in release 1.3.26, and support for generating
|
||||
OO wrappers for PHP5 was added in 1.3.30. The PHP module now supports most
|
||||
of the features available in some of the other languages.
|
||||
In this chapter, we discuss SWIG's support of PHP. SWIG currently supports
|
||||
generating wrappers for PHP7. Support for PHP5 was removed in SWIG 4.0.0
|
||||
and support for PHP4 was removed in SWIG 1.3.37.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
SWIG supports generating wrappers for PHP5 and PHP7. Support for PHP4 was removed
|
||||
in SWIG 1.3.37.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Currently any PHP5 or PHP7 release should work, but we don't regularly test with
|
||||
PHP < 5.3.
|
||||
Currently any PHP7 release should work.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
|
|
@ -81,9 +74,9 @@ available.
|
|||
|
||||
|
||||
<p>
|
||||
To build a PHP extension, run swig using the <tt>-php5</tt> or
|
||||
<tt>-php7</tt> option as follows (<tt>-php</tt> is also supported
|
||||
and currently is an alias for <tt>-php5</tt>):
|
||||
To build a PHP extension, run swig using the <tt>-php7</tt> option as follows
|
||||
(<tt>-php</tt> is also supported and currently is an alias for <tt>-php7</tt>
|
||||
but prior to SWIG 4.0.0 it was an alias for <tt>-php5</tt>):
|
||||
</p>
|
||||
|
||||
<div class="code"><pre>
|
||||
|
|
@ -107,9 +100,7 @@ also contain PHP class wrappers.
|
|||
SWIG can generate PHP extensions from C++ libraries as well when
|
||||
given the <tt>-c++</tt> option. The support for C++ is discussed in
|
||||
more detail in <a href="#Php_nn2_6">section 27.2.6</a>. The generated
|
||||
C++ wrapper will be called example_wrap.cpp (for PHP5) or
|
||||
example_wrap.cxx (for PHP7 where the default has been changed to align
|
||||
with SWIG's default for every other language). You can specify a
|
||||
C++ wrapper will be called example_wrap.cxx. You can specify a
|
||||
different extension for the C++ wrapper using <tt>-cppext</tt> -
|
||||
e.g. if you want example_wrap.cc use <tt>-cppext cc</tt>.
|
||||
</p>
|
||||
|
|
@ -172,8 +163,8 @@ PHP script which uses your extension:
|
|||
</pre></div>
|
||||
|
||||
<p>
|
||||
But note that this doesn't work when running PHP through a webserver in PHP5.3
|
||||
and later - you'll need to use <tt>extension</tt> in <tt>php.ini</tt> as
|
||||
But note that <tt>dl()</tt> isn't supported when running PHP through a
|
||||
webserver - you'll need to use <tt>extension</tt> in <tt>php.ini</tt> as
|
||||
described above.
|
||||
</p>
|
||||
|
||||
|
|
@ -199,7 +190,8 @@ It is important to understand that PHP uses a single global namespace
|
|||
into which all symbols from extension modules are loaded. It is quite
|
||||
possible for names of symbols in one extension module to clash with
|
||||
other symbols unless care is taken to <tt>%rename</tt> them. At present
|
||||
SWIG doesn't have support for the namespace feature added in PHP 5.3.
|
||||
SWIG doesn't have support for generating wrappers which make use of PHP's
|
||||
namespace feature.
|
||||
</p>
|
||||
|
||||
<H3><a name="Php_nn2_1">35.2.1 Constants</a></H3>
|
||||
|
|
@ -525,13 +517,6 @@ this, one needs to include <b>phppointers.i</b> which defines the
|
|||
named typemap REF.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Prior to SWIG 3.0, the REF typemaps relied on PHP's call-time
|
||||
pass-by-reference, which was deprecated in PHP 5.3 and removed in PHP 5.4.
|
||||
So if you use these REF typemaps, you should ensure that SWIG≥3.0 is
|
||||
used to generate wrappers from your interface file.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
In case you write your own typemaps, SWIG supports an attribute called
|
||||
<tt>byref</tt>: if you set that, then SWIG will make sure that the generated
|
||||
|
|
|
|||
|
|
@ -125,8 +125,7 @@ SWIGMZSCHEME Defined when using Mzscheme
|
|||
SWIGOCAML Defined when using Ocaml
|
||||
SWIGOCTAVE Defined when using Octave
|
||||
SWIGPERL Defined when using Perl
|
||||
SWIGPHP Defined when using PHP5 or PHP7
|
||||
SWIGPHP5 Defined when using PHP5
|
||||
SWIGPHP Defined when using PHP (any version)
|
||||
SWIGPHP7 Defined when using PHP7
|
||||
SWIGPIKE Defined when using Pike
|
||||
SWIGPYTHON Defined when using Python
|
||||
|
|
|
|||
|
|
@ -131,7 +131,6 @@ can be obtained by typing <tt>swig -help</tt> or <tt>swig
|
|||
-ocaml Generate Ocaml wrappers
|
||||
-octave Generate Octave wrappers
|
||||
-perl Generate Perl wrappers
|
||||
-php5 Generate PHP5 wrappers
|
||||
-php7 Generate PHP7 wrappers
|
||||
-pike Generate Pike wrappers
|
||||
-python Generate Python wrappers
|
||||
|
|
@ -145,7 +144,7 @@ can be obtained by typing <tt>swig -help</tt> or <tt>swig
|
|||
|
||||
-c++ Enable C++ processing
|
||||
-cppext <em>ext</em> Change file extension of C++ generated files to <em>ext</em>
|
||||
(default is cxx, except for PHP5 which uses cpp)
|
||||
(default is cxx)
|
||||
-D<em>symbol</em> Define a preprocessor symbol
|
||||
-Fmicrosoft Display error/warning messages in Microsoft format
|
||||
-Fstandard Display error/warning messages in commonly used format
|
||||
|
|
|
|||
|
|
@ -1071,56 +1071,6 @@ ruby_clean:
|
|||
rm -f core @EXTRA_CLEAN@
|
||||
rm -f *.@OBJEXT@ *$(RUBY_SO)
|
||||
|
||||
##################################################################
|
||||
##### PHP5 ######
|
||||
##################################################################
|
||||
|
||||
PHP5 = @PHP5@
|
||||
PHP5_INCLUDE = @PHP5INC@
|
||||
PHP5_SO = @PHP5_SO@
|
||||
PHP5_SCRIPT = $(SRCDIR)$(RUNME).php
|
||||
|
||||
# -------------------------------------------------------------------
|
||||
# Build a PHP5 dynamically loadable module (C)
|
||||
# -------------------------------------------------------------------
|
||||
|
||||
php5: $(SRCDIR_SRCS)
|
||||
$(SWIG) -php5 $(SWIGOPT) -o $(ISRCS) $(INTERFACEPATH)
|
||||
$(CC) -c $(CCSHARED) $(CPPFLAGS) $(CFLAGS) $(SRCDIR_SRCS) $(ISRCS) $(INCLUDES) $(PHP5_INCLUDE)
|
||||
$(LDSHARED) $(CFLAGS) $(LDFLAGS) $(OBJS) $(IOBJS) $(LIBS) -o $(LIBPREFIX)$(TARGET)$(PHP5_SO)
|
||||
|
||||
# --------------------------------------------------------------------
|
||||
# Build a PHP5 dynamically loadable module (C++)
|
||||
# --------------------------------------------------------------------
|
||||
|
||||
php5_cpp: $(SRCDIR_SRCS)
|
||||
$(SWIG) -php5 -cppext cxx -c++ $(SWIGOPT) -o $(ICXXSRCS) $(INTERFACEPATH)
|
||||
$(CXX) -c $(CCSHARED) $(CPPFLAGS) $(CXXFLAGS) $(SRCDIR_SRCS) $(SRCDIR_CXXSRCS) $(ICXXSRCS) $(INCLUDES) $(PHP5_INCLUDE)
|
||||
$(CXXSHARED) $(CXXFLAGS) $(LDFLAGS) $(OBJS) $(IOBJS) $(LIBS) $(CPP_DLLIBS) -o $(LIBPREFIX)$(TARGET)$(PHP5_SO)
|
||||
|
||||
# -----------------------------------------------------------------
|
||||
# Running a PHP5 example
|
||||
# -----------------------------------------------------------------
|
||||
|
||||
php5_run:
|
||||
$(RUNTOOL) $(PHP5) -n -q -d extension_dir=. -d safe_mode=Off $(PHP5_SCRIPT) $(RUNPIPE)
|
||||
|
||||
# -----------------------------------------------------------------
|
||||
# Version display
|
||||
# -----------------------------------------------------------------
|
||||
|
||||
php5_version:
|
||||
$(PHP5) -v | head -n 1
|
||||
|
||||
# -----------------------------------------------------------------
|
||||
# Cleaning the PHP5 examples
|
||||
# -----------------------------------------------------------------
|
||||
|
||||
php5_clean:
|
||||
rm -f *_wrap* *~ .~* example.php php_example.h
|
||||
rm -f core @EXTRA_CLEAN@
|
||||
rm -f *.@OBJEXT@ *$(PHP5_SO)
|
||||
|
||||
##################################################################
|
||||
##### PHP7 ######
|
||||
##################################################################
|
||||
|
|
|
|||
|
|
@ -1,19 +0,0 @@
|
|||
TOP = ../..
|
||||
SWIGEXE = $(TOP)/../swig
|
||||
SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
|
||||
CXXSRCS = example.cxx
|
||||
TARGET = example
|
||||
INTERFACE = example.i
|
||||
LIBS = -lm
|
||||
SWIGOPT =
|
||||
|
||||
check: build
|
||||
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' php5_run
|
||||
|
||||
build:
|
||||
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' $(SWIGLIB) CXXSRCS='$(CXXSRCS)' \
|
||||
SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
|
||||
SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' php5_cpp
|
||||
|
||||
clean:
|
||||
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' php5_clean
|
||||
|
|
@ -1,4 +0,0 @@
|
|||
/* File : example.cxx */
|
||||
|
||||
#include "example.h"
|
||||
|
||||
|
|
@ -1,22 +0,0 @@
|
|||
/* File : example.h */
|
||||
|
||||
#include <iostream>
|
||||
|
||||
class Callback {
|
||||
public:
|
||||
virtual ~Callback() { std::cout << "Callback::~Callback()" << std:: endl; }
|
||||
virtual void run() { std::cout << "Callback::run()" << std::endl; }
|
||||
};
|
||||
|
||||
|
||||
class Caller {
|
||||
private:
|
||||
Callback *_callback;
|
||||
public:
|
||||
Caller(): _callback(0) {}
|
||||
~Caller() { delCallback(); }
|
||||
void delCallback() { delete _callback; _callback = 0; }
|
||||
void setCallback(Callback *cb) { delCallback(); _callback = cb; }
|
||||
void call() { if (_callback) _callback->run(); }
|
||||
};
|
||||
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
/* File : example.i */
|
||||
%module(directors="1") example
|
||||
%{
|
||||
#include "example.h"
|
||||
%}
|
||||
|
||||
/* turn on director wrapping Callback */
|
||||
%feature("director") Callback;
|
||||
|
||||
%include "example.h"
|
||||
|
||||
|
|
@ -1,19 +0,0 @@
|
|||
<html>
|
||||
<head>
|
||||
<title>SWIG:Examples:php5:callback</title>
|
||||
</head>
|
||||
|
||||
<body bgcolor="#ffffff">
|
||||
|
||||
|
||||
<tt>SWIG/Examples/php5/callback/</tt>
|
||||
<hr>
|
||||
|
||||
<H2>Implementing C++ callbacks in PHP5</H2>
|
||||
|
||||
<p>
|
||||
This example illustrates how to use directors to implement C++ callbacks in PHP5.
|
||||
|
||||
<hr>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -1,47 +0,0 @@
|
|||
<?php
|
||||
|
||||
# This file illustrates the cross language polymorphism using directors.
|
||||
|
||||
require("example.php");
|
||||
|
||||
# Class, which overwrites Callback::run().
|
||||
|
||||
class PhpCallback extends Callback {
|
||||
function run() {
|
||||
print "PhpCallback.run()\n";
|
||||
}
|
||||
};
|
||||
|
||||
# Create an Caller instance
|
||||
|
||||
$caller = new Caller();
|
||||
|
||||
# Add a simple C++ callback (caller owns the callback, so
|
||||
# we disown it first by clearing the .thisown flag).
|
||||
|
||||
print "Adding and calling a normal C++ callback\n";
|
||||
print "----------------------------------------\n";
|
||||
|
||||
$callback = new Callback();
|
||||
$callback->thisown = 0;
|
||||
$caller->setCallback($callback);
|
||||
$caller->call();
|
||||
$caller->delCallback();
|
||||
|
||||
print "\n";
|
||||
print "Adding and calling a PHP callback\n";
|
||||
print "------------------------------------\n";
|
||||
|
||||
# Add a PHP callback.
|
||||
|
||||
$callback = new PhpCallback();
|
||||
$callback->thisown = 0;
|
||||
$caller->setCallback($callback);
|
||||
$caller->call();
|
||||
$caller->delCallback();
|
||||
|
||||
# All done.
|
||||
|
||||
print "php exit\n";
|
||||
|
||||
?>
|
||||
|
|
@ -1,19 +0,0 @@
|
|||
# see top-level Makefile.in
|
||||
# (see also top-level configure.ac kludge)
|
||||
callback
|
||||
class
|
||||
constants
|
||||
cpointer
|
||||
disown
|
||||
enum
|
||||
extend
|
||||
funcptr
|
||||
overloading
|
||||
pointer
|
||||
pragmas
|
||||
proxy
|
||||
reference
|
||||
simple
|
||||
sync
|
||||
value
|
||||
variables
|
||||
|
|
@ -1,20 +0,0 @@
|
|||
TOP = ../..
|
||||
SWIGEXE = $(TOP)/../swig
|
||||
SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
|
||||
CXXSRCS = example.cxx
|
||||
TARGET = example
|
||||
INTERFACE = example.i
|
||||
LIBS =
|
||||
SWIGOPT =
|
||||
|
||||
check: build
|
||||
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' php5_run
|
||||
|
||||
build:
|
||||
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
|
||||
SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
|
||||
SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \
|
||||
php5_cpp
|
||||
|
||||
clean:
|
||||
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' php5_clean
|
||||
|
|
@ -1,28 +0,0 @@
|
|||
/* File : example.cxx */
|
||||
|
||||
#include "example.h"
|
||||
#define M_PI 3.14159265358979323846
|
||||
|
||||
/* Move the shape to a new location */
|
||||
void Shape::move(double dx, double dy) {
|
||||
x += dx;
|
||||
y += dy;
|
||||
}
|
||||
|
||||
int Shape::nshapes = 0;
|
||||
|
||||
double Circle::area() {
|
||||
return M_PI*radius*radius;
|
||||
}
|
||||
|
||||
double Circle::perimeter() {
|
||||
return 2*M_PI*radius;
|
||||
}
|
||||
|
||||
double Square::area() {
|
||||
return width*width;
|
||||
}
|
||||
|
||||
double Square::perimeter() {
|
||||
return 4*width;
|
||||
}
|
||||
|
|
@ -1,34 +0,0 @@
|
|||
/* File : example.h */
|
||||
|
||||
class Shape {
|
||||
public:
|
||||
Shape() {
|
||||
nshapes++;
|
||||
}
|
||||
virtual ~Shape() {
|
||||
nshapes--;
|
||||
}
|
||||
double x, y;
|
||||
void move(double dx, double dy);
|
||||
virtual double area() = 0;
|
||||
virtual double perimeter() = 0;
|
||||
static int nshapes;
|
||||
};
|
||||
|
||||
class Circle : public Shape {
|
||||
private:
|
||||
double radius;
|
||||
public:
|
||||
Circle(double r) : radius(r) { }
|
||||
virtual double area();
|
||||
virtual double perimeter();
|
||||
};
|
||||
|
||||
class Square : public Shape {
|
||||
private:
|
||||
double width;
|
||||
public:
|
||||
Square(double w) : width(w) { }
|
||||
virtual double area();
|
||||
virtual double perimeter();
|
||||
};
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
/* File : example.i */
|
||||
%module example
|
||||
|
||||
%{
|
||||
#include "example.h"
|
||||
%}
|
||||
|
||||
/* Let's just grab the original header file here */
|
||||
%include "example.h"
|
||||
|
|
@ -1,60 +0,0 @@
|
|||
<?php
|
||||
|
||||
# This example illustrates how member variables are wrapped.
|
||||
|
||||
require("example.php");
|
||||
|
||||
# ----- Object creation -----
|
||||
|
||||
print "Creating some objects:\n";
|
||||
$c = new Circle(10);
|
||||
print " Created circle\n";
|
||||
$s = new Square(10);
|
||||
print " Created square\n";
|
||||
|
||||
# ----- Access a static member -----
|
||||
|
||||
print "\nA total of " . Shape::nshapes() . " shapes were created\n";
|
||||
|
||||
# ----- Member data access -----
|
||||
|
||||
# Set the location of the object.
|
||||
# Note: methods in the base class Shape are used since
|
||||
# x and y are defined there.
|
||||
|
||||
$c->x = 20;
|
||||
$c->y = 30;
|
||||
$s->x = -10;
|
||||
$s->y = 5;
|
||||
|
||||
print "\nHere is their current position:\n";
|
||||
print " Circle = ({$c->x},{$c->y})\n";
|
||||
print " Square = ({$s->x},{$s->y})\n";
|
||||
|
||||
# ----- Call some methods -----
|
||||
|
||||
# Notice how the Shape_area() and Shape_perimeter() functions really
|
||||
# invoke the appropriate virtual method on each object.
|
||||
print "\nHere are some properties of the shapes:\n";
|
||||
foreach (array($c,$s) as $o) {
|
||||
print " ". get_class($o) . "\n";
|
||||
print " area = {$o->area()}\n";
|
||||
print " perimeter = {$o->perimeter()}\n";
|
||||
}
|
||||
|
||||
# ----- Delete everything -----
|
||||
|
||||
print "\nGuess I'll clean up now\n";
|
||||
|
||||
# Note: this invokes the virtual destructor
|
||||
$c = NULL;
|
||||
$s = NULL;
|
||||
|
||||
# and don't forget the $o from the for loop above. It still refers to
|
||||
# the square.
|
||||
$o = NULL;
|
||||
|
||||
print Shape::nshapes() . " shapes remain\n";
|
||||
print "Goodbye\n";
|
||||
|
||||
?>
|
||||
|
|
@ -1,20 +0,0 @@
|
|||
TOP = ../..
|
||||
SWIGEXE = $(TOP)/../swig
|
||||
SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
|
||||
SRCS =
|
||||
TARGET = example
|
||||
INTERFACE = example.i
|
||||
LIBS =
|
||||
SWIGOPT =
|
||||
|
||||
check: build
|
||||
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' php5_run
|
||||
|
||||
build:
|
||||
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
|
||||
SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
|
||||
SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \
|
||||
php5
|
||||
|
||||
clean:
|
||||
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' php5_clean
|
||||
|
|
@ -1,26 +0,0 @@
|
|||
/* File : example.i */
|
||||
%module example
|
||||
|
||||
/* A few preprocessor macros */
|
||||
|
||||
#define ICONST 42
|
||||
#define FCONST 2.1828
|
||||
#define CCONST 'x'
|
||||
#define CCONST2 '\n'
|
||||
#define SCONST "Hello World"
|
||||
#define SCONST2 "\"Hello World\""
|
||||
|
||||
/* This should work just fine */
|
||||
#define EXPR ICONST + 3*(FCONST)
|
||||
|
||||
/* This shouldn't do anything */
|
||||
#define EXTERN extern
|
||||
|
||||
/* Neither should this (BAR isn't defined) */
|
||||
#define FOO (ICONST + BAR)
|
||||
|
||||
/* The following statements also produce constants */
|
||||
%constant int iconst = 37;
|
||||
%constant double fconst = 3.14;
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue