From 44ab99fddb154aa6858fd0428ce1b8357141c760 Mon Sep 17 00:00:00 2001
From: Andrew Zenin <kashaket@yandex.ua>
Date: Thu, 7 Mar 2019 19:01:34 +0200
Subject: [PATCH 01/35] Small changes

---
 Source/PHPFunctions.pas | 6 ++++--
 Source/ZENDAPI.pas      | 2 +-
 Source/php4delphi.pas   | 5 +++--
 Source/phpClass.pas     | 5 +++--
 4 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/Source/PHPFunctions.pas b/Source/PHPFunctions.pas
index 4f192ae..d8071cf 100644
--- a/Source/PHPFunctions.pas
+++ b/Source/PHPFunctions.pas
@@ -19,7 +19,9 @@
 
 interface
  uses
-   Windows, SysUtils,  Classes, {$IFDEF VERSION6} Variants,
+   Windows, SysUtils,  Classes,
+   {$IFDEF PHP_UNICE}WideStrUtils, {$ENDIF}
+   {$IFDEF VERSION6} Variants,
    {$ENDIF} ZendTypes, PHPTypes, ZendAPI, PHPAPI ;
 
 type
@@ -321,7 +323,7 @@ procedure TPHPFunction.SetDisplayName(const Value: string);
           ({$IFDEF PHP_UNICE}CompareText{$ELSE}AnsiCompareText{$ENDIF}(NameValue, F.FunctionName) = 0) then
           raise Exception.CreateFmt('Duplicate function name: %s', [Value]);
       end;
-    FFunctionName :=  {$IFDEF PHP_UNICE}LowerCase{$ELSE}AnsiLowerCase{$ENDIF}(Value);
+    FFunctionName :=  {$IFDEF PHP_UNICE}UTF8LowerCase{$ELSE}AnsiLowerCase{$ENDIF}(Value);
     Changed(False);
   end;
 end;
diff --git a/Source/ZENDAPI.pas b/Source/ZENDAPI.pas
index e3d9c45..5b36e8d 100644
--- a/Source/ZENDAPI.pas
+++ b/Source/ZENDAPI.pas
@@ -3439,7 +3439,7 @@ function Z_VARREC(z: pzval): TVarRec;
             Move(z.value.str.val^, P[1], z.value.str.len);
 
             {$IFDEF PHP_UNICE}
-              Result.VString := Pointer(String(p));
+              Result.VUnicodeString := Pointer(p);
             {$ELSE}
               Result.VAnsiString := Pointer(P);
             {$ENDIF}
diff --git a/Source/php4delphi.pas b/Source/php4delphi.pas
index 1d19cbb..13baa1c 100644
--- a/Source/php4delphi.pas
+++ b/Source/php4delphi.pas
@@ -40,6 +40,7 @@ interface
   PHPCommon, WinApi.WinSock,
   ZendTypes, PHPTypes, PHPAPI, ZENDAPI,
   DelphiFunctions, phpFunctions, strUtils, varUtils,
+  {$IFDEF PHP_UNICE}WideStrUtils, {$ENDIF}
   {$IFDEF soulengine_build} VCL.Dialogs, {$ENDIF}
   System.UITypes;
 
@@ -1765,7 +1766,7 @@ procedure TPHPEngine.RegisterLibrary(ALib : TCustomPHPLibrary);
   for cnt := 0 to ALib.Functions.Count - 1 do
    begin
       FN :=
-      {$IFDEF PHP_UNICE}LowerCase{$ELSE}AnsiLowerCase{$ENDIF}
+      {$IFDEF PHP_UNICE}UTF8LowerCase{$ELSE}AnsiLowerCase{$ENDIF}
       (ALib.Functions[cnt].FunctionName);
       if FHash.IndexOf(FN) > -1 then
       begin
@@ -1778,7 +1779,7 @@ procedure TPHPEngine.RegisterLibrary(ALib : TCustomPHPLibrary);
    begin
       for cnt := 0 to ALib.Functions.Count - 1 do
        begin
-         FN := {$IFDEF PHP_UNICE}LowerCase{$ELSE}AnsiLowerCase{$ENDIF}
+         FN := {$IFDEF PHP_UNICE}UTF8LowerCase{$ELSE}AnsiLowerCase{$ENDIF}
          (ALib.Functions[cnt].FunctionName);
          FHash.AddObject(FN, ALib.Functions[cnt]);
        end;
diff --git a/Source/phpClass.pas b/Source/phpClass.pas
index 12e035d..a684840 100644
--- a/Source/phpClass.pas
+++ b/Source/phpClass.pas
@@ -18,6 +18,7 @@ interface
 
 uses
   Windows, SysUtils, Classes, PHPCommon,
+  {$IFDEF PHP_UNICE}WideStrUtils, {$ENDIF}
   ZendTypes, ZendAPI, phpTypes, PHPAPI,
   phpFunctions;
 
@@ -807,7 +808,7 @@ procedure TPHPClass.ProduceInstance(AValue: pzval);
 
 procedure TPHPClass.SetClassName(const Value: zend_ustr);
 begin
-  FClassName := LowerCase(Value);
+  FClassName := {$IFDEF PHP_UNICE}UTF8LowerCase(Value){$ELSE}LowerCase(Value){$ENDIF};
 end;
 
 procedure TPHPClass.SetMethods(const Value: TPHPClassmethods);
@@ -1133,7 +1134,7 @@ procedure TPHPClassMethod.SetDisplayName(const Value: string);
           ({$IFDEF PHP_UNICE}CompareText{$ELSE}AnsiCompareText{$ENDIF}(Value, F.Name) = 0) then
           raise Exception.Create('Duplicate method name');
       end;
-    FName :=  LowerCase(Value);
+    FName :=  {$IFDEF PHP_UNICE}LowerCase(Value){$ELSE}AnsiLowerCase(Value){$ENDIF};
     Changed(False);
   end;
 end;

From 28036a7430837db19176affacb8656ba74562c1f Mon Sep 17 00:00:00 2001
From: Andrew Zenin <kashaket@yandex.ua>
Date: Sat, 9 Mar 2019 18:19:46 +0200
Subject: [PATCH 02/35] some small changes

---
 PHP4DELPHI.HLP => Documentation/PHP4DELPHI.HLP | Bin
 php4delphi.chm => Documentation/php4delphi.chm | Bin
 php4delphi.chw => Documentation/php4delphi.chw | Bin
 php4delphi.cnt => Documentation/php4delphi.cnt |   0
 Source/DelphiFunctions.pas                     |   4 ++--
 5 files changed, 2 insertions(+), 2 deletions(-)
 rename PHP4DELPHI.HLP => Documentation/PHP4DELPHI.HLP (100%)
 rename php4delphi.chm => Documentation/php4delphi.chm (100%)
 rename php4delphi.chw => Documentation/php4delphi.chw (100%)
 rename php4delphi.cnt => Documentation/php4delphi.cnt (100%)

diff --git a/PHP4DELPHI.HLP b/Documentation/PHP4DELPHI.HLP
similarity index 100%
rename from PHP4DELPHI.HLP
rename to Documentation/PHP4DELPHI.HLP
diff --git a/php4delphi.chm b/Documentation/php4delphi.chm
similarity index 100%
rename from php4delphi.chm
rename to Documentation/php4delphi.chm
diff --git a/php4delphi.chw b/Documentation/php4delphi.chw
similarity index 100%
rename from php4delphi.chw
rename to Documentation/php4delphi.chw
diff --git a/php4delphi.cnt b/Documentation/php4delphi.cnt
similarity index 100%
rename from php4delphi.cnt
rename to Documentation/php4delphi.cnt
diff --git a/Source/DelphiFunctions.pas b/Source/DelphiFunctions.pas
index c5f24e3..3334287 100644
--- a/Source/DelphiFunctions.pas
+++ b/Source/DelphiFunctions.pas
@@ -479,7 +479,7 @@ procedure delphi_get_property_handler(val : pzval; property_reference : PZend_pr
 end;
 
 
-
+{$IFDEF PHP4}
 procedure _delphi_get_property_wrapper; assembler;
 asm
   push        ebp
@@ -518,7 +518,7 @@ procedure _delphi_get_property_wrapper; assembler;
   pop         ebp
   ret
 end;
-
+{$ENDIF}
 
 procedure delphi_call_function(ht : integer; return_value : pzval; this_ptr : pzval;
       return_value_used : integer; TSRMLS_DC : pointer; property_reference : Pzend_property_reference ); cdecl;

From 1d7313ccfa8d3265bac0924127c5cbeabc7abd75 Mon Sep 17 00:00:00 2001
From: Andrew Zenin <kashaket@yandex.ua>
Date: Wed, 13 Mar 2019 13:11:55 +0200
Subject: [PATCH 03/35] Some L/D changes

---
 Source/PHPProjectWizard.pas       |   2 +-
 Source/PHPTypes.pas               |  12 ++++++------
 Source/ZENDAPI.pas                |   4 ++--
 Source/ZendTypes.pas              |   2 +-
 Source/php4DelphiD2010.dproj      |  22 +++++++++++-----------
 Source/php4DelphiD2010.identcache | Bin 1252 -> 1252 bytes
 Source/php4DelphiD2010.stat       |   6 +++---
 Source/php4DelphiR2010.identcache | Bin 856 -> 856 bytes
 Source/php4DelphiR2010.stat       |   6 +++---
 Source/php4delphi.pas             |   9 ++++-----
 Source/phpModules.pas             |   4 +++-
 Source/phpWeb.pas                 |   2 +-
 Source/zend_dynamic_array.pas     |   2 +-
 13 files changed, 36 insertions(+), 35 deletions(-)

diff --git a/Source/PHPProjectWizard.pas b/Source/PHPProjectWizard.pas
index 49edc4a..37f4fac 100644
--- a/Source/PHPProjectWizard.pas
+++ b/Source/PHPProjectWizard.pas
@@ -16,7 +16,7 @@
 interface
 
 uses
-  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
+  {$IFNDEF FPC} Windows, {$ELSE} LCLType,LCLIntf,dynlibs,libc,{$ENDIF} Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
   ToolsAPI,
   {$IFDEF VERSION6}
   DesignIntf,
diff --git a/Source/PHPTypes.pas b/Source/PHPTypes.pas
index 5dbbbc6..0f788f4 100644
--- a/Source/PHPTypes.pas
+++ b/Source/PHPTypes.pas
@@ -16,7 +16,7 @@
 interface
 
 uses
-  Windows, ZENDTypes;
+  {$IFNDEF FPC} Windows{$ELSE} LCLType{$ENDIF}, ZENDTypes;
 
 {$IFDEF PHP4}
 const
@@ -254,8 +254,8 @@ interface
 
   sapi_module_struct =
     record
-      name : zend_pchar;
-      pretty_name : zend_pchar;
+      name : PAnsiChar;
+      pretty_name : PAnsiChar;
 
       startup  : TModuleStartupFunc;
       //int (*startup)(struct _sapi_module_struct *sapi_module);
@@ -288,14 +288,14 @@ interface
       get_request_time : pointer;
       terminate_process : pointer;
 
-      php_ini_path_override : zend_pchar;
+      php_ini_path_override : PAnsiChar;
 
       block_interruptions : pointer;
       unblock_interruptions : pointer;
 
       default_post_reader : pointer;
       treat_data : pointer;
-      executable_location : zend_pchar;
+      executable_location : PAnsiChar;
 
       php_ini_ignore : Integer;
 
@@ -313,7 +313,7 @@ interface
 
       phpinfo_as_text : integer;
 
-      ini_entries : zend_pchar;
+      ini_entries : PAnsiChar;
 
       additional_functions: Pointer;
       input_filter_init : Pointer;
diff --git a/Source/ZENDAPI.pas b/Source/ZENDAPI.pas
index 5b36e8d..e614614 100644
--- a/Source/ZENDAPI.pas
+++ b/Source/ZENDAPI.pas
@@ -20,7 +20,7 @@
 interface
 
 uses
-  Windows, SysUtils,
+  {$IFNDEF FPC} Windows{$ELSE} LCLType,LCLIntf,dynlibs,libc{$ENDIF}, SysUtils,
   ZendTypes, Variants,
   PHPTypes;
 type
@@ -556,7 +556,7 @@ procedure dispose_pzval_array(Params: pzval_array);
 var
   _zend_bailout                                   : procedure (filename : zend_pchar; lineno : uint); cdecl;
 
-  zend_alter_ini_entry                            : function(name: zend_pchar; name_length: uint; new_value: zend_pchar; new_value_length: uint; modify_type: Integer; stage: Integer): Integer; cdecl;
+  zend_alter_ini_entry                            : function(name: PAnsiChar; name_length: uint; new_value: PAnsiChar; new_value_length: uint; modify_type: Integer; stage: Integer): Integer; cdecl;
   zend_alter_ini_entry_ex                            : function(name: zend_pchar; name_length: uint; new_value: zend_pchar; new_value_length: uint; modify_type: Integer; stage: Integer; force_change: integer): Integer; cdecl;
 
   zend_restore_ini_entry                          : function(name: zend_pchar; name_length: uint; stage: Integer): Integer; cdecl;
diff --git a/Source/ZendTypes.pas b/Source/ZendTypes.pas
index 9c2b874..a0d2a8e 100644
--- a/Source/ZendTypes.pas
+++ b/Source/ZendTypes.pas
@@ -16,7 +16,7 @@
 interface
 
 uses
-  Windows, SysUtils;
+  {$IFNDEF FPC} Windows {$ELSE} LCLType{$ENDIF}, SysUtils;
 
 const
   //zend.h
diff --git a/Source/php4DelphiD2010.dproj b/Source/php4DelphiD2010.dproj
index d0ed8de..e8ebf40 100644
--- a/Source/php4DelphiD2010.dproj
+++ b/Source/php4DelphiD2010.dproj
@@ -136,7 +136,16 @@
                 <Platform value="Win32">True</Platform>
             </Platforms>
             <Deployment Version="3">
-                <DeployClass Name="ProjectiOSDeviceResourceRules"/>
+                <DeployClass Name="DependencyModule">
+                    <Platform Name="Win32">
+                        <Operation>0</Operation>
+                        <Extensions>.dll;.bpl</Extensions>
+                    </Platform>
+                    <Platform Name="OSX32">
+                        <Operation>1</Operation>
+                        <Extensions>.dylib</Extensions>
+                    </Platform>
+                </DeployClass>
                 <DeployClass Name="ProjectOSXResource">
                     <Platform Name="OSX32">
                         <RemoteDir>Contents\Resources</RemoteDir>
@@ -475,16 +484,7 @@
                         <Operation>1</Operation>
                     </Platform>
                 </DeployClass>
-                <DeployClass Name="DependencyModule">
-                    <Platform Name="Win32">
-                        <Operation>0</Operation>
-                        <Extensions>.dll;.bpl</Extensions>
-                    </Platform>
-                    <Platform Name="OSX32">
-                        <Operation>1</Operation>
-                        <Extensions>.dylib</Extensions>
-                    </Platform>
-                </DeployClass>
+                <DeployClass Name="ProjectiOSDeviceResourceRules"/>
                 <ProjectRoot Platform="iOSDevice64" Name="$(PROJECTNAME).app"/>
                 <ProjectRoot Platform="Win64" Name="$(PROJECTNAME)"/>
                 <ProjectRoot Platform="iOSDevice32" Name="$(PROJECTNAME).app"/>
diff --git a/Source/php4DelphiD2010.identcache b/Source/php4DelphiD2010.identcache
index cb3dd3fa670e67cd3d46bc4ae7aae2ee3727c99a..a7374d782c74209272df63f52365e47f88bf526f 100644
GIT binary patch
diff --git a/Source/php4DelphiD2010.stat b/Source/php4DelphiD2010.stat
index 1d4bad9..04476ee 100644
--- a/Source/php4DelphiD2010.stat
+++ b/Source/php4DelphiD2010.stat
@@ -1,9 +1,9 @@
 [Stats]
-EditorSecs=287
+EditorSecs=235
 DesignerSecs=1
 InspectorSecs=1
-CompileSecs=15416
-OtherSecs=107
+CompileSecs=43212
+OtherSecs=247
 StartTime=04.03.2019 21:55:53
 RealKeys=0
 EffectiveKeys=0
diff --git a/Source/php4DelphiR2010.identcache b/Source/php4DelphiR2010.identcache
index 827b7ad5a3029367083fb6c86853e7d397fec07f..25b123d6abd31477238e8c3faaf37e88fbec9675 100644
GIT binary patch
diff --git a/Source/php4DelphiR2010.stat b/Source/php4DelphiR2010.stat
index a623f2e..02de922 100644
--- a/Source/php4DelphiR2010.stat
+++ b/Source/php4DelphiR2010.stat
@@ -1,9 +1,9 @@
 [Stats]
-EditorSecs=3026
+EditorSecs=4128
 DesignerSecs=1
 InspectorSecs=3
-CompileSecs=87688
-OtherSecs=331
+CompileSecs=112868
+OtherSecs=370
 StartTime=29.07.4016 22:02:01
 RealKeys=0
 EffectiveKeys=0
diff --git a/Source/php4delphi.pas b/Source/php4delphi.pas
index 13baa1c..fb42abc 100644
--- a/Source/php4delphi.pas
+++ b/Source/php4delphi.pas
@@ -197,7 +197,7 @@   TCustomPHPLibrary = class(TPHPComponent)
 
   TPHPEngine = class(TPHPComponent, IUnknown, IPHPEngine)
   private
-    FINIPath : zend_ustr;
+    FINIPath : AnsiString;
     FOnEngineStartup  : TNotifyEvent;
     FOnEngineShutdown : TNotifyEvent;
     FEngineActive     : boolean;
@@ -261,7 +261,7 @@   TPHPEngine = class(TPHPComponent, IUnknown, IPHPEngine)
     property  OnEngineShutdown : TNotifyEvent read FOnEngineShutdown write FOnEngineShutdown;
     property  OnScriptError : TPHPErrorEvent read FOnScriptError write FOnScriptError;
     property  OnLogMessage : TPHPLogMessage read FOnLogMessage write FOnLogMessage;
-    property  IniPath : zend_ustr read FIniPath write FIniPath;
+    property  IniPath : AnsiString read FIniPath write FIniPath;
     {$IFNDEF PHP540}
     property  SafeMode : boolean read FSafeMode write FSafeMode default false;
     property  SafeModeGid : boolean read FSafeModeGid write FSafeModeGid default false;
@@ -1617,8 +1617,7 @@ procedure TPHPEngine.PrepareIniEntry;
        zend_alter_ini_entry('html_errors',        12, '0', 1, ZEND_INI_SYSTEM, ZEND_INI_STAGE_ACTIVATE);
 
   zend_alter_ini_entry('implicit_flush',     15, '1', 1, ZEND_INI_SYSTEM, ZEND_INI_STAGE_ACTIVATE);
-
-  TimeStr := IntToStr(FMaxInputTime);
+ TimeStr := IntToStr(FMaxInputTime);
   zend_alter_ini_entry('max_input_time', 15, zend_pchar(TimeStr), Length(TimeStr), ZEND_INI_SYSTEM, ZEND_INI_STAGE_ACTIVATE);
 end;
 
@@ -1643,7 +1642,7 @@ procedure TPHPEngine.PrepareEngine;
   delphi_sapi_module.register_server_variables := @php_delphi_register_variables;
   delphi_sapi_module.log_message := @php_delphi_log_message;
   if FIniPath <> '' then
-     delphi_sapi_module.php_ini_path_override := zend_pchar(FIniPath)
+     delphi_sapi_module.php_ini_path_override := PAnsiChar(FIniPath)
   else
      delphi_sapi_module.php_ini_path_override :=  nil;
   delphi_sapi_module.block_interruptions := nil;
diff --git a/Source/phpModules.pas b/Source/phpModules.pas
index d7397a8..9943c82 100644
--- a/Source/phpModules.pas
+++ b/Source/phpModules.pas
@@ -16,7 +16,7 @@
 
 interface
  uses
-   SyncObjs, Windows, SysUtils, Types, Classes, VCL.Forms, VCL.Consts,
+   SyncObjs, {$IFNDEF FPC} Windows, {$ELSE} LCLType,LCLIntf,dynlibs,LCLProc,{$ENDIF} SysUtils, Types, Classes, VCL.Forms, VCL.Consts,
    PHPCommon,
    {$IFDEF VERSION6}RTLConsts, Variants,{$ENDIF} ZendAPI, phpAPI,
    phpFunctions,
@@ -464,7 +464,9 @@ procedure DoneVCLApplication;
 begin
   try
    VCL.Forms.Application.OnException := nil;
+   {$IFDEF WINDOWS}
    if VCL.Forms.Application.Handle <> 0 then ShowOwnedPopups(VCL.Forms.Application.Handle, False);
+   {$ELSE}
    VCL.Forms.Application.ShowHint := False;
    VCL.Forms.Application.Destroying;
    VCL.Forms.Application.DestroyComponents;
diff --git a/Source/phpWeb.pas b/Source/phpWeb.pas
index 52ce78d..ac4ab48 100644
--- a/Source/phpWeb.pas
+++ b/Source/phpWeb.pas
@@ -16,7 +16,7 @@
 interface
 
 uses
-  Windows, ToolsAPI, Forms, Dialogs, SysUtils, Graphics, Classes, ShellAPI;
+  {$IFNDEF FPC} Windows{$ELSE} LCLType,LCLIntf,dynlibs,libc{$ENDIF}, ToolsAPI, Forms, Dialogs, SysUtils, Graphics, Classes, ShellAPI;
 
 type
   TphpWebWizard = class(TNotifierObject, IOTAWIzard, IOTAMenuWizard)
diff --git a/Source/zend_dynamic_array.pas b/Source/zend_dynamic_array.pas
index e58c4d8..99eec4d 100644
--- a/Source/zend_dynamic_array.pas
+++ b/Source/zend_dynamic_array.pas
@@ -15,7 +15,7 @@
 
 interface
   uses
-    Windows, SysUtils, ZENDTypes;
+   SysUtils, ZENDTypes;
 
 type
 

From 7fc2d877f1bb0e33685166a5997f2033e145423e Mon Sep 17 00:00:00 2001
From: Andrew Zenin <kashaket@yandex.ua>
Date: Sun, 17 Mar 2019 16:54:27 +0200
Subject: [PATCH 04/35] Update PHP.INC

---
 Source/PHP.INC | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/Source/PHP.INC b/Source/PHP.INC
index 73c7da3..3135465 100644
--- a/Source/PHP.INC
+++ b/Source/PHP.INC
@@ -70,7 +70,7 @@ backward compatibility between PHP versions.
 	{$DEFINE PHP530}
 	{$DEFINE PHP540}
 	{$DEFINE PHP550}
-	{$DEFINE PHP_UNICE}
+	{//$DEFINE PHP_UNICE}
 	{$DEFINE ZEND_WIN32}
 	{$DEFINE PHP_COMPILER_ID}
 {$ENDIF}
@@ -213,3 +213,7 @@ backward compatibility between PHP versions.
 {$J+}
 {$WARNINGS OFF}
 {$ENDIF}
+
+{$IFDEF MSWINDOWS}
+{$DEFINE WINDOWS}
+{$ENDIF}

From a94056c10f257c638e752b88e9c55fec53c4b70e Mon Sep 17 00:00:00 2001
From: Andrew Zenin <kashaket@yandex.ua>
Date: Sun, 17 Mar 2019 16:57:06 +0200
Subject: [PATCH 05/35] Update ZendTypes.pas

---
 Source/ZendTypes.pas | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Source/ZendTypes.pas b/Source/ZendTypes.pas
index a0d2a8e..0053b9f 100644
--- a/Source/ZendTypes.pas
+++ b/Source/ZendTypes.pas
@@ -7,7 +7,7 @@
 { serge_perevoznyk@hotmail.com                          }
 { http://users.telenet.be/ws36637                       }
 {*******************************************************}
-{$I 'PHP.inc'}
+{$I PHP.inc}
 
 { $Id: ZendTypes.pas,v 7.4 10/2009 delphi32 Exp $ }
 

From 007b9704b62a07018a00854c5a44a8eb65097aa7 Mon Sep 17 00:00:00 2001
From: Andrew Zenin <kashaket@yandex.ua>
Date: Tue, 21 May 2019 14:18:05 +0300
Subject: [PATCH 06/35] Small changes

---
 Source/ConverterBackup/php4DelphiR2010.dpk    | 50 +++++++++++++++++++
 .../Delphi Class 2/delphi_class2.dpr          |  2 +-
 .../Extensions/skeleton/skeleton.dpr          |  2 +-
 Source/Demos/Delphi4PHP/DesignIDE/d4pide.dpr  |  2 +-
 .../Delphi Class 2/delphi_class2.dpr          |  2 +-
 Source/Demos/Extensions/skeleton/skeleton.dpr |  2 +-
 Source/PHPProjectWizard.pas                   |  2 +-
 Source/ZendTypes.pas                          |  2 +-
 Source/php4DelphiR2010.lpk                    | 32 ++++++++++++
 9 files changed, 89 insertions(+), 7 deletions(-)
 create mode 100644 Source/ConverterBackup/php4DelphiR2010.dpk
 create mode 100644 Source/php4DelphiR2010.lpk

diff --git a/Source/ConverterBackup/php4DelphiR2010.dpk b/Source/ConverterBackup/php4DelphiR2010.dpk
new file mode 100644
index 0000000..8ffc056
--- /dev/null
+++ b/Source/ConverterBackup/php4DelphiR2010.dpk
@@ -0,0 +1,50 @@
+package php4DelphiR2010;
+
+{$R *.res}
+{$R 'php4delphi.dcr'}
+{$IFDEF IMPLICITBUILDING This IFDEF should not be used by users}
+{$ALIGN 8}
+{$ASSERTIONS ON}
+{$BOOLEVAL OFF}
+{$DEBUGINFO ON}
+{$EXTENDEDSYNTAX ON}
+{$IMPORTEDDATA ON}
+{$IOCHECKS ON}
+{$LOCALSYMBOLS ON}
+{$LONGSTRINGS ON}
+{$OPENSTRINGS ON}
+{$OPTIMIZATION OFF}
+{$OVERFLOWCHECKS OFF}
+{$RANGECHECKS OFF}
+{$REFERENCEINFO ON}
+{$SAFEDIVIDE OFF}
+{$STACKFRAMES ON}
+{$TYPEDADDRESS OFF}
+{$VARSTRINGCHECKS ON}
+{$WRITEABLECONST OFF}
+{$MINENUMSIZE 1}
+{$IMAGEBASE $400000}
+{$DEFINE DEBUG}
+{$ENDIF IMPLICITBUILDING}
+{$DESCRIPTION 'php4Delphi (run-rime)'}
+{$RUNONLY}
+{$IMPLICITBUILD OFF}
+
+requires
+  rtl,
+  vcl;
+
+contains
+  ZENDAPI in 'ZENDAPI.pas',
+  DelphiFunctions in 'DelphiFunctions.pas',
+  php4delphi in 'php4delphi.pas',
+  PHPAPI in 'PHPAPI.pas',
+  phpModules in 'phpModules.pas',
+  PHPLibrary in 'PHPLibrary.pas',
+  PHPFunctions in 'PHPFunctions.pas',
+  PHPTypes in 'PHPTypes.pas',
+  ZENDTypes in 'ZENDTypes.pas',
+  phpClass in 'phpClass.pas',
+  PHPCommon in 'PHPCommon.pas';
+
+end.
diff --git a/Source/Demos Delphi 2009 (WideString support)/Extensions/Delphi Class 2/delphi_class2.dpr b/Source/Demos Delphi 2009 (WideString support)/Extensions/Delphi Class 2/delphi_class2.dpr
index b487c8b..1035333 100644
--- a/Source/Demos Delphi 2009 (WideString support)/Extensions/Delphi Class 2/delphi_class2.dpr	
+++ b/Source/Demos Delphi 2009 (WideString support)/Extensions/Delphi Class 2/delphi_class2.dpr	
@@ -7,7 +7,7 @@
 { http://users.telenet.be/ws36637                       }
 {*******************************************************}
 
-{$I php.inc}
+{$I PHP.INC}
 
 library delphi_class2;
 
diff --git a/Source/Demos Delphi 2009 (WideString support)/Extensions/skeleton/skeleton.dpr b/Source/Demos Delphi 2009 (WideString support)/Extensions/skeleton/skeleton.dpr
index b768421..db76d9f 100644
--- a/Source/Demos Delphi 2009 (WideString support)/Extensions/skeleton/skeleton.dpr	
+++ b/Source/Demos Delphi 2009 (WideString support)/Extensions/skeleton/skeleton.dpr	
@@ -9,7 +9,7 @@
 
 { $Id: skeleton.dpr,v 7.4 10/2009 delphi32 Exp $ }
 
-{$I php.inc}
+{$I PHP.INC}
 
 library skeleton;
 
diff --git a/Source/Demos/Delphi4PHP/DesignIDE/d4pide.dpr b/Source/Demos/Delphi4PHP/DesignIDE/d4pide.dpr
index f8afdd2..aedcde9 100644
--- a/Source/Demos/Delphi4PHP/DesignIDE/d4pide.dpr
+++ b/Source/Demos/Delphi4PHP/DesignIDE/d4pide.dpr
@@ -7,7 +7,7 @@
 { http://users.chello.be/ws36637                        }
 {*******************************************************}
 
-{$I php.inc}
+{$I PHP.INC}
 
 library d4pide;
 
diff --git a/Source/Demos/Extensions/Delphi Class 2/delphi_class2.dpr b/Source/Demos/Extensions/Delphi Class 2/delphi_class2.dpr
index bc1d2d8..6972d25 100644
--- a/Source/Demos/Extensions/Delphi Class 2/delphi_class2.dpr	
+++ b/Source/Demos/Extensions/Delphi Class 2/delphi_class2.dpr	
@@ -7,7 +7,7 @@
 { http://users.chello.be/ws36637                        }
 {*******************************************************}
 
-{$I php.inc}
+{$I PHP.INC}
 
 library delphi_class2;
 
diff --git a/Source/Demos/Extensions/skeleton/skeleton.dpr b/Source/Demos/Extensions/skeleton/skeleton.dpr
index b2c3c91..e951a0c 100644
--- a/Source/Demos/Extensions/skeleton/skeleton.dpr
+++ b/Source/Demos/Extensions/skeleton/skeleton.dpr
@@ -10,7 +10,7 @@
 
 { $Id: skeleton.dpr,v 7.4 10/2009 delphi32 Exp $ }
 
-{$I php.inc}
+{$I PHP.INC}
 
 library skeleton;
 
diff --git a/Source/PHPProjectWizard.pas b/Source/PHPProjectWizard.pas
index 37f4fac..4a281d1 100644
--- a/Source/PHPProjectWizard.pas
+++ b/Source/PHPProjectWizard.pas
@@ -10,7 +10,7 @@
 {$I PHP.INC}
 
 { $Id: PHPProjectWizard.pas,v 7.4 10/2009 delphi32 Exp $ } 
-{$I PHP.inc}
+
 unit PHPProjectWizard;
 
 interface
diff --git a/Source/ZendTypes.pas b/Source/ZendTypes.pas
index 0053b9f..ae23209 100644
--- a/Source/ZendTypes.pas
+++ b/Source/ZendTypes.pas
@@ -7,7 +7,7 @@
 { serge_perevoznyk@hotmail.com                          }
 { http://users.telenet.be/ws36637                       }
 {*******************************************************}
-{$I PHP.inc}
+{$I PHP.INC}
 
 { $Id: ZendTypes.pas,v 7.4 10/2009 delphi32 Exp $ }
 
diff --git a/Source/php4DelphiR2010.lpk b/Source/php4DelphiR2010.lpk
new file mode 100644
index 0000000..15061d0
--- /dev/null
+++ b/Source/php4DelphiR2010.lpk
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<CONFIG>
+  <Package Version="4">
+    <PathDelim Value="\"/>
+    <Name Value="php4DelphiR2010"/>
+    <Type Value="RunAndDesignTime"/>
+    <CompilerOptions>
+      <Version Value="11"/>
+      <PathDelim Value="\"/>
+      <SearchPaths>
+        <UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)\"/>
+      </SearchPaths>
+      <Parsing>
+        <SyntaxOptions>
+          <SyntaxMode Value="delphi"/>
+        </SyntaxOptions>
+      </Parsing>
+    </CompilerOptions>
+    <RequiredPkgs Count="1">
+      <Item1>
+        <PackageName Value="LCL"/>
+      </Item1>
+    </RequiredPkgs>
+    <UsageOptions>
+      <UnitPath Value="$(PkgOutDir)"/>
+    </UsageOptions>
+    <PublishOptions>
+      <Version Value="2"/>
+      <UseFileFilters Value="True"/>
+    </PublishOptions>
+  </Package>
+</CONFIG>

From 9814ac6ce79303e8a394095766068a548dc49ff0 Mon Sep 17 00:00:00 2001
From: Andrew Zenin <kashaket@yandex.ua>
Date: Sun, 26 May 2019 19:30:50 +0300
Subject: [PATCH 07/35] Some php7+ compat steps

---
 Source/AutomaticConversion.log |    1 +
 Source/DelphiFunctions.pas     |   24 +-
 Source/PHP.INC                 |   14 +-
 Source/PHPAPI.pas              |   24 +-
 Source/PHPFunctions.pas        |   50 +-
 Source/PHPTypes.pas            |    6 +-
 Source/ZENDAPI.pas             |  770 +++++---
 Source/ZendTypes.pas           |  182 +-
 Source/hzend_types.pas         | 3024 ++++++++++++++++++++++++++++++++
 Source/php4delphi.pas          |   20 +-
 10 files changed, 3685 insertions(+), 430 deletions(-)
 create mode 100644 Source/AutomaticConversion.log
 create mode 100644 Source/hzend_types.pas

diff --git a/Source/AutomaticConversion.log b/Source/AutomaticConversion.log
new file mode 100644
index 0000000..e660758
--- /dev/null
+++ b/Source/AutomaticConversion.log
@@ -0,0 +1 @@
+ Fatal: Перетворення перервано.
diff --git a/Source/DelphiFunctions.pas b/Source/DelphiFunctions.pas
index 3334287..03283df 100644
--- a/Source/DelphiFunctions.pas
+++ b/Source/DelphiFunctions.pas
@@ -17,7 +17,7 @@ interface
 uses
   SysUtils, Classes,
   Controls,
-  ZendTypes, ZendAPI, PHPTypes, PHPAPI, Dialogs, typinfo,
+  {$IFDEF PHP7} hzend_types, {$ELSE} ZendTypes, {$ENDIF} ZendAPI, PHPTypes, PHPAPI, Dialogs, typinfo,
   Forms, stdctrls;
 
 {$ifdef fpc}
@@ -29,14 +29,17 @@ interface
  author_class_entry   : Tzend_class_entry;
  delphi_object_entry  : TZend_class_entry;
 
- object_functions    : array[0..2] of zend_function_entry;
- author_functions    : array[0..2] of zend_function_entry;
+ object_functions    : {$IFDEF PHP7}HashTable{$ELSE}array[0..2] of zend_function_entry{$ENDIF};
+ author_functions    : {$IFDEF PHP7}HashTable{$ELSE}array[0..2] of zend_function_entry{$ENDIF};
 
  DelphiObject : pzend_class_entry;
  ce           : pzend_class_entry;
-
- {$IFDEF PHP5}
- DelphiObjectHandlers : zend_object_handlers;
+ {$IFDEF PHP7}
+  DelphiObjectHandlers : _zend_object_handlers;
+ {$ELSE}
+   {$IFDEF PHP5}
+   DelphiObjectHandlers : zend_object_handlers;
+   {$ENDIF}
  {$ENDIF}
 
 
@@ -597,7 +600,7 @@ function delphi_call_method(method : zend_pchar; ht : integer; return_value : pz
 
 end;
 
-function delphi_get_method(_object : pzval; method_name : zend_pchar; method_len : integer; TSRMLS_DC : pointer) : PzendFunction; cdecl;
+function delphi_get_method(_object : pzval; method_name : zend_pchar; method_len : integer; TSRMLS_DC : pointer) : {$IFDEF PHP7}P_zend_function{$ELSE}PzendFunction{$ENDIF}; cdecl;
 
 begin
 
@@ -688,6 +691,9 @@ procedure register_delphi_component(ht : integer; return_value : pzval; this_ptr
 procedure RegisterInternalClasses(p : pointer);
 
 begin
+  {$IFDEF PHP7}
+    object_functions
+  {$ELSE}
   object_functions[0].fname := 'delphi_classname';
   object_functions[0].handler := @delphi_object_classname;
 
@@ -698,13 +704,13 @@ procedure RegisterInternalClasses(p : pointer);
   object_functions[2].handler := nil;
 
   INIT_CLASS_ENTRY(delphi_object_entry, 'delphi_class' , @object_functions);
-
+  {$ENDIF}
   {$IFDEF PHP4}
   Delphi_Object_Entry.handle_property_get :=  @_delphi_get_property_wrapper;
   Delphi_Object_Entry.handle_property_set := @delphi_set_property_handler;
   Delphi_Object_Entry.handle_function_call :=  @delphi_call_function;
   {$ELSE}
-  Move(zend_get_std_object_handlers()^, DelphiObjectHandlers, sizeof(zend_object_handlers));
+  Move(zend_get_std_object_handlers()^, DelphiObjectHandlers, sizeof({$IFDEF PHP7}_zend_object_handlers{$ELSE}zend_object_handlers{$ENDIF}));
   DelphiObjectHandlers.read_property := @delphi_get_property_handler;
   DelphiObjecthandlers.write_property := @delphi_set_property_handler;
   DelphiObjectHandlers.call_method := @delphi_call_method;
diff --git a/Source/PHP.INC b/Source/PHP.INC
index 3135465..12e4bf3 100644
--- a/Source/PHP.INC
+++ b/Source/PHP.INC
@@ -19,10 +19,11 @@ If you are using PHP version 5.1.0 or higher please add $DEFINE PHP510
 If you are using PHP version 5.1.1 or higher please add $DEFINE PHP511
 If you are using PHP version 5.1.2 or higher please add $DEFINE PHP512
 If you are using PHP version 5.2.0 or higher please add $DEFINE PHP520
-IF you are using PHP version 5.3.0 or highre please add $DEFINE PHP530
-IF you are using PHP version 5.4.0 or highre please add $DEFINE PHP540
-IF you are using PHP version 5.5.0 or highre please add $DEFINE PHP550
-IF you are using PHP version 5.6.0 or highre please add $DEFINE PHP560
+IF you are using PHP version 5.3.0 or higher please add $DEFINE PHP530
+IF you are using PHP version 5.4.0 or higher please add $DEFINE PHP540
+IF you are using PHP version 5.5.0 or higher please add $DEFINE PHP550
+IF you are using PHP version 5.6.0 or higher please add $DEFINE PHP560
+IF you are using PHP cersion 7.0.0 or higher please add $DEFINE PHP700
 If you are using PHP compiled via:
 id,   define compiler_id
 VC9   COMPILER_VC9
@@ -57,14 +58,17 @@ backward compatibility between PHP versions.
 {$DEFINE PHP540}
 {$DEFINE PHP550}
 {$DEFINE PHP560}
-
 {$IFDEF PHP530}
   {$DEFINE ZEND_WIN32}
   {$DEFINE PHP_COMPILER_ID}
 {$ENDIF}
+{..$DEFINE soulengine_build}
+{..$DEFINE PHP7}
+{..$DEFINE P_CUT}
  {$IFDEF PHP7}
   {$DEFINE COMPILER_VC14}
   {$DEFINE PHP560}
+  {$DEFINE PHP700}
  {$ENDIF}
 {$IFDEF PHP560}
 	{$DEFINE PHP530}
diff --git a/Source/PHPAPI.pas b/Source/PHPAPI.pas
index bc220cd..1a05ab5 100644
--- a/Source/PHPAPI.pas
+++ b/Source/PHPAPI.pas
@@ -29,7 +29,9 @@ interface
  Windows
  {$ENDIF},
 
- ZendTypes, PHPTypes, zendAPI,
+ ZendTypes,
+ {$IFDEF PHP7} hzend_types,{$ENDIF}
+  PHPTypes, zendAPI,
 
 
  {$IFDEF VERSION6}Variants{$ENDIF}{WinSock};
@@ -127,7 +129,7 @@ interface
 
 
 function GetSymbolsTable : PHashTable;
-function GetTrackHash(Name : zend_ustr) : PHashTable;
+function GetTrackHash(Name : zend_ustr) : {$IFDEF PHP7}Pzend_array{$ELSE}PHashTable{$ENDIF};
 function GetSAPIGlobals : Psapi_globals_struct; overload;
 function GetSAPIGlobals(TSRMLS_DC : pointer) : Psapi_globals_struct; overload;
 //procedure phperror(Error : zend_pchar);
@@ -174,9 +176,9 @@ function GetSAPIGlobals(TSRMLS_DC : pointer) : Psapi_globals_struct; overload;
 
 
 
-
+{$IFNDEF P_CUT}
 php_log_err: procedure (err_msg : zend_pchar; TSRMLS_DC : pointer); cdecl;
-
+{$ENDIF}
 php_html_puts: procedure (str : zend_pchar; str_len : integer; TSRMLS_DC : pointer); cdecl;
 
 _php_error_log: function (opt_err : integer; msg : zend_pchar; opt: zend_pchar;  headers: zend_pchar; TSRMLS_DC : pointer) : integer; cdecl;
@@ -357,10 +359,10 @@ function GetSymbolsTable : PHashTable;
 
 {$ENDIF}
 
-function GetTrackHash(Name : zend_ustr) : PHashTable;
+function GetTrackHash(Name : zend_ustr) : {$IFDEF PHP7}Pzend_array{$ELSE}PHashTable{$ENDIF};
 var
  data : ^ppzval;
- arr  : PHashTable;
+ arr  : {$IFDEF PHP7}Pzend_array{$ELSE}PHashTable{$ENDIF};
  ret  : integer;
 begin
  Result := nil;
@@ -375,7 +377,7 @@ function GetTrackHash(Name : zend_ustr) : PHashTable;
     ret := zend_hash_find(arr, zend_pchar(Name), Length(Name)+1, Data);
     if ret = SUCCESS then
      begin
-       Result := data^^^.value.ht;
+       Result := {$IFDEF PHP7}data^^^.value.arr{$ELSE}data^^^.value.ht{$ENDIF};
      end;
   end;
 end;
@@ -427,7 +429,7 @@ function GetSAPIGlobals(TSRMLS_DC : pointer) : Psapi_globals_struct;
 
 function zval2variant(value : zval) : variant;
 begin
-  case Value._type of
+  case {$IFDEF PHP7}Value.u1.v._type{$ELSE}Value._type{$ENDIF} of
    IS_NULL    : Result := NULL;
    IS_LONG    : Result := Value.value.lval;
    IS_DOUBLE  : Result := Value.value.dval;
@@ -756,9 +758,9 @@ function LoadPHP(const DllFileName: zend_ustr = PHPWin) : boolean;
   php_body_write                      := GetProcAddress(PHPLib, 'php_body_write');
 
   php_header_write                    := GetProcAddress(PHPLib, 'php_header_write');
-
+  {$IFNDEF P_CUT}
   php_log_err                         := GetProcAddress(PHPLib, 'php_log_err');
-
+  {$ENDIF}
   php_html_puts                       := GetProcAddress(PHPLib, 'php_html_puts');
 
   _php_error_log                      := GetProcAddress(PHPLib, '_php_error_log');
@@ -845,7 +847,9 @@ procedure CheckPHPErrors;
   if @php_register_variable_safe = nil then raise EPHP4DelphiException.Create('php_register_variable_safe');
   if @php_register_variable_ex = nil then raise EPHP4DelphiException.Create('php_register_variable_ex');
   if @php_strip_tags = nil then raise EPHP4DelphiException.Create('php_strip_tags');
+  {$IFNDEF P_CUT}
   if @php_log_err = nil then raise EPHP4DelphiException.Create('php_log_err');
+  {$ENDIF}
   if @php_html_puts = nil then raise EPHP4DelphiException.Create('php_html_puts');
   if @_php_error_log = nil then raise EPHP4DelphiException.Create('_php_error_log');
   if @php_print_credits = nil then raise EPHP4DelphiException.Create('php_print_credits');
diff --git a/Source/PHPFunctions.pas b/Source/PHPFunctions.pas
index d8071cf..bf35afa 100644
--- a/Source/PHPFunctions.pas
+++ b/Source/PHPFunctions.pas
@@ -22,7 +22,9 @@ interface
    Windows, SysUtils,  Classes,
    {$IFDEF PHP_UNICE}WideStrUtils, {$ENDIF}
    {$IFDEF VERSION6} Variants,
-   {$ENDIF} ZendTypes, PHPTypes, ZendAPI, PHPAPI ;
+   {$ENDIF}
+   {$IFDEF PHP7} hzend_types, {$ENDIF}
+   ZendTypes, PHPTypes, ZendAPI, PHPAPI ;
 
 type
   TParamType = (tpString, tpInteger, tpFloat, tpBoolean, tpArray, tpUnknown);
@@ -175,7 +177,7 @@ function IsParamTypeCorrect(AParamType :  TParamType; z : Pzval) : boolean;
 var
   ZType : integer;
 begin
-  ZType := Z^._type;
+  ZType := {$IFDEF PHP7}Z^.u1.v._type{$ELSE} Z^._type{$ENDIF};
   case AParamType Of
    tpString  : Result := (ztype in [IS_STRING, IS_NULL]);
    tpInteger : Result := (ztype in [IS_LONG, IS_BOOL, IS_NULL, IS_RESOURCE]);
@@ -389,30 +391,16 @@ procedure TFunctionParams.SetItem(Index: Integer; Value: TFunctionParam);
 procedure TFunctionParams.SetItemName(Item: TCollectionItem);
 var
   I, J: Integer;
-  ItemName: string;
   CurItem: TFunctionParam;
 begin
   J := 1;
-  while True do
+  CurItem := ParamByName('Param1');
+  while (CurItem <> nil) and (CurItem <> Item) do
   begin
-    ItemName := Format('Param%d', [J]);
-    I := 0;
-    while I < Count do
-    begin
-      CurItem := Items[I] as TFunctionParam;
-      if (CurItem <> Item) and (CompareText(CurItem.Name, ItemName) = 0) then
-      begin
-        Inc(J);
-        Break;
-      end;
-      Inc(I);
-    end;
-    if I >= Count then
-    begin
-      (Item as TFunctionParam).Name := ItemName;
-      Break;
-    end;
+    inc(J);
+    CurItem := ParamByName('Param' + inttostr(J));
   end;
+  (Item as TFunctionParam).Name := 'Param' + inttostr(J);
 end;
 
 function TFunctionParams.Values(AName: string): Variant;
@@ -522,7 +510,7 @@ function TZendVariable.GetAsBoolean: boolean;
     Exit;
    end;
 
-  case FValue^._type of
+  case{$IFDEF PHP7}FValue^.u1.v._type{$ELSE} FValue^._type{$ENDIF} of
    IS_STRING :
     begin
       if SameText(GetAsString, 'True') then
@@ -545,7 +533,7 @@ function TZendVariable.GetAsDate: TDateTime;
     Exit;
    end;
 
-  case FValue^._type of
+  case{$IFDEF PHP7}FValue^.u1.v._type{$ELSE} FValue^._type{$ENDIF} of
    IS_STRING : Result := StrToDate(GetAsString);
    IS_DOUBLE : Result := FValue^.value.dval;
   else
@@ -561,7 +549,7 @@ function TZendVariable.GetAsDateTime: TDateTime;
     Exit;
    end;
 
-  case FValue^._type of
+  case {$IFDEF PHP7}FValue^.u1.v._type{$ELSE} FValue^._type{$ENDIF} of
    IS_STRING : Result := StrToDateTime(GetAsString);
    IS_DOUBLE : Result := FValue^.value.dval;
   else
@@ -585,7 +573,7 @@ function TZendVariable.GetAsFloat: double;
     Exit;
    end;
 
-  case FValue^._type of
+  case {$IFDEF PHP7}FValue^.u1.v._type{$ELSE} FValue^._type{$ENDIF} of
    IS_STRING : Result := StrToFloatDef(GetAsString,0.0);
    IS_DOUBLE : Result := FValue^.value.dval;
   else
@@ -601,7 +589,7 @@ function TZendVariable.GetAsInteger: integer;
     Exit;
    end;
 
-  case FValue^._type of
+  case {$IFDEF PHP7}FValue^.u1.v._type{$ELSE} FValue^._type{$ENDIF} of
    IS_STRING : result := StrToIntDef(GetAsString, 0);
    IS_DOUBLE : result := Round(FValue^.value.dval);
    IS_NULL   : result := 0;
@@ -621,7 +609,7 @@ function TZendVariable.GetAsString: zend_ustr;
     Exit;
    end;
 
-  case FValue^._type of
+  case {$IFDEF PHP7}FValue^.u1.v._type{$ELSE} FValue^._type{$ENDIF} of
    IS_STRING : begin
                  try
                    SetLength(Result, FValue^.value.str.len);
@@ -654,7 +642,7 @@ function TZendVariable.GetAsTime: TDateTime;
     Exit;
    end;
 
-  case FValue^._type of
+  case {$IFDEF PHP7}FValue^.u1.v._type{$ELSE} FValue^._type{$ENDIF} of
    IS_STRING : Result := StrToTime(GetAsString);
    IS_DOUBLE : Result := FValue^.value.dval;
   else
@@ -681,7 +669,7 @@ function TZendVariable.GetDataType: integer;
     Exit;
    end;
 
-  Result := FValue^._type;
+  Result := {$IFDEF PHP7}FValue^.u1.v._type{$ELSE} FValue^._type{$ENDIF};
 end;
 
 function TZendVariable.GetIsNull: boolean;
@@ -691,7 +679,7 @@ function TZendVariable.GetIsNull: boolean;
     Result := true;
     Exit;
    end;
-  Result := FValue^._type = IS_NULL;
+  Result := {$IFDEF PHP7}FValue^.u1.v._type{$ELSE} FValue^._type{$ENDIF} = IS_NULL;
 end;
 
 function TZendVariable.GetTypeName: string;
@@ -702,7 +690,7 @@ function TZendVariable.GetTypeName: string;
     Exit;
    end;
 
-  case FValue^._type of
+  case {$IFDEF PHP7}FValue^.u1.v._type{$ELSE} FValue^._type{$ENDIF} of
 		IS_NULL:    result :=  'null';
 		IS_LONG:    result := 'integer';
 		IS_DOUBLE:  result := 'double';
diff --git a/Source/PHPTypes.pas b/Source/PHPTypes.pas
index 0f788f4..6b80fd4 100644
--- a/Source/PHPTypes.pas
+++ b/Source/PHPTypes.pas
@@ -16,7 +16,7 @@
 interface
 
 uses
-  {$IFNDEF FPC} Windows{$ELSE} LCLType{$ENDIF}, ZENDTypes;
+  {$IFNDEF FPC} Windows{$ELSE} LCLType{$ENDIF}, {$IFDEF PHP7}hzend_types,{$ENDIF} ZENDTypes;
 
 {$IFDEF PHP4}
 const
@@ -240,7 +240,7 @@ interface
       sapi_started : zend_bool;
       {$IFDEF PHP510}
       global_request_time : longint;
-      known_post_content_types : THashTable;
+      known_post_content_types : {$IFDEF PHP7}HashTable{$ELSE}THashTable{$ENDIF};
       {$ENDIF}
       {$ENDIF}
     end;
@@ -387,7 +387,7 @@ interface
       arg_separator : arg_separators;
       gpc_order : zend_pchar;
       variables_order : zend_pchar;
-      rfc1867_protected_variables : THashTable;
+      rfc1867_protected_variables : {$IFDEF PHP7}HashTable{$ELSE}THashTable{$ENDIF};
       connection_status : Smallint;
       ignore_user_abort : Smallint;
       header_is_being_sent : Byte;
diff --git a/Source/ZENDAPI.pas b/Source/ZENDAPI.pas
index e614614..3702676 100644
--- a/Source/ZENDAPI.pas
+++ b/Source/ZENDAPI.pas
@@ -21,6 +21,7 @@ interface
 
 uses
   {$IFNDEF FPC} Windows{$ELSE} LCLType,LCLIntf,dynlibs,libc{$ENDIF}, SysUtils,
+  {$IFDEF PHP7} hzend_types, {$ENDIF}
   ZendTypes, Variants,
   PHPTypes;
 type
@@ -33,7 +34,7 @@ interface
 PHPWin =
 {$IFDEF PHP_DEBUG}
 {$IFDEF PHP7}
-  'php7phpdbg.dll'
+  'php7ts_debug.dll'
 {$ELSE}
  {$IFDEF PHP5}
   'php5ts_debug.dll'
@@ -144,18 +145,19 @@ function STR_EMPTY_ALLOC : zend_pchar;
     nKeyLength: uint; pData: Pointer; nDataSize: uint; pDest: Pointer;
     flag: Integer): Integer; cdecl;
 {$ELSE}
+{$IFNDEF PHP7}
 var
- _zend_hash_add_or_update : function (ht : PHashTable; arKey : zend_pchar;
+ _zend_hash_add_or_update : function (ht : {$IFDEF PHP7}Pzend_array{$ELSE}PHashTable{$ENDIF}; arKey : zend_pchar;
     nKeyLength : uint; pData : pointer; nDataSize : uint; pDes : pointer;
     flag : integer; __zend_filename: zend_pchar; __zend_lineno: uint) : integer; cdecl;
-
- function zend_hash_add_or_update(ht : PHashTable; arKey : zend_pchar;
-    nKeyLength : uint; pData : pointer; nDataSize : uint; pDes : pointer;
+{$ENDIF}
+ function zend_hash_add_or_update(ht : {$IFDEF PHP7}Pzend_array{$ELSE}PHashTable{$ENDIF}; arKey : zend_pchar;
+    nKeyLength : uint; pData : {$IFDEF PHP7}pzval{$ELSE}pointer{$ENDIF}; nDataSize : uint; pDes : pointer;
     flag : integer) : integer; cdecl;
 
 {$ENDIF}
 
-function zend_hash_add(ht : PHashTable; arKey : zend_pchar; nKeyLength : uint; pData : pointer; nDataSize : uint; pDest : pointer) : integer; cdecl;
+function zend_hash_add(ht : {$IFDEF PHP7}Pzend_array{$ELSE}PHashTable{$ENDIF}; arKey : zend_pchar; nKeyLength : uint; pData : pointer; nDataSize : uint; pDest : pointer) : integer; cdecl;
 
 var
  {$IFDEF PHP4}
@@ -180,21 +182,25 @@ function zend_hash_add(ht : PHashTable; arKey : zend_pchar; nKeyLength : uint; p
 
  {$ELSE}
 
- _zend_hash_init : function (ht : PHashTable; nSize : uint;
+ _zend_hash_init : function (ht : {$IFDEF PHP7}Pzend_array{$ELSE}PHashTable{$ENDIF}; nSize : uint;
    pHashFunction : pointer; pDestructor : pointer; persistent: zend_bool;
    __zend_filename: zend_pchar; __zend_lineno: uint) : integer; cdecl;
- _zend_hash_init_ex : function (ht : PHashTable;  nSize : uint;
+ _zend_hash_init_ex : function (ht : {$IFDEF PHP7}Pzend_array{$ELSE}PHashTable{$ENDIF};  nSize : uint;
    pHashFunction : pointer; pDestructor : pointer;  persistent : zend_bool;
    bApplyProtection : zend_bool; __zend_filename: zend_pchar; __zend_lineno: uint): integer; cdecl;
 
- function zend_hash_init (ht : PHashTable; nSize : uint; pHashFunction : pointer;
+ function zend_hash_init (ht : {$IFDEF PHP7}Pzend_array{$ELSE}PHashTable{$ENDIF}; nSize : uint; pHashFunction : pointer;
    pDestructor : pointer; persistent: zend_bool) : integer; cdecl;
- function zend_hash_init_ex (ht : PHashTable;  nSize : uint; pHashFunction : pointer;
+ function zend_hash_init_ex (ht : {$IFDEF PHP7}Pzend_array{$ELSE}PHashTable{$ENDIF};  nSize : uint; pHashFunction : pointer;
  pDestructor : pointer;  persistent : zend_bool;  bApplyProtection : zend_bool): integer; cdecl;
 
 
 {$ENDIF}
-
+ {$IFDEF PHP7}
+ function zend_hash_num_elements(ht: Pzend_array): integer;
+ function  add_char_to_string  (_result: Pzval; op1: Pzval; op2: Pzval): Integer;
+ function  add_string_to_string(_result: Pzval; op1: Pzval; op2: Pzval): Integer;
+ {$ENDIF}
 var
   zend_hash_destroy                               : procedure(ht: PHashTable); cdecl;
   zend_hash_clean                                 : procedure(ht: PHashTable); cdecl;
@@ -226,77 +232,85 @@ function zend_hash_add(ht : PHashTable; arKey : zend_pchar; nKeyLength : uint; p
    * the standard apply functions do.
    }
 
-  zend_hash_reverse_apply                         : procedure(ht: PHashTable;
+  zend_hash_reverse_apply                         : procedure(ht: {$IFDEF PHP7} Pzend_array {$ELSE} PHashTable{$ENDIF};
     apply_func: pointer; TSRMLS_DC: Pointer); cdecl;
 
   { Deletes }
 
-  zend_hash_del_key_or_index                      : function(ht: PHashTable; arKey: zend_pchar;
+  {$IFDEF PHP7}
+  zend_hash_del_key_or_index                      : function(ht: Pzend_array; key:Pzend_string):longint; cdecl;
+  {$ELSE}
+  zend_hash_del_key_or_index                      : function(ht:  PHashTable; arKey: zend_pchar;
     nKeyLength: uint; h: ulong; flag: Integer): Integer; cdecl;
-
-  zend_get_hash_value                             : function(ht: PHashTable; arKey: zend_pchar;
+  {$ENDIF}
+  zend_get_hash_value                             : function(ht: {$IFDEF PHP7} Pzend_array {$ELSE} PHashTable{$ENDIF}; arKey: zend_pchar;
     nKeyLength: uint): Longint; cdecl;
 
   { Data retreival }
 
-  zend_hash_find                                  : function(ht: PHashTable; arKey: zend_pchar; nKeyLength: uint;
+  zend_hash_find                                  : function(ht: {$IFDEF PHP7} Pzend_array {$ELSE} PHashTable{$ENDIF}; arKey: zend_pchar; nKeyLength: uint;
     pData: Pointer): Integer; cdecl;
 
-  zend_hash_quick_find                            : function(ht: PHashTable; arKey: zend_pchar;
+  zend_hash_quick_find                            : function(ht: {$IFDEF PHP7} Pzend_array {$ELSE} PHashTable{$ENDIF}; arKey: zend_pchar;
     nKeyLength: uint; h: ulong; pData: Pointer): Integer; cdecl;
 
-  zend_hash_index_find                            : function(ht: PHashTable; h: ulong; pData: Pointer): Integer; cdecl;
+  zend_hash_index_find                            : function(ht: {$IFDEF PHP7} Pzend_array {$ELSE} PHashTable{$ENDIF}; h: ulong; pData: Pointer): Integer; cdecl;
 
   { Misc }
 
-  zend_hash_exists                                : function(ht: PHashTable; arKey: zend_pchar; nKeyLength: uint): Integer; cdecl;
-
-  zend_hash_index_exists                          : function(ht: PHashTable; h: ulong): Integer; cdecl;
-
-  zend_hash_next_free_element                     : function(ht: PHashTable): Longint; cdecl;
+  zend_hash_exists                                : function(ht: {$IFDEF PHP7}Pzend_array{$ELSE}PHashTable{$ENDIF}; arKey: zend_pchar; nKeyLength: uint): Integer; cdecl;
 
+  zend_hash_index_exists                          : function(ht: {$IFDEF PHP7}Pzend_array{$ELSE}PHashTable{$ENDIF}; h: ulong): Integer; cdecl;
+  {$IFNDEF PHP7}
+  zend_hash_next_free_element                     : function(ht: {$IFDEF PHP7}Pzend_array{$ELSE}PHashTable{$ENDIF}): Longint; cdecl;
+  {$ENDIF}
   { traversing }
 
-  zend_hash_move_forward_ex                       : function(ht: PHashTable; pos: HashPosition): Integer; cdecl;
+  zend_hash_move_forward_ex                       : function(ht: {$IFDEF PHP7}Pzend_array{$ELSE}PHashTable{$ENDIF}; pos: HashPosition): Integer; cdecl;
 
-  zend_hash_move_backwards_ex                     : function(ht: PHashTable; pos: HashPosition): Integer; cdecl;
+  zend_hash_move_backwards_ex                     : function(ht: {$IFDEF PHP7}Pzend_array{$ELSE}PHashTable{$ENDIF}; pos: HashPosition): Integer; cdecl;
 
-  zend_hash_get_current_key_ex                    : function(ht: PHashTable;
+  zend_hash_get_current_key_ex                    : function(ht: {$IFDEF PHP7}Pzend_array{$ELSE}PHashTable{$ENDIF};
     var str_index: zend_pchar; var str_length: uint; var num_index: ulong;
     duplicate: boolean; pos: HashPosition): Integer; cdecl;
 
-  zend_hash_get_current_key_type_ex               : function(ht: PHashTable; pos: HashPosition): Integer; cdecl;
+  zend_hash_get_current_key_type_ex               : function(ht: {$IFDEF PHP7}Pzend_array{$ELSE}PHashTable{$ENDIF}; pos: HashPosition): Integer; cdecl;
 
-  zend_hash_get_current_data_ex                   : function(ht: PHashTable; pData: Pointer; pos: HashPosition): Integer; cdecl;
+  zend_hash_get_current_data_ex                   : function(ht: {$IFDEF PHP7}Pzend_array{$ELSE}PHashTable{$ENDIF}; pData: Pointer; pos: HashPosition): Integer; cdecl;
 
-  zend_hash_internal_pointer_reset_ex             : procedure(ht: PHashTable; pos: HashPosition); cdecl;
+  zend_hash_internal_pointer_reset_ex             : procedure(ht: {$IFDEF PHP7}Pzend_array{$ELSE}PHashTable{$ENDIF}; pos: HashPosition); cdecl;
 
-  zend_hash_internal_pointer_end_ex               : procedure(ht: PHashTable; pos: HashPosition); cdecl;
+  zend_hash_internal_pointer_end_ex               : procedure(ht: {$IFDEF PHP7}Pzend_array{$ELSE}PHashTable{$ENDIF}; pos: HashPosition); cdecl;
 
   { Copying, merging and sorting }
 
-  zend_hash_copy                                  : procedure(target: PHashTable; source: PHashTable;
+  zend_hash_copy                                  : procedure(target: {$IFDEF PHP7}Pzend_array{$ELSE}PHashTable{$ENDIF}; source: {$IFDEF PHP7}Pzend_array{$ELSE}PHashTable{$ENDIF};
     pCopyConstructor: pointer; tmp: Pointer; size: uint); cdecl;
 
 
-  zend_hash_sort                                  : function(ht: PHashTable; sort_func: pointer;
+  zend_hash_sort                                  :
+  {$IFDEF PHP7}
+  function(ht:PZend_array; sort_func:sort_func_t; compare_func:compare_func_t; renumber:zend_bool):longint; cdecl;
+  {$ELSE}
+   function(ht: PHashTable; sort_func: pointer;
     compare_func: pointer; renumber: Integer; TSRMLS_DC: Pointer): Integer; cdecl;
+  {$ENDIF}
 
-  zend_hash_compare                               : function(ht1: PHashTable; ht2: PHashTable;
+  zend_hash_compare                               : function(ht1: {$IFDEF PHP7}Pzend_array{$ELSE}PHashTable{$ENDIF}; ht2: {$IFDEF PHP7}Pzend_array{$ELSE}PHashTable{$ENDIF};
     compar: pointer; ordered: boolean; TSRMLS_DC: Pointer): Integer; cdecl;
 
-  zend_hash_minmax                                : function(ht: PHashTable; compar: pointer;
+  zend_hash_minmax                                : function(ht: {$IFDEF PHP7}Pzend_array{$ELSE}PHashTable{$ENDIF}; compar: pointer;
     flag: Integer; pData: Pointer; TSRMLS_DC: Pointer): Integer; cdecl;
-
-  zend_hash_num_elements                          : function(ht: PHashTable): Integer; cdecl;
-
-  zend_hash_rehash                                : function(ht: PHashTable): Integer; cdecl;
+  {$IFNDEF PHP7}
+  zend_hash_num_elements                          : function(ht: {$IFDEF PHP7}Pzend_array{$ELSE}PHashTable{$ENDIF}): Integer; cdecl;
+  {$ENDIF}
+  zend_hash_rehash                                : function(ht: {$IFDEF PHP7}Pzend_array{$ELSE}PHashTable{$ENDIF}): Integer; cdecl;
 
   zend_hash_func                                  : function(arKey: zend_pchar; nKeyLength: uint): Longint; cdecl;
 
 
-function zend_hash_get_current_data(ht: PHashTable; pData: Pointer): Integer; cdecl;
-procedure zend_hash_internal_pointer_reset(ht: PHashTable); cdecl;
+function zend_hash_get_current_data(ht: {$IFDEF PHP7} Pzend_array {$ELSE} PHashTable{$ENDIF}; pData: Pointer): Integer; cdecl;
+procedure zend_hash_internal_pointer_reset(ht: {$IFDEF PHP7} Pzend_array {$ELSE} PHashTable{$ENDIF}); cdecl;
 
 
 var
@@ -463,11 +477,11 @@ procedure convert_to_string(op: pzval);
   convert_to_array                                : procedure(op: Pzval); cdecl;
 
   convert_to_object                               : procedure(op: Pzval); cdecl;
-
+  {$IFNDEF PHP7}
   add_char_to_string                              : function(_result: Pzval; op1: Pzval; op2: Pzval): Integer; cdecl;
 
   add_string_to_string                            : function(_result: Pzval; op1: Pzval; op2: Pzval): Integer; cdecl;
-
+  {$ENDIF}
   zend_string_to_double                           : function(number: zend_pchar; length: zend_uint): Double; cdecl;
 
   zval_is_true                                    : function(op: Pzval): Integer; cdecl;
@@ -532,20 +546,22 @@ procedure convert_to_string(op: pzval);
   zend_html_putc                                  : procedure(c: zend_uchar); cdecl;
 
   zend_html_puts                                  : procedure(s: zend_pchar; len: uint; TSRMLS_DC: Pointer); cdecl;
-
+  {$IFDEF PHP7}
+  zend_parse_parameters_throw                     : function(num_args:longint; type_spec:PAnsiChar):longint; cdecl varargs;
+  {$ELSE}
   zend_indent                                     : procedure; cdecl;
-
+  {$ENDIF}
   ZendGetParameters                               : function: integer; cdecl;
   zend_get_params_ex : function(param_count : Integer; Args : {$IFNDEF PHP700} ppzval {$ELSE} pzval{$ENDIF}) :integer; cdecl varargs;
 function zend_get_parameters_ex(number: integer; var Params: pzval_array): integer;
 function zend_get_parameters_my(number: integer; var Params: pzval_array; TSRMLS_DC: Pointer): integer;
 
 function zend_get_parameters(ht: integer; param_count: integer; Params: array of
-{$IFNDEF PHP700} ppzval {$ELSE} pzval{$ENDIF}): integer;
+ppzval): integer;
 
 var
   _zend_get_parameters_array_ex : function(param_count: integer; argument_array:
-  {$IFNDEF PHP700} pppzval {$ELSE} pzval{$ENDIF}; TSRMLS_CC: pointer): integer; cdecl;
+  pppzval; TSRMLS_CC: pointer): integer; cdecl;
 
 procedure dispose_pzval_array(Params: pzval_array);
 
@@ -572,7 +588,7 @@ procedure dispose_pzval_array(Params: pzval_array);
   execute                                         : procedure(op_array: pointer; TSRMLS_DC: Pointer); cdecl;
 
   zend_wrong_param_count                          : procedure(TSRMLS_D: pointer); cdecl;
-  _zend_hash_quick_add_or_update:function(ht: PHashTable; arKey: zend_pchar; nKeyLength: uint; h: uint; out pData: pzval; nDataSize: uint; pDest: PPointer; flag: Integer) : Integer; cdecl;
+  _zend_hash_quick_add_or_update:function(ht: {$IFDEF PHP7}Pzend_array{$ELSE}PHashTable{$ENDIF}; arKey: zend_pchar; nKeyLength: uint; h: uint; out pData: pzval; nDataSize: uint; pDest: PPointer; flag: Integer) : Integer; cdecl;
   {$IFDEF PHP4}
   add_property_long_ex                            : function(arg: pzval; key: zend_pchar; key_len: uint; l: longint): integer; cdecl;
   {$ELSE}
@@ -597,8 +613,10 @@ procedure dispose_pzval_array(Params: pzval_array);
   add_property_zval_ex                            : function(arg: pzval; key: zend_pchar; key_len: uint; value: pzval; TSRMLS_DC: Pointer): integer; cdecl;
   {$ENDIF}
 
-
-  call_user_function : function(function_table: PHashTable; object_pp: pzval;
+  {$IFDEF P_CUT}
+  call_user_function : procedure(func:pzval; argv:pzval; argc:integer);cdecl;
+  {$ELSE}
+   call_user_function : function(function_table: PHashTable; object_pp: pzval;
                          function_name: pzval; return_ptr: pzval; param_count: zend_uint; params: pzval_array_ex;
                           TSRMLS_DC: Pointer): integer; cdecl;
 
@@ -607,8 +625,8 @@ procedure dispose_pzval_array(Params: pzval_array);
                          params: pzval_array;
                          no_separation: zend_uint; symbol_table: PHashTable;
                           TSRMLS_DC: Pointer): integer; cdecl;
-
-{
+  {$ENDIF}
+                          {
 call_user_function_ex(HashTable *function_table,
                       zval **object_pp,
                       zval *function_name,
@@ -748,15 +766,16 @@ procedure ZVAL_ARRAYAS(z: pzval; keynames: Array of AnsiString; keyvals: Array o
 procedure ZVAL_ARRAYAS(z: pzval; keynames: TASDate; keyvals: TASDate);  overload;
 procedure ZVAL_ARRAYWS(z: pzval; keynames: TWSDate; keyvals: TWSDate);  overload;
 procedure ZVAL_ARRAYWS(z: pzval; keynames: array of string; keyvals: array of string); overload;
-procedure HashToArray(HT: PHashTable; var AR: TArrayVariant); overload;
+procedure HashToArray(HT: {$IFDEF PHP7}Pzend_array{$ELSE}PHashTable{$ENDIF}; var AR: TArrayVariant); overload;
 procedure ArrayToHash(AR: Array of Variant; var HT: pzval); overload;
 procedure ArrayToHash(Keys,AR: Array of Variant; var HT: pzval); overload;
 function ToStrA(V: Variant): zend_ustr;
 function ToStr(V: Variant): String;
 function toWChar(s: zend_pchar): PWideChar;
-function ZendToVariant(const Value: {$IFNDEF PHP700} pppzval {$ELSE} pzval{$ENDIF}): Variant; overload;
-function ZendToVariant(const Value: {$IFNDEF PHP700} ppzval {$ELSE} pzval{$ENDIF}): Variant; overload;
-
+{$IFNDEF PHP7}
+function ZendToVariant(const Value: pppzval): Variant; overload;
+function ZendToVariant(const Value: ppzval): Variant; overload;
+{$ENDIF}
 procedure ZVAL_STRING(z: pzval; s: zend_pchar; duplicate: boolean);
 procedure ZVAL_STRINGU(z: pzval; s: PUtf8Char; duplicate: boolean);
 procedure ZVAL_STRINGW(z: pzval; s: PWideChar; duplicate: boolean);
@@ -764,7 +783,8 @@ procedure ZVAL_STRINGW(z: pzval; s: PWideChar; duplicate: boolean);
 procedure ZVAL_STRINGL(z: pzval; s: zend_pchar; l: integer; duplicate: boolean);
 procedure ZVAL_STRINGLW(z: pzval; s: PWideChar; l: integer; duplicate: boolean);
 
-procedure INIT_CLASS_ENTRY(var class_container: Tzend_class_entry; class_name: zend_pchar; functions: pointer);
+procedure INIT_CLASS_ENTRY(var class_container: Tzend_class_entry; class_name: zend_pchar; functions:
+{$IFDEF PHP7}HashTable{$ELSE}pointer{$ENDIF});
 
 
 var
@@ -776,12 +796,12 @@ procedure INIT_CLASS_ENTRY(var class_container: Tzend_class_entry; class_name: z
 
 {$IFDEF PHP5}
   zend_copy_constants: procedure(target: PHashTable; source: PHashTable); cdecl;
-  zend_objects_new : function (_object : pointer; class_type : pointer; TSRMLS_DC : pointer) : _zend_object_value; cdecl;
-  zend_objects_clone_obj: function(_object: pzval; TSRMLS_DC : pointer): _zend_object_value; cdecl;
+  zend_objects_new : function (_object : pointer; class_type : pointer; TSRMLS_DC : pointer) : {$IFDEF PHP7}zend_object{$ELSE}_zend_object_value{$ENDIF}; cdecl;
+  zend_objects_clone_obj: function(_object: pzval; TSRMLS_DC : pointer): {$IFDEF PHP7}zend_object{$ELSE}_zend_object_value{$ENDIF}; cdecl;
   zend_objects_store_add_ref: procedure (_object : pzval; TSRMLS_DC : pointer); cdecl;
   zend_objects_store_del_ref: procedure (_object : pzval; TSRMLS_DC : pointer); cdecl;
 
-  function_add_ref: procedure (func: PZendFunction); cdecl;
+  function_add_ref: procedure (func: {$IFDEF PHP7}Pzend_function{$ELSE}PZendFunction{$ENDIF}); cdecl;
 
   zend_class_add_ref: procedure(aclass: Ppzend_class_entry); cdecl;
 
@@ -830,13 +850,13 @@ function GetCompilerGlobals : Pzend_compiler_globals;
 function GetExecutorGlobals : pzend_executor_globals;
 function GetAllocGlobals : pointer;
 
-function zend_register_functions(functions : pzend_function_entry;  function_table : PHashTable; _type: integer;  TSRMLS_DC : pointer) : integer;
-function zend_unregister_functions(functions : pzend_function_entry; count : integer; function_table : PHashTable; TSRMLS_DC : pointer) : integer;
+function zend_register_functions(functions : {$IFDEF PHP7}P_zend_function_entry{$ELSE}pzend_function_entry{$ENDIF};  function_table :  {$IFDEF PHP7} Pzend_array {$ELSE} PHashTable{$ENDIF}; _type: integer;  TSRMLS_DC : pointer) : integer;
+function zend_unregister_functions(functions : {$IFDEF PHP7}P_zend_function_entry{$ELSE}pzend_function_entry{$ENDIF}; count : integer; function_table :  {$IFDEF PHP7} Pzend_array {$ELSE} PHashTable{$ENDIF}; TSRMLS_DC : pointer) : integer;
 
 {$IFDEF PHP5}
 
 var
-  zend_get_std_object_handlers : function() : pzend_object_handlers;
+  zend_get_std_object_handlers : function() : {$IFDEF PHP7}P_zend_object_handlers{$ELSE}pzend_object_handlers{$ENDIF};
   zend_objects_get_address : function (_object : pzval; TSRMLS_DC : pointer) : pzend_object; cdecl;
   zend_is_true : function(z : pzval) : integer; cdecl;
 
@@ -849,10 +869,10 @@ function Z_STRVAL(z : Pzval) : zend_ustr;
 function Z_STRUVAL(z : PZval): UTF8String;
 function Z_STRWVAL(z : pzval) : String;
 function Z_STRLEN(z : Pzval) : longint;
-function Z_ARRVAL(z : Pzval ) : PHashTable;
+function Z_ARRVAL(z : Pzval ) : {$IFDEF PHP7}Pzend_array{$ELSE}PHashTable{$ENDIF};
 function Z_OBJ_HANDLE(z :Pzval) : zend_object_handle;
-function Z_OBJ_HT(z : Pzval) : pzend_object_handlers;
-function Z_OBJPROP(z : Pzval) : PHashtable;
+function Z_OBJ_HT(z : Pzval) : {$IFDEF PHP7}hzend_types.P_zend_object_handlers{$ELSE}pzend_object_handlers{$ENDIF};
+function Z_OBJPROP(z : Pzval) : {$IFDEF PHP7}hzend_types.PHashTable{$ELSE}PHashTable{$ENDIF};
 function Z_VARREC(z: pzval): TVarRec;
 
  procedure zend_addref_p(z: pzval); cdecl;
@@ -865,11 +885,32 @@ function Z_VARREC(z: pzval): TVarRec;
 implementation
 
 
-function zend_hash_add(ht : PHashTable; arKey : zend_pchar; nKeyLength : uint; pData : pointer; nDataSize : uint; pDest : pointer) : integer; cdecl;
+function zend_hash_add(ht : {$IFDEF PHP7}Pzend_array{$ELSE}PHashTable{$ENDIF}; arKey : zend_pchar; nKeyLength : uint; pData : pointer; nDataSize : uint; pDest : pointer) : integer; cdecl;
 begin
   result := zend_hash_add_or_update(ht, arKey, nKeyLength, pData, nDataSize, pDest, HASH_ADD);
 end;
 
+{$IFDEF PHP7}
+function zend_hash_num_elements(ht: Pzend_array): integer;
+  begin
+    Result := integer(ht.nNumOfElements);
+  end;
+function  add_char_to_string  (_result: Pzval; op1: Pzval; op2: Pzval): Integer;
+Begin
+  Result := -1;
+  if op1.u1.v._type = IS_STRING then
+  begin
+    _result.value.str.len := op1.value.str.len + op2.value.str.len;
+    _result.value.str.val := zend_pchar(zend_ustr(op1.value.str.val) + zend_ustr(op2.value.str.val));
+    Result := SUCCESS;
+  end;
+End;
+function  add_string_to_string(_result: Pzval; op1: Pzval; op2: Pzval): Integer;
+begin
+  Result := add_char_to_string(_result, op1, op2);
+end;
+{$ENDIF}
+
 function STR_EMPTY_ALLOC : zend_pchar;
 begin
   Result := estrndup('', 0);
@@ -942,37 +983,61 @@ procedure REGISTER_MAIN_STRINGL_CONSTANT(name: zend_pchar; str: zend_pchar; len:
 
 procedure ZVAL_RESOURCE(value: pzval; l: longint);
 begin
-  value^._type := IS_RESOURCE;
+  {$IFDEF PHP7}
+  value^.u1.v._type
+  {$ELSE}
+  value^._type
+  {$ENDIF} := IS_RESOURCE;
   value^.value.lval := l;
 end;
 
 procedure ZVAL_BOOL(z: pzval; b: boolean);
 begin
-  z^._type := IS_BOOL;
+  {$IFDEF PHP7}
+  z^.u1.v._type
+  {$ELSE}
+  z^._type
+  {$ENDIF} := IS_BOOL;
   z^.value.lval := integer(b);
 end;
 
 procedure ZVAL_NULL(z: pzval);
 begin
-  z^._type := IS_NULL;
+  {$IFDEF PHP7}
+  z^.u1.v._type
+  {$ELSE}
+  z^._type
+  {$ENDIF}  := IS_NULL;
 end;
 
 procedure ZVAL_LONG(z: pzval; l: longint);
 begin
-  z^._type := IS_LONG;
+  {$IFDEF PHP7}
+  z^.u1.v._type
+  {$ELSE}
+  z^._type
+  {$ENDIF}  := IS_LONG;
   z^.value.lval := l;
 end;
 
 procedure ZVAL_DOUBLE(z: pzval; d: double);
 begin
-  z^._type := IS_DOUBLE;
+  {$IFDEF PHP7}
+  z^.u1.v._type
+  {$ELSE}
+  z^._type
+  {$ENDIF}  := IS_DOUBLE;
   z^.value.dval := d;
 end;
 procedure ZvalString(z:pzval);
 begin
   z^.value.str.len := 0;
   z^.value.str.val := '';
-  z^._type := IS_STRING;
+  {$IFDEF PHP7}
+  z^.u1.v._type
+  {$ELSE}
+  z^._type
+  {$ENDIF}  := IS_STRING;
 end;
 
 procedure ZvalString(z:pzval; s:zend_pchar; len:Integer = 0);
@@ -989,7 +1054,11 @@ procedure ZvalString(z:pzval; s:zend_pchar; len:Integer = 0);
 
     z^.value.str.len := lens;
     z^.value.str.val := estrndup(s, lens);
-    z^._type := IS_STRING;
+    {$IFDEF PHP7}
+    z^.u1.v._type
+    {$ELSE}
+    z^._type
+    {$ENDIF}  := IS_STRING;
   end;
 end;
 
@@ -1044,24 +1113,40 @@ function ZvalStrW;
 
 procedure ZvalVAL(z:pzval; v:Boolean);
 Begin
-  z._type := IS_BOOL;
+  {$IFDEF PHP7}
+  z^.u1.v._type
+  {$ELSE}
+  z^._type
+  {$ENDIF}  := IS_BOOL;
   z.value.lval := integer(v);
 End;
 
 procedure ZvalVAL(z:pzval; v:Integer; const _type:Integer = IS_LONG);
 Begin
-  z._type := _type;
+  {$IFDEF PHP7}
+  z^.u1.v._type
+  {$ELSE}
+  z^._type
+  {$ENDIF}  := _type;
   z.value.lval := v;
 End;
 
 procedure ZvalVAL(z:pzval);
 Begin
-  z._type := IS_NULL;
+  {$IFDEF PHP7}
+  z^.u1.v._type
+  {$ELSE}
+  z^._type
+  {$ENDIF}  := IS_NULL;
 End;
 
 procedure ZvalVAL(z:pzval; v:Double);
 Begin
-  z._type := IS_LONG;
+  {$IFDEF PHP7}
+  z^.u1.v._type
+  {$ELSE}
+  z^._type
+  {$ENDIF} := IS_LONG;
   z.value.dval := v;
 End;
 procedure ZvalVAL(z: pzval; s: zend_ustr; len: Integer = 0);
@@ -1082,7 +1167,11 @@ procedure ZvalVAL(z: pzval; s: zend_ustr; len: Integer = 0);
 
     z^.value.str.len := lens;
     z^.value.str.val := _estrndup(AChar, lens, nil, 0, nil, 0);
-    z^._type := IS_STRING;
+    {$IFDEF PHP7}
+    z^.u1.v._type
+    {$ELSE}
+    z^._type
+    {$ENDIF}  := IS_STRING;
   end;
 end;
 
@@ -1093,7 +1182,11 @@ function AddElementZvalArray(z: pzval; Args: array of const; flag: Integer;
   arKey: zend_pchar;
 begin
   Result := FAILURE;
-  if z._type <> IS_ARRAY then
+  if {$IFDEF PHP7}
+  z^.u1.v._type
+  {$ELSE}
+  z^._type
+  {$ENDIF}  <> IS_ARRAY then
     exit;
 
   if len <> 0 then
@@ -1104,17 +1197,23 @@ function AddElementZvalArray(z: pzval; Args: array of const; flag: Integer;
   end;
 
   tmp := GetArgPZval(Args[0], 1, true);
-  Result := _zend_hash_quick_add_or_update(z.value.ht, arKey, len, idx, tmp,
+
+  Result := _zend_hash_quick_add_or_update(
+  {$IFDEF PHP7}z.value.arr{$ELSE}z.value.ht{$ENDIF}, arKey, len, idx, tmp,
     sizeof(pzval), nil, flag);
 end;
 // Add Next
 function ZvalArrayAdd(z: pzval; Args: array of const): Integer; overload;
 begin
   Result := FAILURE;
-  if z._type <> IS_ARRAY then
+  if {$IFDEF PHP7}
+  z^.u1.v._type
+  {$ELSE}
+  z^._type
+  {$ENDIF} <> IS_ARRAY then
     exit;
   Result := AddElementZvalArray(z, Args, HASH_NEXT_INSERT,
-    z.value.ht.nNextFreeElement);
+    {$IFDEF PHP7} z.value.arr.nNextFreeElement {$ELSE} z.value.ht.nNextFreeElement {$ENDIF});
 end;
 
 // Add Index
@@ -1133,37 +1232,45 @@ function ZvalArrayAdd(z: pzval; key: zend_ustr; Args: array of const)
 
 function IsArrayRetVal(v: pzval): Boolean;
 begin
-  Result := v._type = IS_ARRAY;
+  Result := {$IFDEF PHP7}
+  v^.u1.v._type
+  {$ELSE}
+  v^._type
+  {$ENDIF} = IS_ARRAY;
 end;
 
 function ZValArrayKeyExists(v: pzval; key: zend_ustr): Boolean; overload;
 begin
   Result := false;
-  if v._type <> IS_ARRAY then
+  if {$IFDEF PHP7}
+  v^.u1.v._type
+  {$ELSE}
+  v^._type
+  {$ENDIF} <> IS_ARRAY then
     exit;
 
-  if v.value.ht.nNumOfElements = 0  then
+  if {$IFDEF PHP7} v.value.arr.nNumOfElements {$ELSE} v.value.ht.nNumOfElements {$ENDIF} = 0  then
     exit;
 
-  Result := zend_hash_exists(v.value.ht, zend_pchar(key), Length(key) + 1) = 1;
+  Result := zend_hash_exists({$IFDEF PHP7}v.value.arr{$ELSE}v.value.ht{$ENDIF}, zend_pchar(key), Length(key) + 1) = 1;
 end;
 
 function ZValArrayKeyExists(v: pzval; idx: Integer): Boolean; overload;
 begin
   Result := false;
-  if (v._type <> IS_ARRAY) then
+  if ({$IFDEF PHP7} v.u1.v._type {$ELSE} v._type {$ENDIF} <> IS_ARRAY) then
     exit;
 
-  if v.value.ht.nNumOfElements = 0  then
+  if {$IFDEF PHP7} v.value.arr.nNumOfElements {$ELSE} v.value.ht.nNumOfElements {$ENDIF} = 0  then
     exit;
 
-  Result := zend_hash_index_exists(v.value.ht, idx) = 1;
+  Result := zend_hash_index_exists({$IFDEF PHP7}v.value.arr{$ELSE}v.value.ht{$ENDIF}, idx) = 1;
 end;
 
 function ZValArrayKeyExists(v: pzval; key: zend_ustr; out pData: pzval)
   : Boolean; overload;
 var
-  tmp: {$IFNDEF PHP700} ppzval {$ELSE} pzval{$ENDIF};
+  tmp: ppzval;
 begin
   Result := ZValArrayKeyExists(v, key);
   if Result then
@@ -1177,7 +1284,7 @@ function ZValArrayKeyExists(v: pzval; key: zend_ustr; out pData: pzval)
 function ZValArrayKeyExists(v: pzval; idx: Integer; out pData: pzval)
   : Boolean; overload;
 var
-  tmp: {$IFNDEF PHP700} ppzval {$ELSE} pzval{$ENDIF};
+  tmp: ppzval;
 begin
   Result := ZValArrayKeyExists(v, idx);
   if Result then
@@ -1189,22 +1296,46 @@ function ZValArrayKeyExists(v: pzval; idx: Integer; out pData: pzval)
 end;
 
 function ZValArrayKeyDel(v: pzval; key: zend_ustr): Boolean; overload;
+{$IFDEF PHP7}
+var
+  pzs: pzend_string;
+{$ENDIF}
 begin
   Result := false;
   if ZValArrayKeyExists(v, key) then
+  {$IFDEF PHP7}
+  begin
+  pzs^.len := strlen(zend_pchar(key));
+  pzs^.val := zend_pchar(key);
+  Result := zend_hash_del_key_or_index(v.value.arr, pzs) = SUCCESS
+  end;
+  {$ELSE}
     Result := zend_hash_del_key_or_index(v.value.ht, zend_pchar(key),
       Length(key) + 1, 0, HASH_DEL_KEY) = SUCCESS;
+  {$ENDIF}
 end;
 
 function ZValArrayKeyDel(v: pzval; idx: Integer): Boolean; overload;
+{$IFDEF PHP7}
+var
+  pzs: pzend_string;
+{$ENDIF}
 begin
   Result := false;
   if ZValArrayKeyExists(v, idx) then
-    Result := zend_hash_del_key_or_index(v.value.ht, nil, 0, idx,
+  {$IFDEF PHP7}
+  begin
+  pzs^.len := strlen(zend_pchar(inttostr(idx)));
+  pzs^.val := zend_pchar(inttostr(idx));
+  Result := zend_hash_del_key_or_index(v.value.arr, pzs) = SUCCESS
+  end;
+  {$ELSE}
+    Result := zend_hash_del_key_or_index({$IFDEF PHP7}v.value.arr{$ELSE}v.value.ht{$ENDIF}, nil, 0, idx,
       HASH_DEL_INDEX) = SUCCESS;
+  {$ENDIF}
 end;
 
-function ZValArrayKeyFind(v: pzval; key: zend_ustr; out pData: {$IFNDEF PHP700} ppzval {$ELSE} pzval{$ENDIF})
+function ZValArrayKeyFind(v: pzval; key: zend_ustr; out pData: ppzval)
   : Boolean; overload;
 var
   keyStr: zend_pchar;
@@ -1213,14 +1344,14 @@ function ZValArrayKeyFind(v: pzval; key: zend_ustr; out pData: {$IFNDEF PHP700}
   keyStr := zend_pchar(key);
   KeyLength := Length(key) + 1;
 
-  Result := zend_hash_quick_find(v.value.ht, keyStr, KeyLength,
+  Result := zend_hash_quick_find({$IFDEF PHP7}v.value.arr{$ELSE}v.value.ht{$ENDIF}, keyStr, KeyLength,
     zend_hash_func(keyStr, KeyLength), pData) = SUCCESS;
 end;
 
-function ZValArrayKeyFind(v: pzval; idx: Integer; out pData: {$IFNDEF PHP700} ppzval {$ELSE} pzval{$ENDIF})
+function ZValArrayKeyFind(v: pzval; idx: Integer; out pData: ppzval)
   : Boolean; overload;
 begin
-  Result := zend_hash_quick_find(v.value.ht, nil, 0, idx, pData) = SUCCESS;
+  Result := zend_hash_quick_find({$IFDEF PHP7}v.value.arr{$ELSE}v.value.ht{$ENDIF}, nil, 0, idx, pData) = SUCCESS;
 end;
 procedure MAKE_STD_ZVAL(out Result: pzval);
 begin
@@ -1238,7 +1369,7 @@ function GetArgPZval;
   begin
     if Make then
       MAKE_STD_ZVAL(Result);
-    Result._type := IS_NULL;
+   {$IFDEF PHP7} Result.u1.v._type {$ELSE} Result._type {$ENDIF} := IS_NULL;
   end
   else if Args.VType = vtPointer then
     Result := Args.VPointer
@@ -1293,7 +1424,7 @@ procedure ZVAL_STRINGU(z: pzval; s: PUtf8Char; duplicate: boolean);
    z^.value.str.val := estrndup(__s, z^.value.str.len)
   else
     z^.value.str.val := __s;
-  z^._type := IS_STRING;
+  {$IFDEF PHP7} z^.u1.v._type {$ELSE} z^._type {$ENDIF} := IS_STRING;
 end;
 
 procedure ZVAL_STRING(z: pzval; s: zend_pchar; duplicate: boolean);
@@ -1311,7 +1442,7 @@ procedure ZVAL_STRING(z: pzval; s: zend_pchar; duplicate: boolean);
    z^.value.str.val := estrndup(__s, z^.value.str.len)
   else
     z^.value.str.val := __s;
-  z^._type := IS_STRING;
+  {$IFDEF PHP7} z^.u1.v._type {$ELSE} z^._type {$ENDIF} := IS_STRING;
 end;
 
 procedure ZVAL_STRINGW(z: pzval; s: PWideChar; duplicate: boolean);
@@ -1335,7 +1466,7 @@ procedure ZVAL_STRINGW(z: pzval; s: PWideChar; duplicate: boolean);
    z^.value.str.val := estrndup(__s, z^.value.str.len)
   else
     z^.value.str.val := __s;
-  z^._type := IS_STRING;
+  {$IFDEF PHP7} z^.u1.v._type {$ELSE} z^._type {$ENDIF} := IS_STRING;
 end;
 
 procedure ZVAL_STRINGL(z: pzval; s: zend_pchar; l: integer; duplicate: boolean);
@@ -1353,7 +1484,7 @@ procedure ZVAL_STRINGL(z: pzval; s: zend_pchar; l: integer; duplicate: boolean);
     z^.value.str.val := estrndup(__s, __l)
   else
     z^.value.str.val := __s;
-  z^._type := IS_STRING;
+  {$IFDEF PHP7} z^.u1.v._type {$ELSE} z^._type {$ENDIF} := IS_STRING;
 end;
 
 procedure ZVAL_STRINGLW(z: pzval; s: PWideChar; l: integer; duplicate: boolean);
@@ -1378,7 +1509,7 @@ procedure ZVAL_STRINGLW(z: pzval; s: PWideChar; l: integer; duplicate: boolean);
     z^.value.str.val := estrndup(__s, __l)
   else
     z^.value.str.val := __s;
-  z^._type := IS_STRING;
+  {$IFDEF PHP7} z^.u1.v._type {$ELSE} z^._type {$ENDIF} := IS_STRING;
 end;
 
 procedure ZVAL_EMPTY_STRING(z: pzval);
@@ -1389,18 +1520,18 @@ procedure ZVAL_EMPTY_STRING(z: pzval);
   (*{$ELSE}
   z^.value.str.val := '';
   {$ENDIF}*)
-  z^._type := IS_STRING;
+  {$IFDEF PHP7} z^.u1.v._type {$ELSE} z^._type {$ENDIF} := IS_STRING;
 end;
 
 procedure ZVAL_TRUE(z: pzval);
 begin
-  z^._type := IS_BOOL;
+  {$IFDEF PHP7} z^.u1.v._type {$ELSE} z^._type {$ENDIF} := IS_BOOL;
   z^.value.lval := 1;
 end;
 
 procedure ZVAL_FALSE(z: pzval);
 begin
-  z^._type := IS_BOOL;
+  {$IFDEF PHP7} z^.u1.v._type {$ELSE} z^._type {$ENDIF} := IS_BOOL;
   z^.value.lval := 0;
 end;
 function ToStrA(V: Variant): zend_ustr;
@@ -1428,11 +1559,11 @@ function toWChar(s: zend_pchar): PWideChar;
   Result := PWideChar(ss);
 end;
 
-function ZendToVariant(const Value: {$IFNDEF PHP700} pppzval {$ELSE} pzval{$ENDIF}): Variant; overload;
+function ZendToVariant(const Value: pppzval): Variant; overload;
   Var
   S: String;
 begin
- case Value^^^._type of
+ case {$IFDEF PHP7} Value^^^.u1.v._type {$ELSE}Value^^^._type{$ENDIF} of
  1: Result := Value^^^.value.lval;
  2: Result := Value^^^.value.dval;
  6: begin S := Value^^^.value.str.val; Result := S; end;
@@ -1440,12 +1571,12 @@ function ZendToVariant(const Value: {$IFNDEF PHP700} pppzval {$ELSE} pzval{$ENDI
  end;
 end;
 
-function ZendToVariant(const Value: {$IFNDEF PHP700} ppzval {$ELSE} pzval{$ENDIF}): Variant; overload;
+function ZendToVariant(const Value: ppzval): Variant; overload;
   Var
   S: String;
 begin
 Result := Null;
- case Value^^._type of
+ case {$IFDEF PHP7} Value^^.u1.v._type {$ELSE}Value^^._type{$ENDIF} of
  1: Result := Value^^.value.lval;
  2: Result := Value^^.value.dval;
  6: begin S := Value^^.value.str.val; Result := S; end;
@@ -1453,10 +1584,10 @@ function ZendToVariant(const Value: {$IFNDEF PHP700} ppzval {$ELSE} pzval{$ENDIF
  end;
 end;
 
-procedure HashToArray(HT: PHashTable; var AR: TArrayVariant); overload;
+procedure HashToArray(HT: {$IFDEF PHP7}Pzend_array{$ELSE}PHashTable{$ENDIF}; var AR: TArrayVariant); overload;
   Var
   Len,I: Integer;
-  tmp : {$IFNDEF PHP700} pppzval {$ELSE} pzval{$ENDIF};
+  tmp : pppzval;
 begin
  len := zend_hash_num_elements(HT);
  SetLength(AR,len);
@@ -1588,7 +1719,11 @@ procedure ZVAL_ARRAY(z: pzval; arr:  TWSDate); overload;
 
   if Length(arr) = 0 then
   begin
-    z^.refcount := 1;
+    {$IFDEF PHP7}
+    z^.value.counted.gc.refcount
+    {$ELSE}
+    z^.refcount
+    {$ENDIF} := 1;
     Exit;
   end;
 
@@ -1611,7 +1746,11 @@ procedure ZVAL_ARRAY(z: pzval; arr:  TASDate); overload;
 
   if Length(arr) = 0 then
   begin
-    z^.refcount := 1;
+    {$IFDEF PHP7}
+    z^.value.counted.gc.refcount
+    {$ELSE}
+    z^.refcount
+    {$ENDIF} := 1;
     Exit;
   end;
 
@@ -1634,7 +1773,11 @@ procedure ZVAL_ARRAY(z: pzval; arr: array of string); overload;
 
   if Length(arr) = 0 then
   begin
-    z^.refcount := 1;
+    {$IFDEF PHP7}
+    z^.value.counted.gc.refcount
+    {$ELSE}
+    z^.refcount
+    {$ENDIF} := 1;
     Exit;
   end;
 
@@ -1657,7 +1800,11 @@ procedure ZVAL_ARRAY(z: pzval; arr:  array of zend_ustr); overload;
 
   if Length(arr) = 0 then
   begin
-    z^.refcount := 1;
+    {$IFDEF PHP7}
+    z^.value.counted.gc.refcount
+    {$ELSE}
+    z^.refcount
+    {$ENDIF} := 1;
     Exit;
   end;
 
@@ -1680,7 +1827,11 @@ procedure ZVAL_ARRAY(z: pzval; arr:  array of variant); overload;
 
   if Length(arr) = 0 then
   begin
-    z^.refcount := 1;
+    {$IFDEF PHP7}
+    z^.value.counted.gc.refcount
+    {$ELSE}
+    z^.refcount
+    {$ENDIF} := 1;
     Exit;
   end;
 
@@ -1702,7 +1853,11 @@ procedure ZVAL_ARRAY(z: pzval; arr: System.TArray<System.integer>); overload;
 
   if Length(arr) = 0 then
   begin
-    z^.refcount := 1;
+    {$IFDEF PHP7}
+    z^.value.counted.gc.refcount
+    {$ELSE}
+    z^.refcount
+    {$ENDIF} := 1;
     Exit;
   end;
 
@@ -1716,7 +1871,7 @@ procedure ZVAL_ARRAY(z: pzval; arr: System.TArray<System.integer>); overload;
 procedure ZVAL_ARRAY(z: pzval; arr: Variant); overload;
 var
   i: integer;
-  V: TVarData;
+  {V: TVarData;}
 begin
  if _array_init(z, nil, 0) = FAILURE then //������ ������ ������� ������
   begin
@@ -1794,7 +1949,11 @@ procedure ZVAL_ARRAYAC(z: pzval; keynames: Array of ansichar; keyvals: Array of
 
   if (Length(keynames) = 0)and(Length(keynames) = Length(keyvals)) then
   begin
-    z^.refcount := 1;
+    {$IFDEF PHP7}
+    z^.value.counted.gc.refcount
+    {$ELSE}
+    z^.refcount
+    {$ENDIF} := 1;
     Exit;
   end;
 
@@ -1820,7 +1979,11 @@ procedure ZVAL_ARRAYWC(z: pzval; keynames: Array of PWideChar; keyvals: Array of
 
   if (Length(keynames) = 0)and(Length(keynames) = Length(keyvals)) then
   begin
-    z^.refcount := 1;
+    {$IFDEF PHP7}
+    z^.value.counted.gc.refcount
+    {$ELSE}
+    z^.refcount
+    {$ENDIF} := 1;
     Exit;
   end;
 
@@ -1851,7 +2014,11 @@ procedure ZVAL_ARRAYWS(z: pzval; keynames:  TWSDate; keyvals:  TWSDate); overloa
    //z^.refcount := Length(keynames); //������� ���������� ������������ ��������
   if (Length(keynames) = 0) then
   begin
-    z^.refcount := 1;
+    {$IFDEF PHP7}
+    z^.value.counted.gc.refcount
+    {$ELSE}
+    z^.refcount
+    {$ENDIF} := 1;
     Exit;
   end;
 
@@ -1887,7 +2054,11 @@ procedure ZVAL_ARRAYWS(z: pzval; keynames:  array of string; keyvals:  array of
 
   if (Length(keynames) = 0)and(Length(keynames) = Length(keyvals)) then
   begin
-    z^.refcount := 1;
+    {$IFDEF PHP7}
+    z^.value.counted.gc.refcount
+    {$ELSE}
+    z^.refcount
+    {$ENDIF} := 1;
     Exit;
   end;
 
@@ -1919,7 +2090,11 @@ procedure ZVAL_ARRAYAS(z: pzval; keynames: TASDate; keyvals: TASDate); overload;
 
   if (Length(keynames) = 0)and(Length(keynames) = Length(keyvals)) then
   begin
-    z^.refcount := 1;
+    {$IFDEF PHP7}
+    z^.value.counted.gc.refcount
+    {$ELSE}
+    z^.refcount
+    {$ENDIF} := 1;
     Exit;
   end;
 
@@ -1950,7 +2125,11 @@ procedure ZVAL_ARRAYAS(z: pzval; keynames: Array of AnsiString; keyvals: Array o
 
   if (Length(keynames) = 0)and(Length(keynames) = Length(keyvals)) then
   begin
-    z^.refcount := 1;
+    {$IFDEF PHP7}
+    z^.value.counted.gc.refcount
+    {$ELSE}
+    z^.refcount
+    {$ENDIF} := 1;
     Exit;
   end;
 
@@ -2154,97 +2333,108 @@ function LoadZEND(const DllFilename: zend_ustr = PHPWin) : boolean;
   zend_hash_add_or_update := GetProcAddress(PHPLib, 'zend_hash_add_or_update');
   {$ELSE}
   // -- zend_hash_add_or_update
-  _zend_hash_add_or_update := GetProcAddress(PHPLib, '_zend_hash_add_or_update');
+  _zend_hash_add_or_update := GetProcAddress(PHPLib,
+  {$IFDEF PHP7}'_zend_hash_add_or_update@@16'{$ELSE}'_zend_hash_add_or_update'{$ENDIF});
   {$ENDIF}
 
   // -- zend_hash_destroy
-  zend_hash_destroy := GetProcAddress(PHPLib, 'zend_hash_destroy');
+  zend_hash_destroy := GetProcAddress(PHPLib, {$IFDEF PHP7}'zend_hash_destroy@@4'{$ELSE}'zend_hash_destroy'{$ENDIF});
 
   // -- zend_hash_clean
-  zend_hash_clean := GetProcAddress(PHPLib, 'zend_hash_clean');
+  zend_hash_clean := GetProcAddress(PHPLib, {$IFDEF PHP7}'zend_hash_clean@@4'{$ELSE}'zend_hash_clean'{$ENDIF});
 
   // -- zend_hash_add_empty_element
-  zend_hash_add_empty_element := GetProcAddress(PHPLib, 'zend_hash_add_empty_element');
+  zend_hash_add_empty_element := GetProcAddress(PHPLib, {$IFDEF PHP7}'zend_hash_add_empty_element@@8'{$ELSE}'zend_hash_add_empty_element'{$ENDIF});
 
   // -- zend_hash_graceful_destroy
-  zend_hash_graceful_destroy := GetProcAddress(PHPLib, 'zend_hash_graceful_destroy');
+  zend_hash_graceful_destroy := GetProcAddress(PHPLib, {$IFDEF PHP7}'zend_hash_graceful_destroy@@4'{$ELSE}'zend_hash_graceful_destroy'{$ENDIF});
 
   // -- zend_hash_graceful_reverse_destroy
-  zend_hash_graceful_reverse_destroy := GetProcAddress(PHPLib, 'zend_hash_graceful_reverse_destroy');
+  zend_hash_graceful_reverse_destroy := GetProcAddress(PHPLib, {$IFDEF PHP7}'zend_hash_graceful_reverse_destroy@@4'{$ELSE}'zend_hash_graceful_reverse_destroy'{$ENDIF});
 
   // -- zend_hash_apply
-  zend_hash_apply := GetProcAddress(PHPLib, 'zend_hash_apply');
+  zend_hash_apply := GetProcAddress(PHPLib, {$IFDEF PHP7}'zend_hash_apply@@8'{$ELSE}'zend_hash_apply'{$ENDIF});
 
   // -- zend_hash_apply_with_argument
-  zend_hash_apply_with_argument := GetProcAddress(PHPLib, 'zend_hash_apply_with_argument');
+  zend_hash_apply_with_argument := GetProcAddress(PHPLib, {$IFDEF PHP7}'zend_hash_apply_with_argument@@12'{$ELSE}'zend_hash_apply_with_argument'{$ENDIF});
 
   // -- zend_hash_reverse_apply
-  zend_hash_reverse_apply := GetProcAddress(PHPLib, 'zend_hash_reverse_apply');
+  zend_hash_reverse_apply := GetProcAddress(PHPLib, {$IFDEF PHP7}'zend_hash_reverse_apply@@8'{$ELSE}'zend_hash_reverse_apply'{$ENDIF});
 
   // -- zend_hash_del_key_or_index
-  zend_hash_del_key_or_index := GetProcAddress(PHPLib, 'zend_hash_del_key_or_index');
+  zend_hash_del_key_or_index := GetProcAddress(PHPLib, {$IFDEF PHP7}'zend_hash_del@@8'{$ELSE}'zend_hash_del_key_or_index'{$ENDIF});
 
   // -- zend_get_hash_value
   zend_get_hash_value := GetProcAddress(PHPLib,
   {$IFDEF PHP560}'zend_hash_func'{$ELSE}'zend_get_hash_value'{$ENDIF});
 
   // -- zend_hash_find
-  zend_hash_find := GetProcAddress(PHPLib, 'zend_hash_find');
+  zend_hash_find := GetProcAddress(PHPLib, {$IFDEF PHP7}'zend_hash_find@@8'{$ELSE}'zend_hash_find'{$ENDIF});
 
   // -- zend_hash_quick_find
-  zend_hash_quick_find := GetProcAddress(PHPLib, 'zend_hash_quick_find');
+  zend_hash_quick_find := GetProcAddress(PHPLib, {$IFDEF PHP7}'zend_hash_find@@8'{$ELSE}'zend_hash_quick_find'{$ENDIF});
 
   // -- zend_hash_index_find
-  zend_hash_index_find := GetProcAddress(PHPLib, 'zend_hash_index_find');
+  zend_hash_index_find := GetProcAddress(PHPLib, {$IFDEF PHP7}'zend_hash_index_find@@8'{$ELSE}'zend_hash_index_find'{$ENDIF});
 
   // -- zend_hash_exists
-  zend_hash_exists := GetProcAddress(PHPLib, 'zend_hash_exists');
+  zend_hash_exists := GetProcAddress(PHPLib, {$IFDEF PHP7}'zend_hash_exists@@8'{$ELSE}'zend_hash_exists'{$ENDIF});
 
   // -- zend_hash_index_exists
-  zend_hash_index_exists := GetProcAddress(PHPLib, 'zend_hash_index_exists');
-
+  zend_hash_index_exists := GetProcAddress(PHPLib, {$IFDEF PHP7}'zend_hash_index_exists@@8'{$ELSE}'zend_hash_index_exists'{$ENDIF});
+  {$IFDEF PHP7}
+  _zend_hash_add_or_update := GetProcAddress(PHPLib, '_zend_hash_add_or_update@@16');
+  _zend_hash_add := GetProcAddress(PHPLib, '_zend_hash_add@@12');
+  {$IFDEF P_CUT}
+  zend_hash_index_findZval := GetProcAddress(PHPLib,'zend_hash_index_findZval');
+  zend_symtable_findTest := GetProcAddress(PHPLib,'zend_symtable_findTest');
+  zend_hash_index_existsZval := GetProcAddress(PHPLib,'zend_hash_index_existsZval');
+  {$ENDIF}
+  {$ELSE}
   // -- zend_hash_next_free_element
   zend_hash_next_free_element := GetProcAddress(PHPLib, 'zend_hash_next_free_element');
-
+  {$ENDIF}
   // -- zend_hash_move_forward_ex
-  zend_hash_move_forward_ex := GetProcAddress(PHPLib, 'zend_hash_move_forward_ex');
+  zend_hash_move_forward_ex := GetProcAddress(PHPLib, {$IFDEF PHP7}'zend_hash_move_forward_ex@@8'{$ELSE}'zend_hash_move_forward_ex'{$ENDIF});
 
   // -- zend_hash_move_backwards_ex
-  zend_hash_move_backwards_ex := GetProcAddress(PHPLib, 'zend_hash_move_backwards_ex');
+  zend_hash_move_backwards_ex := GetProcAddress(PHPLib, {$IFDEF PHP7}'zend_hash_move_backwards_ex@@8'{$ELSE}'zend_hash_move_backwards_ex'{$ENDIF});
 
   // -- zend_hash_get_current_key_ex
-  zend_hash_get_current_key_ex := GetProcAddress(PHPLib, 'zend_hash_get_current_key_ex');
+  zend_hash_get_current_key_ex := GetProcAddress(PHPLib, {$IFDEF PHP7}'zend_hash_get_current_key_ex@@16'{$ELSE}'zend_hash_get_current_key_ex'{$ENDIF});
 
   // -- zend_hash_get_current_key_type_ex
-  zend_hash_get_current_key_type_ex := GetProcAddress(PHPLib, 'zend_hash_get_current_key_type_ex');
+  zend_hash_get_current_key_type_ex := GetProcAddress(PHPLib, {$IFDEF PHP7}'zend_hash_get_current_key_type_ex@@8'{$ELSE}'zend_hash_get_current_key_type_ex'{$ENDIF});
 
   // -- zend_hash_get_current_data_ex
-  zend_hash_get_current_data_ex := GetProcAddress(PHPLib, 'zend_hash_get_current_data_ex');
+  zend_hash_get_current_data_ex := GetProcAddress(PHPLib, {$IFDEF PHP7}'zend_hash_get_current_data_ex@@8'{$ELSE}'zend_hash_get_current_data_ex'{$ENDIF});
 
   // -- zend_hash_internal_pointer_reset_ex
-  zend_hash_internal_pointer_reset_ex := GetProcAddress(PHPLib, 'zend_hash_internal_pointer_reset_ex');
+  zend_hash_internal_pointer_reset_ex := GetProcAddress(PHPLib, {$IFDEF PHP7}'zend_hash_internal_pointer_reset_ex@@8'{$ELSE}'zend_hash_internal_pointer_reset_ex'{$ENDIF});
 
   // -- zend_hash_internal_pointer_end_ex
-  zend_hash_internal_pointer_end_ex := GetProcAddress(PHPLib, 'zend_hash_internal_pointer_end_ex');
+  zend_hash_internal_pointer_end_ex := GetProcAddress(PHPLib, {$IFDEF PHP7}'zend_hash_internal_pointer_end_ex@@8'{$ELSE}'zend_hash_internal_pointer_end_ex'{$ENDIF});
 
   // -- zend_hash_copy
-  zend_hash_copy := GetProcAddress(PHPLib, 'zend_hash_copy');
+  zend_hash_copy := GetProcAddress(PHPLib, {$IFDEF PHP7}'zend_hash_copy@@12'{$ELSE}'zend_hash_copy'{$ENDIF});
 
 
   // -- zend_hash_sort
-  zend_hash_sort := GetProcAddress(PHPLib, 'zend_hash_sort');
+  zend_hash_sort := GetProcAddress(PHPLib, {$IFDEF PHP7}'zend_hash_sort_ex@@16'{$ELSE}'zend_hash_sort'{$ENDIF});
 
   // -- zend_hash_compare
   zend_hash_compare := GetProcAddress(PHPLib, 'zend_hash_compare');
 
   // -- zend_hash_minmax
-  zend_hash_minmax := GetProcAddress(PHPLib, 'zend_hash_minmax');
+  zend_hash_minmax := GetProcAddress(PHPLib, {$IFDEF PHP7}'zend_hash_minmax@@12'{$ELSE}'zend_hash_minmax'{$ENDIF});
 
   // -- zend_hash_num_elements
+  {$IFNDEF PHP7}
   zend_hash_num_elements := GetProcAddress(PHPLib, 'zend_hash_num_elements');
+  {$ENDIF}
 
   // -- zend_hash_rehash
-  zend_hash_rehash := GetProcAddress(PHPLib, 'zend_hash_rehash');
+  zend_hash_rehash := GetProcAddress(PHPLib, {$IFDEF PHP7}'zend_hash_rehash@@4'{$ELSE}'zend_hash_rehash'{$ENDIF});
 
   // -- zend_hash_func
   zend_hash_func := GetProcAddress(PHPLib, 'zend_hash_func');
@@ -2299,8 +2489,8 @@ function LoadZEND(const DllFilename: zend_ustr = PHPWin) : boolean;
   _zval_copy_ctor := GetProcAddress(PHPLib, '_zval_copy_ctor');
 
   {$ELSE}
-  _zval_copy_ctor_func := GetProcAddress(PHPLib, '_zval_copy_ctor_func');
-  _zval_dtor_func := GetProcAddress(PHPLib, '_zval_dtor_func');
+  _zval_copy_ctor_func := GetProcAddress(PHPLib, {$IFDEF PHP7}'_zval_copy_ctor_func@@4'{$ELSE}'_zval_copy_ctor_func'{$ENDIF});
+  _zval_dtor_func := GetProcAddress(PHPLib, {$IFDEF PHP7}'_zval_dtor_func@@4'{$ELSE}'_zval_dtor_func'{$ENDIF});
   _zval_ptr_dtor := GetProcAddress(PHPLib, '_zval_ptr_dtor');
 
   {$ENDIF}
@@ -2342,160 +2532,160 @@ function LoadZEND(const DllFilename: zend_ustr = PHPWin) : boolean;
   zend_stack_apply_with_argument := GetProcAddress(PHPLib, 'zend_stack_apply_with_argument');
 
   // -- _convert_to_string
-  _convert_to_string := GetProcAddress(PHPLib, '_convert_to_string');
+  _convert_to_string := GetProcAddress(PHPLib, {$IFDEF PHP7}'_convert_to_string@@4'{$ELSE}'_convert_to_string'{$ENDIF});
 
   // -- add_function
-  add_function := GetProcAddress(PHPLib, 'add_function');
+  add_function := GetProcAddress(PHPLib, {$IFDEF PHP7}'add_function@@12'{$ELSE}'add_function'{$ENDIF});
 
   // -- sub_function
-  sub_function := GetProcAddress(PHPLib, 'sub_function');
+  sub_function := GetProcAddress(PHPLib, {$IFDEF PHP7}'sub_function@@12'{$ELSE}'sub_function'{$ENDIF});
 
   // -- mul_function
-  mul_function := GetProcAddress(PHPLib, 'mul_function');
+  mul_function := GetProcAddress(PHPLib, {$IFDEF PHP7}'mul_function@@12'{$ELSE}'mul_function'{$ENDIF});
 
   // -- div_function
-  div_function := GetProcAddress(PHPLib, 'div_function');
+  div_function := GetProcAddress(PHPLib, {$IFDEF PHP7}'div_function@@12'{$ELSE}'div_function'{$ENDIF});
 
   // -- mod_function
-  mod_function := GetProcAddress(PHPLib, 'mod_function');
+  mod_function := GetProcAddress(PHPLib, {$IFDEF PHP7}'mod_function@@12'{$ELSE}'mod_function'{$ENDIF});
 
   // -- boolean_xor_function
-  boolean_xor_function := GetProcAddress(PHPLib, 'boolean_xor_function');
+  boolean_xor_function := GetProcAddress(PHPLib, {$IFDEF PHP7}'boolean_xor_function@@12'{$ELSE}'boolean_xor_function'{$ENDIF});
 
   // -- boolean_not_function
-  boolean_not_function := GetProcAddress(PHPLib, 'boolean_not_function');
+  boolean_not_function := GetProcAddress(PHPLib, {$IFDEF PHP7}'boolean_not_function@@8'{$ELSE}'boolean_not_function'{$ENDIF});
 
   // -- bitwise_not_function
-  bitwise_not_function := GetProcAddress(PHPLib, 'bitwise_not_function');
+  bitwise_not_function := GetProcAddress(PHPLib, {$IFDEF PHP7}'bitwise_not_function@@8'{$ELSE}'bitwise_not_function'{$ENDIF});
 
   // -- bitwise_or_function
-  bitwise_or_function := GetProcAddress(PHPLib, 'bitwise_or_function');
+  bitwise_or_function := GetProcAddress(PHPLib, {$IFDEF PHP7}'bitwise_or_function@@12'{$ELSE}'bitwise_or_function'{$ENDIF});
 
   // -- bitwise_and_function
-  bitwise_and_function := GetProcAddress(PHPLib, 'bitwise_and_function');
+  bitwise_and_function := GetProcAddress(PHPLib, {$IFDEF PHP7}'bitwise_and_function@@12'{$ELSE}'bitwise_and_function'{$ENDIF});
 
   // -- bitwise_xor_function
-  bitwise_xor_function := GetProcAddress(PHPLib, 'bitwise_xor_function');
+  bitwise_xor_function := GetProcAddress(PHPLib, {$IFDEF PHP7}'bitwise_xor_function@@12'{$ELSE}'bitwise_xor_function'{$ENDIF});
 
   // -- shift_left_function
-  shift_left_function := GetProcAddress(PHPLib, 'shift_left_function');
+  shift_left_function := GetProcAddress(PHPLib, {$IFDEF PHP7}'shift_left_function@@12'{$ELSE}'shift_left_function'{$ENDIF});
 
   // -- shift_right_function
-  shift_right_function := GetProcAddress(PHPLib, 'shift_right_function');
+  shift_right_function := GetProcAddress(PHPLib, {$IFDEF PHP7}'shift_right_function@@12'{$ELSE}'shift_right_function'{$ENDIF});
 
   // -- concat_function
-  concat_function := GetProcAddress(PHPLib, 'concat_function');
+  concat_function := GetProcAddress(PHPLib, {$IFDEF PHP7}'concat_function@@12'{$ELSE}'concat_function'{$ENDIF});
 
   // -- is_equal_function
-  is_equal_function := GetProcAddress(PHPLib, 'is_equal_function');
+  is_equal_function := GetProcAddress(PHPLib, {$IFDEF PHP7}'is_equal_function@@12'{$ELSE}'is_equal_function'{$ENDIF});
 
   // -- is_identical_function
-  is_identical_function := GetProcAddress(PHPLib, 'is_identical_function');
+  is_identical_function := GetProcAddress(PHPLib, {$IFDEF PHP7}'is_identical_function@@12'{$ELSE}'is_identical_function'{$ENDIF});
 
   // -- is_not_identical_function
-  is_not_identical_function := GetProcAddress(PHPLib, 'is_not_identical_function');
+  is_not_identical_function := GetProcAddress(PHPLib, {$IFDEF PHP7}'is_not_identical_function@@12'{$ELSE}'is_not_identical_function'{$ENDIF});
 
   // -- is_not_equal_function
-  is_not_equal_function := GetProcAddress(PHPLib, 'is_not_equal_function');
+  is_not_equal_function := GetProcAddress(PHPLib, {$IFDEF PHP7}'is_not_equal_function@@12'{$ELSE}'is_not_equal_function'{$ENDIF});
 
   // -- is_smaller_function
-  is_smaller_function := GetProcAddress(PHPLib, 'is_smaller_function');
+  is_smaller_function := GetProcAddress(PHPLib, {$IFDEF PHP7}'is_smaller_function@@12'{$ELSE}'is_smaller_function'{$ENDIF});
 
   // -- is_smaller_or_equal_function
-  is_smaller_or_equal_function := GetProcAddress(PHPLib, 'is_smaller_or_equal_function');
+  is_smaller_or_equal_function := GetProcAddress(PHPLib, {$IFDEF PHP7}'is_smaller_or_equal_function@@12'{$ELSE}'is_smaller_or_equal_function'{$ENDIF});
 
   // -- increment_function
-  increment_function := GetProcAddress(PHPLib, 'increment_function');
+  increment_function := GetProcAddress(PHPLib, {$IFDEF PHP7}'increment_function@@4'{$ELSE}'increment_function'{$ENDIF});
 
   // -- decrement_function
-  decrement_function := GetProcAddress(PHPLib, 'decrement_function');
+  decrement_function := GetProcAddress(PHPLib, {$IFDEF PHP7}'decrement_function@@4'{$ELSE}'decrement_function'{$ENDIF});
 
   // -- convert_scalar_to_number
-  convert_scalar_to_number := GetProcAddress(PHPLib, 'convert_scalar_to_number');
+  convert_scalar_to_number := GetProcAddress(PHPLib, {$IFDEF PHP7}'convert_scalar_to_number@@4'{$ELSE}'convert_scalar_to_number'{$ENDIF});
 
   // -- convert_to_long
-  convert_to_long := GetProcAddress(PHPLib, 'convert_to_long');
+  convert_to_long := GetProcAddress(PHPLib, {$IFDEF PHP7}'convert_to_long@@4'{$ELSE}'convert_to_long'{$ENDIF});
 
   // -- convert_to_double
-  convert_to_double := GetProcAddress(PHPLib, 'convert_to_double');
+  convert_to_double := GetProcAddress(PHPLib, {$IFDEF PHP7}'convert_to_double@@4'{$ELSE}'convert_to_double'{$ENDIF});
 
   // -- convert_to_long_base
-  convert_to_long_base := GetProcAddress(PHPLib, 'convert_to_long_base');
+  convert_to_long_base := GetProcAddress(PHPLib, {$IFDEF PHP7}'convert_to_long_base@@8'{$ELSE}'convert_to_long_base'{$ENDIF});
 
   // -- convert_to_null
-  convert_to_null := GetProcAddress(PHPLib, 'convert_to_null');
+  convert_to_null := GetProcAddress(PHPLib, {$IFDEF PHP7}'convert_to_null@@4'{$ELSE}'convert_to_null'{$ENDIF});
 
   // -- convert_to_boolean
-  convert_to_boolean := GetProcAddress(PHPLib, 'convert_to_boolean');
+  convert_to_boolean := GetProcAddress(PHPLib, {$IFDEF PHP7}'convert_to_boolean@@4'{$ELSE}'convert_to_boolean'{$ENDIF});
 
   // -- convert_to_array
-  convert_to_array := GetProcAddress(PHPLib, 'convert_to_array');
+  convert_to_array := GetProcAddress(PHPLib, {$IFDEF PHP7}'convert_to_array@@4'{$ELSE}'convert_to_array'{$ENDIF});
 
   // -- convert_to_object
-  convert_to_object := GetProcAddress(PHPLib, 'convert_to_object');
-
+  convert_to_object := GetProcAddress(PHPLib, {$IFDEF PHP7}'convert_to_object@@4'{$ELSE}'convert_to_object'{$ENDIF});
+  {$IFNDEF PHP7}
   // -- add_char_to_string
   add_char_to_string := GetProcAddress(PHPLib, 'add_char_to_string');
 
   // -- add_string_to_string
   add_string_to_string := GetProcAddress(PHPLib, 'add_string_to_string');
-
+  {$ENDIF}
   // -- zend_string_to_double
-  zend_string_to_double := GetProcAddress(PHPLib, 'zend_string_to_double');
+  zend_string_to_double := GetProcAddress(PHPLib, {$IFDEF PHP7}'zend_strtod'{$ELSE}'zend_string_to_double'{$ENDIF});
 
   // -- zval_is_true
-  zval_is_true := GetProcAddress(PHPLib, 'zval_is_true');
+  zval_is_true := GetProcAddress(PHPLib, {$IFDEF PHP7}'zend_is_true@@4'{$ELSE}'zval_is_true'{$ENDIF});
 
   // -- compare_function
-  compare_function := GetProcAddress(PHPLib, 'compare_function');
+  compare_function := GetProcAddress(PHPLib, {$IFDEF PHP7}'compare_function@@12'{$ELSE}'compare_function'{$ENDIF});
 
   // -- numeric_compare_function
-  numeric_compare_function := GetProcAddress(PHPLib, 'numeric_compare_function');
+  numeric_compare_function := GetProcAddress(PHPLib, {$IFDEF PHP7}'numeric_compare_function@@8'{$ELSE}'numeric_compare_function'{$ENDIF});
 
   // -- string_compare_function
-  string_compare_function := GetProcAddress(PHPLib, 'string_compare_function');
+  string_compare_function := GetProcAddress(PHPLib, {$IFDEF PHP7}'string_compare_function@@8'{$ELSE}'string_compare_function'{$ENDIF});
 
   // -- zend_str_tolower
-  zend_str_tolower := GetProcAddress(PHPLib, 'zend_str_tolower');
+  zend_str_tolower := GetProcAddress(PHPLib, {$IFDEF PHP7}'zend_str_tolower@@8'{$ELSE}'zend_str_tolower'{$ENDIF});
 
   // -- zend_binary_zval_strcmp
-  zend_binary_zval_strcmp := GetProcAddress(PHPLib, 'zend_binary_zval_strcmp');
+  zend_binary_zval_strcmp := GetProcAddress(PHPLib, {$IFDEF PHP7}'zend_binary_zval_strcmp@@8'{$ELSE}'zend_binary_zval_strcmp'{$ENDIF});
 
   // -- zend_binary_zval_strncmp
-  zend_binary_zval_strncmp := GetProcAddress(PHPLib, 'zend_binary_zval_strncmp');
+  zend_binary_zval_strncmp := GetProcAddress(PHPLib, {$IFDEF PHP7}'zend_binary_zval_strncmp@@12'{$ELSE}'zend_binary_zval_strncmp'{$ENDIF});
 
   // -- zend_binary_zval_strcasecmp
-  zend_binary_zval_strcasecmp := GetProcAddress(PHPLib, 'zend_binary_zval_strcasecmp');
+  zend_binary_zval_strcasecmp := GetProcAddress(PHPLib, {$IFDEF PHP7}'zend_binary_zval_strcasecmp@@8'{$ELSE}'zend_binary_zval_strcasecmp'{$ENDIF});
 
   // -- zend_binary_zval_strncasecmp
-  zend_binary_zval_strncasecmp := GetProcAddress(PHPLib, 'zend_binary_zval_strncasecmp');
+  zend_binary_zval_strncasecmp := GetProcAddress(PHPLib, {$IFDEF PHP7}'zend_binary_zval_strncasecmp@@12'{$ELSE}'zend_binary_zval_strncasecmp'{$ENDIF});
 
   // -- zend_binary_strcmp
-  zend_binary_strcmp := GetProcAddress(PHPLib, 'zend_binary_strcmp');
+  zend_binary_strcmp := GetProcAddress(PHPLib, {$IFDEF PHP7}'zend_binary_strcmp@@16'{$ELSE}'zend_binary_strcmp'{$ENDIF});
 
   // -- zend_binary_strncmp
-  zend_binary_strncmp := GetProcAddress(PHPLib, 'zend_binary_strncmp');
+  zend_binary_strncmp := GetProcAddress(PHPLib, {$IFDEF PHP7}'zend_binary_strncmp@@20'{$ELSE}'zend_binary_strncmp'{$ENDIF});
 
   // -- zend_binary_strcasecmp
-  zend_binary_strcasecmp := GetProcAddress(PHPLib, 'zend_binary_strcasecmp');
+  zend_binary_strcasecmp := GetProcAddress(PHPLib, {$IFDEF PHP7}'zend_binary_strcasecmp@@16'{$ELSE}'zend_binary_strcasecmp'{$ENDIF});
 
   // -- zend_binary_strncasecmp
-  zend_binary_strncasecmp := GetProcAddress(PHPLib, 'zend_binary_strncasecmp');
+  zend_binary_strncasecmp := GetProcAddress(PHPLib, {$IFDEF PHP7}'zend_binary_strncasecmp@@20'{$ELSE}'zend_binary_strncasecmp'{$ENDIF});
 
   // -- zendi_smart_strcmp
-  zendi_smart_strcmp := GetProcAddress(PHPLib, 'zendi_smart_strcmp');
+  zendi_smart_strcmp := GetProcAddress(PHPLib, {$IFDEF PHP7}'zendi_smart_strcmp@@8'{$ELSE}'zendi_smart_strcmp'{$ENDIF});
 
   // -- zend_compare_symbol_tables
-  zend_compare_symbol_tables := GetProcAddress(PHPLib, 'zend_compare_symbol_tables');
+  zend_compare_symbol_tables := GetProcAddress(PHPLib, {$IFDEF PHP7}'zend_compare_symbol_tables@@8'{$ELSE}'zend_compare_symbol_tables'{$ENDIF});
 
   // -- zend_compare_arrays
-  zend_compare_arrays := GetProcAddress(PHPLib, 'zend_compare_arrays');
+  zend_compare_arrays := GetProcAddress(PHPLib, {$IFDEF PHP7}'zend_compare_arrays@@8'{$ELSE}'zend_compare_arrays'{$ENDIF});
 
   // -- zend_compare_objects
-  zend_compare_objects := GetProcAddress(PHPLib, 'zend_compare_objects');
+  zend_compare_objects := GetProcAddress(PHPLib, {$IFDEF PHP7}'zend_compare_objects@@8'{$ELSE}'zend_compare_objects'{$ENDIF});
 
   // -- zend_atoi
-  zend_atoi := GetProcAddress(PHPLib, 'zend_atoi');
+  zend_atoi := GetProcAddress(PHPLib, {$IFDEF PHP7}'zend_atoi@@8'{$ELSE}'zend_atoi'{$ENDIF});
 
   // -- get_active_function_name
   get_active_function_name := GetProcAddress(PHPLib, 'get_active_function_name');
@@ -2532,12 +2722,15 @@ function LoadZEND(const DllFilename: zend_ustr = PHPWin) : boolean;
 
   // -- zend_html_puts
   zend_html_puts := GetProcAddress(PHPLib, 'zend_html_puts');
-
+  {$IFDEF PHP7}
+  // -- zend_parse_parameters_throw
+  zend_parse_parameters_throw := GetProcAddress(PHPLib, 'zend_parse_parameters_throw');
+  {$ELSE}
   // -- zend_indent
   zend_indent := GetProcAddress(PHPLib, 'zend_indent');
-
+  {$ENDIF}
   // -- _zend_get_parameters_array_ex
-  _zend_get_parameters_array_ex := GetProcAddress(PHPLib, '_zend_get_parameters_array_ex');
+  _zend_get_parameters_array_ex := GetProcAddress(PHPLib, {$IFDEF PHP7}{$ELSE}{$ENDIF}'_zend_get_parameters_array_ex');
 
   // -- zend_ini_refresh_caches
   zend_ini_refresh_caches := GetProcAddress(PHPLib, 'zend_ini_refresh_caches');
@@ -2593,9 +2786,10 @@ function LoadZEND(const DllFilename: zend_ustr = PHPWin) : boolean;
   // -- add_property_zval_ex
   add_property_zval_ex := GetProcAddress(PHPLib, 'add_property_zval_ex');
 
-  call_user_function := GetProcAddress(PHPLib, 'call_user_function');
+  call_user_function := GetProcAddress(PHPLib, {$IFDEF P_CUT}'__call_function'{$ELSE}'call_user_function'{$ENDIF});
+  {$IFNDEF P_CUT}
   call_user_function_ex := GetProcAddress(PHPLib, 'call_user_function_ex');
-
+  {$ENDIF}
   // -- add_assoc_long_ex
   add_assoc_long_ex := GetProcAddress(PHPLib, 'add_assoc_long_ex');
 
@@ -2750,7 +2944,7 @@ procedure convert_to_string(op: pzval);
   _convert_to_string(op, nil, 0);
 end;
 
-procedure INIT_CLASS_ENTRY(var class_container: Tzend_class_entry; class_name: zend_pchar; functions: pointer);
+procedure INIT_CLASS_ENTRY(var class_container: Tzend_class_entry; class_name: zend_pchar; functions: {$IFDEF PHP7}HashTable{$ELSE}pointer{$ENDIF});
 begin
 
   if class_name = nil then
@@ -2761,12 +2955,19 @@ procedure INIT_CLASS_ENTRY(var class_container: Tzend_class_entry; class_name: z
   {$IFNDEF COMPILER_VC9}
   class_container.name := strdup(class_name);
   {$ELSE}
-  class_container.name := estrdup(class_name);
+  {$IFDEF PHP7}
+      class_container.name.val := estrdup(class_name);
+    {$ELSE}
+      class_container.name := estrdup(class_name);
+    {$ENDIF}
   {$ENDIF}
-
+  {$IFDEF PHP7}
+   class_container.name.len := strlen(class_name);
+   class_container.function_table := functions;
+  {$ELSE}
   class_container.name_length := strlen(class_name);
   class_container.builtin_functions := functions;
-
+  {$ENDIF}
   {$IFDEF PHP4}
   class_container.handle_function_call := nil;
   class_container.handle_property_get := nil;
@@ -2791,19 +2992,26 @@ procedure ALLOC_ZVAL(out Result: pzval);
 {$ENDIF}
 procedure INIT_PZVAL(p: pzval);
 begin
+  {$IFDEF PHP7}
+  p^.value.counted.gc.refcount := 1;
+  {$ELSE}
   p^.refcount := 1;
   p^.is_ref := 0;
+  {$ENDIF}
 end;
 
 procedure LOCK_ZVAL(p: pzval);
 begin
-  Inc(p^.refcount);
+  Inc({$IFDEF PHP7}
+  p^.value.counted.gc.refcount{$ELSE}p^.refcount{$ENDIF});
 end;
 
 procedure UNLOCK_ZVAL(p: pzval);
 begin
-  if p^.refcount > 0 then
-    Dec(p^.refcount);
+  if {$IFDEF PHP7}
+  p^.value.counted.gc.refcount{$ELSE}p^.refcount{$ENDIF} > 0 then
+    Dec({$IFDEF PHP7}
+  p^.value.counted.gc.refcount{$ELSE}p^.refcount{$ENDIF});
 end;
 
 function MAKE_STD_ZVAL: pzval;
@@ -2833,7 +3041,7 @@ function zend_get_parameters_ex(number: integer; var Params: pzval_array): integ
 function zend_get_parameters_my(number: integer; var Params: pzval_array; TSRMLS_DC: Pointer): integer;
 var
   i  : integer;
-  p: {$IFNDEF PHP700} pppzval {$ELSE} pzval{$ENDIF};
+  p: pppzval;
 begin
   SetLength(Params, number);
   if number = 0 then
@@ -2850,9 +3058,9 @@ function zend_get_parameters_my(number: integer; var Params: pzval_array; TSRMLS
 
   for i := 0 to number - 1 do
   begin
-     {$IFNDEF PHP700}Params[i]^ :=  p^^ {$ELSE}Params[i] := p{$ENDIF};
+     Params[i]^ :=  p^^;
      if i <> number then
-         inc(integer({$IFNDEF PHP700}p^{$ELSE}p{$ENDIF}), sizeof({$IFNDEF PHP700} ppzval {$ELSE} pzval{$ENDIF}));
+         inc(integer(p^), sizeof(ppzval));
   end;
 
   efree(p);
@@ -2969,7 +3177,18 @@ procedure CheckZendErrors;
   if @zend_hash_index_find = nil then raise EPHP4DelphiException.Create('zend_hash_index_find');
   if @zend_hash_exists = nil then raise EPHP4DelphiException.Create('zend_hash_exists');
   if @zend_hash_index_exists = nil then raise EPHP4DelphiException.Create('zend_hash_index_exists');
+  {$IFDEF PHP7}
+  if @_zend_hash_add = nil then raise EPHP4DelphiException.Create('_zend_hash_add');
+  if @_zend_hash_add_or_update = nil then raise EPHP4DelphiException.Create('_zend_hash_add_or_update');
+
+  if @zend_hash_index_findZval = nil then raise EPHP4DelphiException.Create('zend_hash_index_findZval');
+  if @zend_symtable_findTest = nil then raise EPHP4DelphiException.Create('zend_symtable_findTest');
+  if @zend_hash_index_existsZval = nil then raise EPHP4DelphiException.Create('zend_hash_index_existsZval');
+
+  {$ENDIF}
+  {$IFNDEF PHP7}
   if @zend_hash_next_free_element = nil then raise EPHP4DelphiException.Create('zend_hash_next_free_element');
+  {$ENDIF}
   if @zend_hash_move_forward_ex = nil then raise EPHP4DelphiException.Create('zend_hash_move_forward_ex');
   if @zend_hash_move_backwards_ex = nil then raise EPHP4DelphiException.Create('zend_hash_move_backwards_ex');
   if @zend_hash_get_current_key_ex = nil then raise EPHP4DelphiException.Create('zend_hash_get_current_key_ex');
@@ -3003,7 +3222,7 @@ procedure CheckZendErrors;
   if @_zval_copy_ctor = nil then raise EPHP4DelphiException.Create('_zval_copy_ctor');
   {$ELSE}
   if @_zval_dtor_func = nil then raise EPHP4DelphiException.Create('_zval_dtor_func');
-  if @_zval_copy_ctor_func = nil then raise EPHP4DelphiException.Create('_zval_ctor_func');
+  if @_zval_copy_ctor_func = nil then raise EPHP4DelphiException.Create('_zval_copy_ctor_func');
  {$ENDIF}
 
   if @zend_print_variable = nil then raise EPHP4DelphiException.Create('zend_print_variable');
@@ -3081,7 +3300,11 @@ procedure CheckZendErrors;
   if @highlight_string = nil then raise EPHP4DelphiException.Create('highlight_string');
   if @zend_html_putc = nil then raise EPHP4DelphiException.Create('zend_html_putc');
   if @zend_html_puts = nil then raise EPHP4DelphiException.Create('zend_html_puts');
+  {$IFDEF PHP7}
+  if @zend_parse_parameters_throw = nil then EPHP4DelphiException.Create('zend_parse_parameters_throw');
+  {$ELSE}
   if @zend_indent = nil then raise EPHP4DelphiException.Create('zend_indent');
+  {$ENDIF}
   if @_zend_get_parameters_array_ex = nil then raise EPHP4DelphiException.Create('_zend_get_parameters_array_ex');
   if @zend_ini_refresh_caches = nil then raise EPHP4DelphiException.Create('zend_ini_refresh_caches');
   if @zend_alter_ini_entry = nil then raise EPHP4DelphiException.Create('zend_alter_ini_entry');
@@ -3101,7 +3324,9 @@ procedure CheckZendErrors;
   if @add_property_stringl_ex = nil then raise EPHP4DelphiException.Create('add_property_stringl_ex');
   if @add_property_zval_ex = nil then raise EPHP4DelphiException.Create('add_property_zval_ex');
   if @call_user_function = nil then raise EPHP4DelphiException.Create('call_user_function');
+  {$IFNDEF P_CUT}
   if @call_user_function_ex = nil then raise EPHP4DelphiException.Create('call_user_function_ex');
+  {$ENDIF}
   if @add_assoc_long_ex = nil then raise EPHP4DelphiException.Create('add_assoc_long_ex');
   if @add_assoc_null_ex = nil then raise EPHP4DelphiException.Create('add_assoc_null_ex');
   if @add_assoc_bool_ex = nil then raise EPHP4DelphiException.Create('add_assoc_bool_ex');
@@ -3147,14 +3372,14 @@ procedure CheckZendErrors;
 end;
 {$ENDIF}
 
-function zend_hash_get_current_data(ht: PHashTable; pData: Pointer): Integer; cdecl;
+function zend_hash_get_current_data(ht:  {$IFDEF PHP7} Pzend_array {$ELSE} PHashTable{$ENDIF}; pData: Pointer): Integer; cdecl;
 begin
-  result := zend_hash_get_current_data_ex(ht, pData, nil);
+  result := zend_hash_get_current_data_ex(ht, pData, cardinal(nil));
 end;
 
-procedure zend_hash_internal_pointer_reset(ht: PHashTable); cdecl;
+procedure zend_hash_internal_pointer_reset(ht:  {$IFDEF PHP7} Pzend_array {$ELSE} PHashTable{$ENDIF}); cdecl;
 begin
-  zend_hash_internal_pointer_reset_ex(ht, nil);
+  zend_hash_internal_pointer_reset_ex(ht, cardinal(nil));
 end;
 
 function ts_resource(id : integer) : pointer;
@@ -3174,10 +3399,13 @@ function zval_copy_ctor(val : pzval) : integer;
 end;
 {$ENDIF}
 
-function zend_unregister_functions(functions : pzend_function_entry; count : integer; function_table : PHashTable; TSRMLS_DC : pointer) : integer;
+function zend_unregister_functions(functions : {$IFDEF PHP7}P_zend_function_entry{$ELSE}pzend_function_entry{$ENDIF}; count : integer; function_table :  {$IFDEF PHP7} Pzend_array {$ELSE} PHashTable{$ENDIF}; TSRMLS_DC : pointer) : integer;
 var
  i : integer;
- ptr : pzend_function_entry;
+ {$IFDEF PHP7}
+ pzs: pzend_string;
+ {$ENDIF}
+ ptr : {$IFDEF PHP7}P_zend_function_entry{$ELSE}pzend_function_entry{$ENDIF};
 begin
   Result := SUCCESS;
   i := 0;
@@ -3188,7 +3416,13 @@ function zend_unregister_functions(functions : pzend_function_entry; count : int
    begin
      if ( count <> -1 ) and (i >= count) then
       break;
+      {$IFDEF PHP7}
+      pzs^.len := strlen(ptr.fname);
+      pzs^.val := ptr.fname;
+      zend_hash_del_key_or_index(function_table, pzs);
+      {$ELSE}
       zend_hash_del_key_or_index(function_table, ptr.fname, strlen(ptr.fname) +1, 0, HASH_DEL_KEY);
+      {$ENDIF}
       inc(ptr);
       inc(i);
    end;
@@ -3196,14 +3430,14 @@ function zend_unregister_functions(functions : pzend_function_entry; count : int
 
 // registers all functions in *library_functions in the function hash
 
-function zend_register_functions(functions : pzend_function_entry;  function_table : PHashTable; _type: integer;  TSRMLS_DC : pointer) : integer;
+function zend_register_functions(functions : {$IFDEF PHP7}P_zend_function_entry{$ELSE}pzend_function_entry{$ENDIF};  function_table :  {$IFDEF PHP7} Pzend_array {$ELSE} PHashTable{$ENDIF}; _type: integer;  TSRMLS_DC : pointer) : integer;
 var
- ptr : pzend_function_entry;
- _function : zend_function;
- internal_function : PzendInternalFunction;
+ ptr : {$IFDEF PHP7}P_zend_function_entry{$ELSE}pzend_function_entry{$ENDIF};
+ _function : {$IFDEF PHP7} _zend_function{$ELSE}zend_function{$ENDIF};
+ internal_function :{$IFDEF PHP7}P_zend_internal_function{$ELSE}PzendInternalFunction{$ENDIF};
   count : integer;
   unload : integer;
-  target_function_table : PHashTable;
+  target_function_table :  {$IFDEF PHP7} Pzend_array {$ELSE} PHashTable{$ENDIF};
   error_type : integer;
 
 begin
@@ -3230,8 +3464,12 @@ function zend_register_functions(functions : pzend_function_entry;  function_tab
   while (ptr.fname <> nil) do
     begin
       internal_function.handler := ptr.handler;
+      {$IFDEF PHP7}
+      internal_function.function_name.val := ptr.fname;
+      {$ELSE}
       internal_function.function_name := ptr.fname;
-      if (internal_function.handler = nil) then begin
+      {$ENDIF}
+      if not Assigned(internal_function.handler) then begin
      	zend_error(error_type, 'Null function defined as active function');
 	zend_unregister_functions(functions, count, target_function_table, TSRMLS_DC);
 	Result := FAILURE;
@@ -3314,7 +3552,7 @@ function GetAllocGlobals : pointer;
 
 procedure zend_addref_p;
 begin
-    Inc(z.refcount);
+    Inc({$IFDEF PHP7}z.value.counted.gc.refcount{$ELSE}z.refcount{$ENDIF});
 end;
 
 procedure my_class_add_ref;
@@ -3355,10 +3593,10 @@ function Z_LVAL(z : pzval) : longint;
       exit;
   end;
 
-  if z._type = IS_LONG then
+  if {$IFDEF PHP7}z.u1.v._type{$ELSE}z._type{$ENDIF} = IS_LONG then
   Result := z.value.lval
   else
-    case z._type of
+    case {$IFDEF PHP7}z.u1.v._type{$ELSE}z._type{$ENDIF} of
        IS_DOUBLE: Result := Trunc(z.value.dval);
        IS_BOOL  : Result := z.value.lval;
        IS_STRING: Result := StrToIntDef( Z_STRVAL(z), 0 );
@@ -3375,10 +3613,10 @@ function Z_BVAL(z : pzval) : boolean;
       exit;
   end;
 
-  if z._type = IS_BOOL then
+  if {$IFDEF PHP7}z.u1.v._type{$ELSE}z._type{$ENDIF} = IS_BOOL then
      Result := zend_bool(z.value.lval)
   else
-    case z._type of
+    case {$IFDEF PHP7}z.u1.v._type{$ELSE}z._type{$ENDIF} of
        IS_DOUBLE: if Trunc(z.value.dval) = 0 then Result := false else Result := true;
        IS_LONG  : if z.value.lval = 0 then Result := false else Result := true;
        IS_STRING: if Z_STRVAL(z) = '' then Result := False else Result := True;
@@ -3396,10 +3634,10 @@ function Z_DVAL(z : pzval) : double;
       exit;
   end;
 
-  if z._type = IS_DOUBLE then
+  if {$IFDEF PHP7}z.u1.v._type{$ELSE}z._type{$ENDIF} = IS_DOUBLE then
      Result := z.value.dval
   else
-    case z._type of
+    case {$IFDEF PHP7}z.u1.v._type{$ELSE}z._type{$ENDIF} of
        IS_LONG, IS_BOOL:  Result := z.value.lval;
        IS_STRING: Result := StrToFloatDef( Z_STRVAL(z), 0 );
        else
@@ -3418,7 +3656,7 @@ function Z_VARREC(z: pzval): TVarRec;
       exit;
   end;
 
-    case z._type of
+    case {$IFDEF PHP7}z.u1.v._type{$ELSE}z._type{$ENDIF} of
         IS_BOOL: begin
             Result.VType := vtBoolean;
             Result.VBoolean := Boolean(z.value.lval);
@@ -3460,12 +3698,12 @@ function Z_STRUVAL(z : pzval) : UTF8String;
       exit;
   end;
 
-  if z._type = IS_STRING then
+  if {$IFDEF PHP7}z.u1.v._type{$ELSE}z._type{$ENDIF} = IS_STRING then
   begin
      SetLength(Result, z.value.str.len);
      Move(z.value.str.val^, Result[1], z.value.str.len);
   end else
-    case z._type of
+    case {$IFDEF PHP7}z.u1.v._type{$ELSE}z._type{$ENDIF} of
        IS_LONG: Result := IntToStr(z.value.lval);
        IS_DOUBLE: Result := FloatToStr(z.value.dval);
        IS_BOOL: if z.value.lval = 0 then Result := '' else Result := '1';
@@ -3482,12 +3720,12 @@ function Z_STRVAL(z : pzval) : zend_ustr;
       exit;
   end;
 
-  if z._type = IS_STRING then
+  if {$IFDEF PHP7}z.u1.v._type{$ELSE}z._type{$ENDIF} = IS_STRING then
   begin
      SetLength(Result, z.value.str.len);
      Move(z.value.str.val^, Result[1], z.value.str.len);
   end else
-    case z._type of
+    case {$IFDEF PHP7}z.u1.v._type{$ELSE}z._type{$ENDIF} of
        IS_LONG: Result := IntToStr(z.value.lval);
        IS_DOUBLE: Result := FloatToStr(z.value.dval);
        IS_BOOL: if z.value.lval = 0 then Result := '' else Result := '1';
@@ -3504,12 +3742,12 @@ function Z_STRWVAL(z : pzval) : String;
       exit;
   end;
 
-  if z._type = IS_STRING then
+  if {$IFDEF PHP7}z.u1.v._type{$ELSE}z._type{$ENDIF} = IS_STRING then
   begin
      SetLength(Result, z.value.str.len);
      Move(z.value.str.val^, Result[1], z.value.str.len);
   end else
-    case z._type of
+    case {$IFDEF PHP7}z.u1.v._type{$ELSE}z._type{$ENDIF} of
        IS_LONG: Result := IntToStr(z.value.lval);
        IS_DOUBLE: Result := FloatToStr(z.value.dval);
        IS_BOOL: if z.value.lval = 0 then Result := '' else Result := '1';
@@ -3523,9 +3761,9 @@ function Z_STRLEN(z : pzval) : longint;
   Result := Length(Z_STRVAL(z));
 end;
 
-function Z_ARRVAL(z : pzval ) : PHashTable;
+function Z_ARRVAL(z : pzval ) : {$IFDEF PHP7}Pzend_array{$ELSE}PHashTable{$ENDIF};
 begin
-  Result := z.value.ht;
+  Result := {$IFDEF PHP7} z.value.arr {$ELSE}z.value.ht{$ENDIF};
 end;
 
 function Z_OBJ_HANDLE(z :pzval) : zend_object_handle;
@@ -3533,18 +3771,24 @@ function Z_OBJ_HANDLE(z :pzval) : zend_object_handle;
   Result := z.value.obj.handle;
 end;
 
-function Z_OBJ_HT(z : pzval) : pzend_object_handlers;
+function Z_OBJ_HT(z : pzval) : {$IFDEF PHP7}hzend_types.P_zend_object_handlers{$ELSE}pzend_object_handlers{$ENDIF};
 begin
   Result := z.value.obj.handlers;
 end;
 
-function Z_OBJPROP(z : pzval) : PHashtable;
+function Z_OBJPROP(z : pzval) : {$IFDEF PHP7}hzend_types.PHashTable{$ELSE}PHashTable{$ENDIF};
+{$IFDEF PHP7}
+begin
+  Result := Z_OBJ_HT(z)^.get_properties(z);
+end;
+{$ELSE}
 var
  TSRMLS_DC : pointer;
 begin
   TSRMLS_DC := ts_resource_ex(0, nil);
   Result := Z_OBJ_HT(z)^.get_properties(@z, TSRMLS_DC);
 end;
+{$ENDIF}
 
 
 {$ENDIF}
@@ -3552,7 +3796,7 @@ function Z_OBJPROP(z : pzval) : PHashtable;
 {$IFDEF PHP5}
 procedure  _zval_copy_ctor (val: pzval; __zend_filename: zend_pchar; __zend_lineno: uint);
 begin
-  if val^._type <= IS_BOOL then
+  if {$IFDEF PHP7}val^.u1.v._type{$ELSE}val^._type{$ENDIF} <= IS_BOOL then
    Exit
     else
       _zval_copy_ctor_func(val, __zend_filename, __zend_lineno);
@@ -3560,28 +3804,38 @@ procedure  _zval_copy_ctor (val: pzval; __zend_filename: zend_pchar; __zend_line
 
 procedure _zval_dtor(val: pzval; __zend_filename: zend_pchar; __zend_lineno: uint);
 begin
-  if val^._type <= IS_BOOL then
+  if {$IFDEF PHP7}val^.u1.v._type{$ELSE}val^._type{$ENDIF} <= IS_BOOL then
    Exit
      else
        _zval_dtor_func(val, __zend_filename, __zend_lineno);
 end;
 
-function zend_hash_init (ht : PHashTable; nSize : uint; pHashFunction : pointer; pDestructor : pointer; persistent: zend_bool) : integer;
+function zend_hash_init (ht : {$IFDEF PHP7}Pzend_array{$ELSE}PHashTable{$ENDIF}; nSize : uint; pHashFunction : pointer; pDestructor : pointer; persistent: zend_bool) : integer;
 begin
   Result := _zend_hash_init(ht, nSize, pHashFunction, pDestructor, persistent, nil, 0);
 end;
 
-function zend_hash_add_or_update(ht : PHashTable; arKey : zend_pchar;
-    nKeyLength : uint; pData : pointer; nDataSize : uint; pDes : pointer;
+function zend_hash_add_or_update(ht : {$IFDEF PHP7}Pzend_array{$ELSE}PHashTable{$ENDIF}; arKey : zend_pchar;
+    nKeyLength : uint; pData : {$IFDEF PHP7}pzval{$ELSE}pointer{$ENDIF}; nDataSize : uint; pDes : pointer;
     flag : integer) : integer;
+{$IFDEF PHP7}
+var pz: Pzend_string;
+{$ENDIF}
 begin
+  {$IFDEF PHP7}
+    pz^.len := strlen(arKey);
+    pz^.val := arKey;
+   if Assigned(_zend_hash_add_or_update) then
+   Result := _zend_hash_add_or_update(ht, pz, pData, flag, '', 0).u2.fe_iter_idx
+  {$ELSE}
   if Assigned(_zend_hash_add_or_update) then
    Result := _zend_hash_add_or_update(ht, arKey, nKeyLength, pData, nDataSize, pDes, flag, nil, 0)
+  {$ENDIF}
      else
        Result := FAILURE;
 end;
 
-function zend_hash_init_ex (ht : PHashTable;  nSize : uint; pHashFunction : pointer;
+function zend_hash_init_ex (ht : {$IFDEF PHP7}Pzend_array{$ELSE}PHashTable{$ENDIF};  nSize : uint; pHashFunction : pointer;
  pDestructor : pointer;  persistent : zend_bool;  bApplyProtection : zend_bool): integer;
 begin
   Result := _zend_hash_init_ex(ht, nSize, pHashFunction, pDestructor, persistent, bApplyProtection, nil, 0);
diff --git a/Source/ZendTypes.pas b/Source/ZendTypes.pas
index ae23209..627b682 100644
--- a/Source/ZendTypes.pas
+++ b/Source/ZendTypes.pas
@@ -16,7 +16,7 @@
 interface
 
 uses
-  {$IFNDEF FPC} Windows {$ELSE} LCLType{$ENDIF}, SysUtils;
+  {$IFNDEF FPC} Windows {$ELSE} LCLType{$ENDIF}, {$IFDEF PHP7} hzend_types, {$ENDIF} SysUtils;
 
 const
   //zend.h
@@ -504,28 +504,32 @@   _zend_refcounted = record
       gc : zend_refcounted_h;
     end;
     zend_refcounted = _zend_refcounted;
-  zend_string = record
+  _zend_string = record
       gc : zend_refcounted_h;
       h : zend_ulong;
       len : size_t;
       val : zend_pchar;
   end;
+
+  P_zend_refcounted = ^_zend_refcounted;
+    zend_string = _zend_string;
+    P_zend_string = ^_zend_string;
   {$ENDIF}
   zend_ushort = word;
   unsigned_char = byte;
 { Common Types }
+{$IFNDEF PHP7}
 type
   pzend_string = {$IFDEF PHP_UNICE}PUTF8Char{$ELSE}PAnsiChar{$ENDIF};
-
+{$ENDIF}
 type
   uint = longword;
   PINT = ^Integer;
   size_t = cardinal;
-  {$IFNDEF PHP700}
+  {$IFNDEF PHP7}
   ppointer = ^pointer;
   pppointer = ^ppointer;
   {$ENDIF}
-
   PStat = ^TStat;
   TStat = record
     st_dev: Word;
@@ -574,7 +578,7 @@   TBucket = record
     pLast: PBucket;
     arKey: array[0..0] of zend_uchar;
   end;
-
+  {$IFNDEF PHP7}
   PHashTable = ^THashTable;
   THashTable =
     record
@@ -591,10 +595,10 @@   TBucket = record
     nApplyCount: Byte;
     bApplyProtection: boolean;
   end;
+  {$ENDIF}
+  HashPosition = {$IFDEF PHP7} cardinal {$ELSE} PBucket {$ENDIF};
 
-  HashPosition = PBucket;
-
-
+  {$IFNDEF PHP7}
   {$IFDEF PHP5}
 
   zend_op_array =
@@ -707,13 +711,12 @@   zend_object_iterator_funcs = record
   move_forward : pointer;
   rewind : pointer;
   end;
-
   zend_object_iterator = record
   data : pointer;
   funcs : PZendObjectIteratorFuncs;
   index : ulong;
   end;
-
+  {$ENDIF}
   zend_class_iterator_funcs = record
   funcs : pointer;
   new_iterator : pointer;
@@ -793,9 +796,10 @@   zend_function = record
     end;
 
   {$ENDIF}
-
+  {$IFNDEF PHP7}
   Pzend_class_entry = ^Tzend_class_entry;
   PPZend_class_entry = ^PZend_class_entry;
+  {$ENDIF}
   {$IFDEF PHP4}
   Tzend_class_entry =
     record
@@ -813,7 +817,7 @@   zend_function = record
     handle_property_set: pointer;
   end;
   {$ELSE}
-
+  {$IFNDEF PHP7}
   Tzend_class_entry = record
    _type : zend_uchar;
    name  : zend_pchar;
@@ -823,35 +827,35 @@   Tzend_class_entry = record
    constants_updated : zend_bool;
    ce_flags : zend_uint;
 
-   function_table : THashTable;
-   default_properties : THashTable;
-   properties_info : THashTable;
-   default_static_members : THashTable;
+   function_table : {$IFDEF PHP7}HashTable{$ELSE}THashTable{$ENDIF};
+   default_properties : {$IFDEF PHP7}HashTable{$ELSE}THashTable{$ENDIF};
+   properties_info : {$IFDEF PHP7}HashTable{$ELSE}THashTable{$ENDIF};
+   default_static_members : {$IFDEF PHP7}HashTable{$ELSE}THashTable{$ENDIF};
 
    static_members : PHashTable;
-   constants_table : THashTable;
+   constants_table : {$IFDEF PHP7}HashTable{$ELSE}THashTable{$ENDIF};
    builtin_functions : pointer;
 
-   _constructor : PZendFunction;
-   _destructor :  PZendFunction;
-   clone : PZendFunction;
-   __get : PZendFunction;
-   __set : PZendFunction;
-   //{$IFDEF PHP510}
-   __unset : PZendFunction;
-   __isset : PZendFunction;
-   //{$ENDIF}
-   __call: PZendFunction;
-   //{$IFDEF PHP530}
-   __callstatic : PZendFunction;
-   //{$ENDIF}
-   //{$IFDEF PHP520}
-   __tostring : pointer;
-   //{$ENDIF}
-   //{$IFDEF PHP510}
-   serialize_func : PZendFunction;
-   unserialize_func : PZendFunction;
-  // {$ENDIF}
+   _constructor : {$IFDEF PHP7}P_zend_function{$ELSE}PZendFunction{$ENDIF};
+   _destructor :  {$IFDEF PHP7}P_zend_function{$ELSE}PZendFunction{$ENDIF};
+   clone : {$IFDEF PHP7}P_zend_function{$ELSE}PZendFunction{$ENDIF};
+   __get : {$IFDEF PHP7}P_zend_function{$ELSE}PZendFunction{$ENDIF};
+   __set : {$IFDEF PHP7}P_zend_function{$ELSE}PZendFunction{$ENDIF};
+   {$IFDEF PHP510}
+   __unset : {$IFDEF PHP7}P_zend_function{$ELSE}PZendFunction{$ENDIF};
+   __isset : {$IFDEF PHP7}P_zend_function{$ELSE}PZendFunction{$ENDIF};
+   {$ENDIF}
+   __call: {$IFDEF PHP7}P_zend_function{$ELSE}PZendFunction{$ENDIF};
+   {$IFDEF PHP530}
+   __callstatic : {$IFDEF PHP7}P_zend_function{$ELSE}PZendFunction{$ENDIF};
+   {$ENDIF}
+   {$IFDEF PHP520}
+   __tostring : {$IFDEF PHP7}P_zend_function{$ELSE}PZendFunction{$ENDIF};
+   {$ENDIF}
+   {$IFDEF PHP510}
+   serialize_func : {$IFDEF PHP7}P_zend_function{$ELSE}PZendFunction{$ENDIF};
+   unserialize_func : {$IFDEF PHP7}P_zend_function{$ELSE}PZendFunction{$ENDIF};
+  {$ENDIF}
    iterator_funcs : zend_class_iterator_funcs;
 
    create_object : pointer;
@@ -875,7 +879,9 @@   Tzend_class_entry = record
    module : pointer;
   end;
   {$ENDIF}
-
+  {$ENDIF}
+  {$IFNDEF PHP7}
+  //P_zend_object_handlers = ^_zend_object_handlers;
   Pzend_Object = ^Tzend_object;
   PPzend_Object = ^PZend_Object;
   _zend_object = record
@@ -894,18 +900,19 @@   _zend_object = record
   {$ENDIF}
   end;
   Tzend_Object = _zend_object;
-
  {$IFDEF PHP5}
+ {$ENDIF}
 
 
  type
 
-   Tzend_object_get_properties = function (_object : pointer; TSRMLS_DC : pointer) : PHashtable; cdecl;
+   Tzend_object_get_properties = function (_object : pointer; TSRMLS_DC : pointer) :{$IFDEF PHP7}Pzend_array{$ELSE}PHashTable{$ENDIF}; cdecl;
    Pzend_object_get_propeeries = ^Tzend_object_get_properties;
 
    Tzend_object_get_classname  = function(_object : pointer; class_name : pointer; class_name_len : pointer; p : integer; TSRMLS_DC : pointer) : integer; cdecl;
 
-   zend_object_handlers = record
+ {$IFNDEF PHP7}
+ zend_object_handlers = record
 	// general object functions
 	add_ref : pointer;
 	del_ref : pointer;
@@ -936,40 +943,23 @@    zend_object_handlers = record
   get_closure : pointer;
   {$ENDIF}
    end;
+   {$ENDIF}
+   zend_object_handle = cardinal;
+  {$IFNDEF PHP7}
   pzend_object_handlers = ^zend_object_handlers;
 
-  zend_object_handle = cardinal;
+
   _zend_object_value = record
    handle : zend_object_handle;
    handlers : pzend_object_handlers;
   end;
   TZendObjectValue = _zend_object_value;
   PZendObjectValue = ^TZendObjectValue;
+  {$ENDIF}
  {$ENDIF}
 
-  Pzvalue_value = ^zvalue_value;
-  {$IFDEF PHP7}
-   zvalue_value = Packed  record
-      case longint of
-        0 : ( lval : zend_long );
-        1 : ( dval : double );
-        2 : ( counted : P_zend_refcounted );
-        3 : ( str : Pzend_string );
-        4 : ( arr : Pzend_array );
-        5 : ( obj : Pzend_object );
-        6 : ( res : Pzend_resource );
-        7 : ( ref : P_zend_reference );
-        8 : ( ast : P_zend_ast_ref );
-        9 : ( zv : Pzval );
-        10 : ( ptr : pointer );
-        11 : ( ce : P_zend_class_entry );
-        12 : ( func : P_zend_function );
-        13 : ( ww : Packed record
-            w1 : cardinal;
-            w2 : cardinal;
-          end );
-      end;
-  {$ELSE}
+{$IFNDEF PHP7}
+Pzvalue_value = ^zvalue_value;
   zvalue_value = record
     case longint of
       0: (lval: zend_long);
@@ -985,12 +975,8 @@   zvalue_value = record
       4 : (obj :  _zend_object_value);
       {$ENDIF}
   end;
-  {$ENDIF}
-  {$IFNDEF PHP700}
   pppzval = ^ppzval;
   ppzval = ^pzval;
-  {$ENDIF}
-
  {$IFDEF PHP4}
   Pzval = ^zval;
   zval = record
@@ -1001,33 +987,8 @@   zval = record
   end;
   Tzval = zval;
  {$ELSE}
+
   pzval = ^zval;
-  {$IFDEF PHP7}
-    _zval_struct = Packed  record
-      value : zend_value;
-      u1 : Packed  record
-          case longint of
-            0 : ( v : record
-                _type : zend_uchar;
-                type_flags : zend_uchar;
-                const_flags : zend_uchar;
-                reserved : zend_uchar;
-              end );
-            1 : ( type_info : cardinal );
-          end;
-      u2 :  Packed  record
-          case longint of
-            0 : ( var_flags : LongWord );
-            1 : ( next : cardinal );
-            2 : ( cache_slot : cardinal );
-            3 : ( lineno : cardinal );
-            4 : ( num_args : cardinal );
-            5 : ( fe_pos : cardinal );
-            6 : ( fe_iter_idx : cardinal );
-          end;
-    end;
-    zval = _zval_struct;
-  {$ENDIF}
   zval = record
    value : zvalue_value;
    refcount : zend_uint;
@@ -1035,9 +996,10 @@   zval = record
    is_ref : byte;
   end;
  {$ENDIF}
+{$ENDIF}
 
   ppzval_array = ^pzval_array;
-  pzval_array = array of {$IFNDEF PHP700} ppzval{$ELSE} pzval{$ENDIF};
+  pzval_array = array of ppzval;
   pzval_array_ex = array of pzval;
 
 
@@ -1213,6 +1175,7 @@    _zend_arg_info = record
    PZendArgInfo = ^TZendArgInfo;
   {$ENDIF}
 
+ {$IFNDEF PHP7}
   Pzend_function_entry = ^Tzend_function_entry;
   zend_function_entry = record
     fname: zend_pchar;
@@ -1239,6 +1202,7 @@   _zend_function_entry = record
     num_args  : uint;
     flags     : uint;
   end;
+  {$ENDIF}
   Pzend_module_entry = ^Tzend_module_entry;
   p_zend_module_entry = ^_zend_module_entry;
   _zend_module_entry = record
@@ -1445,12 +1409,12 @@  zend_compiler_globals  = record
 
     active_op_array : pointer;
 
-    function_table : PHashTable; // function symbol table
-    class_table : PHashTable;    // class table
+    function_table :  {$IFDEF PHP7} Pzend_array {$ELSE} PHashTable{$ENDIF}; // function symbol table
+    class_table :  {$IFDEF PHP7} Pzend_array {$ELSE} PHashTable{$ENDIF};    // class table
 
-    filenames_table : THashTable;
+    filenames_table : {$IFDEF PHP7} zend_array {$ELSE} THashTable{$ENDIF};
 
-    auto_globals : PHashTable;
+    auto_globals :  {$IFDEF PHP7} Pzend_array {$ELSE} PHashTable{$ENDIF};
 
     in_compilation : zend_bool;
     short_tags : zend_bool;
@@ -1520,7 +1484,7 @@ type  _zend_property_info  = record
 
   Pzend_executor_globals = ^zend_executor_globals;
   zend_executor_globals  = record
-    return_value_ptr_ptr : {$IFNDEF PHP700} ppzval{$ELSE} pzval{$ENDIF};
+    return_value_ptr_ptr : {$IFNDEF PHP7} ppzval{$ELSE} pzval{$ENDIF};
 
      uninitialized_zval : zval;
      uninitialized_zval_ptr : pzval;
@@ -1543,9 +1507,9 @@   zend_executor_globals  = record
      {$ENDIF}
 
      active_symbol_table : PHashTable;
-     symbol_table : THashTable;	// main symbol table
+     symbol_table : {$IFDEF PHP7}HashTable{$ELSE}THashTable{$ENDIF};	// main symbol table
 
-     included_files : THashTable;	// files already included */
+     included_files : {$IFDEF PHP7}HashTable{$ELSE}THashTable{$ENDIF};	// files already included */
 
      {$IFDEF PHP4}
      bailout : jump_buf;
@@ -1559,9 +1523,9 @@   zend_executor_globals  = record
 
      active_op_array : pointer;
 
-     function_table : PHashTable;	// function symbol table */
-     class_table : PHashTable;  	// class table
-     zend_constants : PHashTable;	// constants table */
+     function_table : {$IFDEF PHP7}Pzval{$ELSE}PHashTable{$ENDIF};	// function symbol table */
+     class_table : {$IFDEF PHP7}Pzval{$ELSE}PHashTable{$ENDIF};  	// class table
+     zend_constants : {$IFDEF PHP7}Pzval{$ELSE}PHashTable{$ENDIF};	// constants table */
 
      {$IFDEF PHP5}
      scope : pointer;
@@ -1594,8 +1558,8 @@   zend_executor_globals  = record
 
      timed_out : zend_bool;
 
-     regular_list : THashTable;
-     persistent_list : ThashTable;
+     regular_list : {$IFDEF PHP7}HashTable{$ELSE}THashTable{$ENDIF};
+     persistent_list : {$IFDEF PHP7}HashTable{$ELSE}THashTable{$ENDIF};
 
      argument_stack : zend_ptr_stack;
 
diff --git a/Source/hzend_types.pas b/Source/hzend_types.pas
new file mode 100644
index 0000000..b24c349
--- /dev/null
+++ b/Source/hzend_types.pas
@@ -0,0 +1,3024 @@
+unit hzend_types;
+
+interface
+
+uses Winapi.Windows;
+
+var
+ _TestCreate:Pointer;
+
+const
+{#define IS_UNDEF					0
+#define IS_NULL						1
+#define IS_FALSE					2
+#define IS_TRUE						3
+#define IS_LONG						4
+#define IS_DOUBLE					5
+#define IS_STRING					6
+#define IS_ARRAY					7
+#define IS_OBJECT					8
+#define IS_RESOURCE					9
+#define IS_REFERENCE				10}
+
+  E_ERROR = 1 shl 0;
+  E_WARNING = 1 shl 1;
+  E_PARSE = 1 shl 2;
+  E_NOTICE = 1 shl 3;
+  E_CORE_ERROR = 1 shl 4;
+  E_CORE_WARNING = 1 shl 5;
+  E_COMPILE_ERROR = 1 shl 6;
+  E_COMPILE_WARNING = 1 shl 7;
+  E_USER_ERROR = 1 shl 8;
+  E_USER_WARNING = 1 shl 9;
+  E_USER_NOTICE = 1 shl 10;
+  E_STRICT = 1 shl 11;
+  E_RECOVERABLE_ERROR = 1 shl 12;
+  E_DEPRECATED = 1 shl 13;
+  E_USER_DEPRECATED = 1 shl 14;
+  E_ALL = (((((((((((((E_ERROR or E_WARNING) or E_PARSE) or E_NOTICE) or E_CORE_ERROR) or E_CORE_WARNING) or E_COMPILE_ERROR) or E_COMPILE_WARNING) or E_USER_ERROR) or E_USER_WARNING) or E_USER_NOTICE) or E_RECOVERABLE_ERROR) or E_DEPRECATED) or E_USER_DEPRECATED) or E_STRICT;
+  E_CORE = E_CORE_ERROR or E_CORE_WARNING;
+
+
+  ZEND_INI_USER	= 1 shl 0;
+  ZEND_INI_PERDIR	= 1 shl 1;
+  ZEND_INI_SYSTEM	= 1 shl 2;
+  ZEND_INI_ALL = (ZEND_INI_USER or ZEND_INI_PERDIR or ZEND_INI_SYSTEM);
+
+
+ ZEND_INI_DISPLAY_ORIG =	1 ;
+ ZEND_INI_DISPLAY_ACTIVE=	2 ;
+
+ ZEND_INI_STAGE_STARTUP	= 1 or 0;
+ ZEND_INI_STAGE_SHUTDOWN		= 1 or 1;
+ZEND_INI_STAGE_ACTIVATE		= 1 or 2;
+ ZEND_INI_STAGE_DEACTIVATE	= 1 or 3;
+ZEND_INI_STAGE_RUNTIME		= 1 or 4;
+ZEND_INI_STAGE_HTACCESS		= 1 or 5;
+
+
+  IS_UNDEF			=		0  ;
+  IS_NULL			=			1  ;
+  IS_FALSE		 =			2  ;
+  IS_TRUE			 =			3  ;
+  IS_LONG			=			4    ;
+  IS_DOUBLE		=			5    ;
+  IS_STRING		 =			6   ;
+  IS_ARRAY		 =			7   ;
+  IS_OBJECT		 =			8   ;
+  IS_RESOURCE		=			9   ;
+  IS_REFERENCE	 =			10 ;
+
+
+  IS_CONSTANT			=		11    ;
+  IS_CONSTANT_AST	 =			12 ;
+
+
+  IS_BOOL				=	13      ;
+  IS_CALLABLE			=		14    ;
+
+  IS_INDIRECT    =         	15 ;
+  IS_PTR				=		17       ;
+  //  IS_BOOL = 4;
+
+ IS_TYPE_CONSTANT		 =	(1 SHL 0);
+ IS_TYPE_IMMUTABLE	=		(1 SHL 1) ;
+ IS_TYPE_REFCOUNTED	 =		(1 SHL 2) ;
+IS_TYPE_COLLECTABLE	 =		(1 SHL 3);
+ IS_TYPE_COPYABLE		=	(1 SHL 4)      ;
+ IS_TYPE_SYMBOLTABLE =			(1 SHL 5)  ;
+
+Z_TYPE_FLAGS_SHIFT =			8 ;
+Z_CONST_FLAGS_SHIFT	 =		16;
+
+
+
+
+
+  IS_STRING_EX = IS_STRING or ((IS_TYPE_REFCOUNTED or IS_TYPE_COPYABLE) shl Z_TYPE_FLAGS_SHIFT);
+
+
+
+  SUCCESS = 0;
+  FAILURE = -1;
+
+
+
+  HASH_UPDATE = 1 SHL 0;
+  HASH_ADD = 1 SHL 1;
+  HASH_NEXT_INSERT = 1 SHL 2;
+
+  HASH_DEL_KEY = 0;
+  HASH_DEL_INDEX = 1;
+  HASH_DEL_KEY_QUICK = 2;
+
+ ZEND_AST_SPECIAL_SHIFT   =   6;
+ZEND_AST_IS_LIST_SHIFT    =  7;
+ZEND_AST_NUM_CHILDREN_SHIFT = 8;
+
+ PHP_API_VERSION = 20151012 ;
+ YYDEBUG = 0            ;
+ PHP_DEFAULT_CHARSET = 'UTF-8';
+
+  MODULE_PERSISTENT = 1;
+  MODULE_TEMPORARY = 2;
+
+   SAPI_HEADER_ADD			= 1 shr 0;
+
+ SAPI_HEADER_SENT_SUCCESSFULLY =	1 ;
+SAPI_HEADER_DO_SEND			=	2        ;
+ SAPI_HEADER_SEND_FAILED		=	3   ;
+
+ SAPI_DEFAULT_MIMETYPE	=	'text/html';
+ SAPI_DEFAULT_CHARSET	=	PHP_DEFAULT_CHARSET;
+ SAPI_PHP_VERSION_HEADER	=	'X-Powered-By: PHP/" PHP_VERSION';
+
+
+type
+  pppointer = ^ppointer;
+
+
+
+
+
+  _zend_ast_kind = (ZEND_AST_ZVAL_ = 1 shl ZEND_AST_SPECIAL_SHIFT,ZEND_AST_ZNODE_,ZEND_AST_FUNC_DECL,
+    ZEND_AST_CLOSURE,ZEND_AST_METHOD,ZEND_AST_CLASS,
+    ZEND_AST_ARG_LIST = 1 shl ZEND_AST_IS_LIST_SHIFT,ZEND_AST_LIST_,ZEND_AST_ARRAY,
+    ZEND_AST_ENCAPS_LIST,ZEND_AST_EXPR_LIST,
+    ZEND_AST_STMT_LIST,ZEND_AST_IF,ZEND_AST_SWITCH_LIST,
+    ZEND_AST_CATCH_LIST,ZEND_AST_PARAM_LIST,
+    ZEND_AST_CLOSURE_USES,ZEND_AST_PROP_DECL,
+    ZEND_AST_CONST_DECL,ZEND_AST_CLASS_CONST_DECL,
+    ZEND_AST_NAME_LIST,ZEND_AST_TRAIT_ADAPTATIONS,
+    ZEND_AST_USE,ZEND_AST_MAGIC_CONST = 0 shl ZEND_AST_NUM_CHILDREN_SHIFT,
+    ZEND_AST_TYPE,ZEND_AST_VAR = 1 shl ZEND_AST_NUM_CHILDREN_SHIFT,ZEND_AST_CONST,
+    ZEND_AST_UNPACK,ZEND_AST_UNARY_PLUS,ZEND_AST_UNARY_MINUS,
+    ZEND_AST_CAST,ZEND_AST_EMPTY,ZEND_AST_ISSET,
+    ZEND_AST_SILENCE,ZEND_AST_SHELL_EXEC,ZEND_AST_CLONE,
+    ZEND_AST_EXIT,ZEND_AST_PRINT,ZEND_AST_INCLUDE_OR_EVAL,
+    ZEND_AST_UNARY_OP,ZEND_AST_PRE_INC,ZEND_AST_PRE_DEC,
+    ZEND_AST_POST_INC,ZEND_AST_POST_DEC,ZEND_AST_YIELD_FROM,
+    ZEND_AST_GLOBAL,ZEND_AST_UNSET,ZEND_AST_RETURN,
+    ZEND_AST_LABEL,ZEND_AST_REF_,ZEND_AST_HALT_COMPILER,
+    ZEND_AST_ECHO,ZEND_AST_THROW,ZEND_AST_GOTO,
+    ZEND_AST_BREAK,ZEND_AST_CONTINUE,ZEND_AST_DIM = 2 shl ZEND_AST_NUM_CHILDREN_SHIFT,
+    ZEND_AST_PROP,ZEND_AST_STATIC_PROP,ZEND_AST_CALL,
+    ZEND_AST_CLASS_CONST,ZEND_AST_ASSIGN,ZEND_AST_ASSIGN_REF,
+    ZEND_AST_ASSIGN_OP,ZEND_AST_BINARY_OP,ZEND_AST_GREATER,
+    ZEND_AST_GREATER_EQUAL,ZEND_AST_AND,ZEND_AST_OR,
+    ZEND_AST_ARRAY_ELEM,ZEND_AST_NEW,ZEND_AST_INSTANCEOF,
+    ZEND_AST_YIELD,ZEND_AST_COALESCE,ZEND_AST_STATIC,
+    ZEND_AST_WHILE,ZEND_AST_DO_WHILE,ZEND_AST_IF_ELEM,
+    ZEND_AST_SWITCH,ZEND_AST_SWITCH_CASE,ZEND_AST_DECLARE,
+    ZEND_AST_CONST_ELEM,ZEND_AST_USE_TRAIT,
+    ZEND_AST_TRAIT_PRECEDENCE,ZEND_AST_METHOD_REFERENCE,
+    ZEND_AST_NAMESPACE,ZEND_AST_USE_ELEM,ZEND_AST_TRAIT_ALIAS,
+    ZEND_AST_GROUP_USE,ZEND_AST_METHOD_CALL = 3 shl ZEND_AST_NUM_CHILDREN_SHIFT,
+    ZEND_AST_STATIC_CALL,ZEND_AST_CONDITIONAL,
+    ZEND_AST_TRY,ZEND_AST_CATCH,ZEND_AST_PARAM,
+    ZEND_AST_PROP_ELEM,ZEND_AST_FOR = 4 shl ZEND_AST_NUM_CHILDREN_SHIFT,ZEND_AST_FOREACH
+    );
+ plongint = ^longint;
+
+  P_zend_objects_store = ^_zend_objects_store;
+   Pzend_objects_store = ^zend_objects_store;
+   uint32_t = CARDINAL;
+
+
+  zend_pchar  = {$IFDEF PHP_UNICE}PUtf8Char{$ELSE}PAnsiChar{$ENDIF};
+  zend_pstr   = {$IFDEF PHP_UNICE}PUtf8String{$ELSE}PAnsiString{$ENDIF};
+
+  //zend_uchar  = {$IFDEF PHP_UNICE}Utf8Char{$ELSE}AnsiChar{$ENDIF};
+  zend_ustr   = {$IFDEF PHP_UNICE}Utf8String{$ELSE}AnsiString{$ENDIF};
+
+
+
+
+
+
+
+
+  P_zend_object = ^_zend_object;
+  PP_zend_object = ^P_zend_object;
+  PPP_zend_object = ^PP_zend_object;
+  Pzend_object = ^_zend_object;
+  PPzend_object = ^P_zend_object;
+  PPPzend_object = ^PP_zend_object;
+
+  P_zend_refcounted = ^_zend_refcounted;
+  P_zend_string = ^_zend_string;
+  PP_zend_string = ^P_zend_string;
+  PPP_zend_string = ^PP_zend_string;
+  Pzend_string = ^_zend_string;
+  PPzend_string = ^P_zend_string;
+  PPPzend_string = ^PP_zend_string;
+
+  Pzend_mm_chunk_alloc_t = ^zend_mm_chunk_alloc_t;
+  P_zend_resource = ^_zend_resource;
+  PP_zend_resource =^P_zend_resource;
+  PPP_zend_resource =^PP_zend_resource;
+  Pzend_resource = ^_zend_resource;
+  PPzend_resource =^P_zend_resource;
+  PPPzend_resource =^PP_zend_resource;
+  P_zend_ast_ref = ^_zend_ast_ref;
+  P_zend_reference = ^_zend_reference;
+  P_zend_array = ^_zend_array;
+  PP_zend_array = ^P_zend_array;
+  PPP_zend_array = ^PP_zend_array;
+  Pzend_array = ^_zend_array;
+  PPzend_array = ^P_zend_array;
+  PPPzend_array = ^PP_zend_array;
+
+  P_zval_struct = ^_zval_struct;
+  P_zend_function = ^_zend_function;
+  PP_zend_function = ^P_zend_function;
+  PPP_zend_function = ^PP_zend_function;
+  Pzend_function = ^_zend_function;
+  PPzend_function = ^P_zend_function;
+  PPPzend_function = ^PP_zend_function;
+  P_zend_value = ^_zend_value;
+  Pzend_ast_kind = ^zend_ast_kind;
+  zend_ast_kind = Word;
+  Pzend_ast_attr = ^zend_ast_attr;
+  zend_ast_attr = Word;
+  Pzend_bool = ^zend_bool;
+  zend_bool = byte;
+  Pzend_uchar = ^zend_uchar;
+  zend_uchar = byte;
+  zend_long = integer;
+  Pzend_long = ^zend_long;
+  PPzend_long = ^Pzend_long;
+ Pzend_stack = ^zend_stack;
+  P_zend_stack = ^_zend_stack;
+
+
+  zend_ulong = FixedUInt;
+  P_zend_ulong = ^zend_ulong;
+  zend_off_t = integer;
+  Pzend_off_t = ^zend_off_t;
+  PPzend_off_t = ^Pzend_off_t;
+     P_zend_mm_huge_list = ^_zend_mm_huge_list;
+
+  P_zend_mm_free_slot = ^_zend_mm_free_slot;
+  P_zend_mm_bin = ^_zend_mm_bin;
+  P_zend_mm_page = ^_zend_mm_page;
+  P_zend_mm_chunk = ^_zend_mm_chunk;
+ P_zend_mm_heap = ^_zend_mm_heap;
+ PP_zend_mm_heap = ^P_zend_mm_heap;
+ PPP_zend_mm_heap = ^PP_zend_mm_heap;
+ Pzend_mm_heap = ^_zend_mm_heap;
+ PPzend_mm_heap = ^P_zend_mm_heap;
+ PPPzend_mm_heap = ^PP_zend_mm_heap;
+   P_zend_mm_debug_info = ^_zend_mm_debug_info;
+
+   Pzend_ini_entry_def = ^zend_ini_entry_def;
+
+  P_zend_ini_entry = ^_zend_ini_entry;
+  P_zend_ini_entry_def = ^_zend_ini_entry_def;
+
+  zend_uint = uint;
+  zend_ushort = ushort;
+  Pzend_value = ^zend_value;
+  Pzend_file_handle = ^zend_file_handle;
+  P_zend_ast = ^_zend_ast;
+  P_zend_ast_list = ^_zend_ast_list;
+  Pzend_ast_list = ^zend_ast_list;
+  Pzend_ast_decl = ^zend_ast_decl;
+  P_zend_ast_zval = ^_zend_ast_zval;
+  Pzend_ast_zval = ^zend_ast_zval;
+  P_zend_ast_decl = ^_zend_ast_decl;
+  PHashTable = Pzend_array;
+  PPHashTable = ^PHashTable;
+  Pzend_intptr_t = ^zend_intptr_t;
+  Pzend_uintptr_t = ^zend_uintptr_t;
+  pzval = ^zval;
+  ppzval = ^pzval;
+  pppzval = ^ppzval;
+  Pzend_utility_values = ^zend_utility_values;
+  Pzend_utility_functions = ^zend_utility_functions;
+  Pzend_trait_alias = ^zend_trait_alias;
+  Pzend_trait_precedence = ^zend_trait_precedence;
+  Pzend_trait_method_reference = ^zend_trait_method_reference;
+  PZEND_RESULT_CODE = ^ZEND_RESULT_CODE;
+  P_zend_serialize_data = ^_zend_serialize_data;
+  P_zend_unserialize_data = ^_zend_unserialize_data;
+  P_zend_trait_method_reference = ^_zend_trait_method_reference;
+  P_zend_trait_precedence = ^_zend_trait_precedence;
+  P_zend_trait_alias = ^_zend_trait_alias;
+  P_zend_class_entry = ^_zend_class_entry;
+  PP_zend_class_entry  = ^P_zend_class_entry;
+  PPP_zend_class_entry = ^PP_zend_class_entry;
+  Pzend_class_entry = ^_zend_class_entry;
+  PPzend_class_entry  = ^P_zend_class_entry;
+  PPPzend_class_entry = ^PP_zend_class_entry;
+
+  P_zend_utility_functions = ^_zend_utility_functions;
+  P_zend_utility_values = ^_zend_utility_values;
+  Pzend_error_handling_t = ^zend_error_handling_t;
+  Pzend_error_handling = ^zend_error_handling;
+  Pzend_stream_type = ^zend_stream_type;
+
+  P_zend_op = ^_zend_op;
+  P_zend_execute_data = ^_zend_execute_data;
+  PP_zend_execute_data = ^P_zend_execute_data;
+  PPP_zend_execute_data = ^PP_zend_execute_data;
+  Pzend_execute_data = ^_zend_execute_data;
+  PPzend_execute_data = ^P_zend_execute_data;
+  PPPzend_execute_data = ^PP_zend_execute_data;
+  P_zend_function_entry = ^_zend_function_entry;
+  P_zend_fcall_info_cache = ^_zend_fcall_info_cache;
+  Pzend_function_entry = ^zend_function_entry;
+  Pzend_declarables = ^zend_declarables;
+  Pzend_ast_znode = ^zend_ast_znode;
+  Pznode = ^znode;
+  Pznode_op = ^znode_op;
+  Pzend_stream = ^zend_stream;
+  Pzend_mmap = ^zend_mmap;
+  Pzend_fcall_info_cache = ^zend_fcall_info_cache;
+  P_zend_mmap = ^_zend_mmap;
+  P_zend_stream = ^_zend_stream;
+  P_zend_file_handle = ^_zend_file_handle;
+  P_znode_op = ^_znode_op;
+  P_znode = ^_znode;
+  P_zend_ast_znode = ^_zend_ast_znode;
+  P_zend_declarables = ^_zend_declarables;
+  P_zend_oparray_context = ^_zend_oparray_context;
+  Pzend_internal_function_info = ^zend_internal_function_info;
+  Pzend_arg_info = ^zend_arg_info;
+  Pzend_internal_arg_info = ^zend_internal_arg_info;
+  Pzend_property_info = ^zend_property_info;
+  Pzend_try_catch_element = ^zend_try_catch_element;
+  Pzend_label = ^zend_label;
+    Pzend_closure = ^zend_closure;
+  P_zend_closure = ^_zend_closure;
+  P_zend_multibyte_functions = ^_zend_multibyte_functions;
+  Pzend_encoding_internal_encoding_getter = ^zend_encoding_internal_encoding_getter;
+  Pzend_encoding_detector = ^zend_encoding_detector;
+
+  Pzend_brk_cont_element = ^zend_brk_cont_element;
+  Pzend_parser_stack_elem = ^zend_parser_stack_elem;
+  Pzend_file_context = ^zend_file_context;
+  Pzend_oparray_context = ^zend_oparray_context;
+  P_zend_file_context = ^_zend_file_context;
+  P_zend_parser_stack_elem = ^_zend_parser_stack_elem;
+  P_zend_brk_cont_element = ^_zend_brk_cont_element;
+  P_zend_label = ^_zend_label;
+  P_zend_try_catch_element = ^_zend_try_catch_element;
+  P_zend_property_info = ^_zend_property_info;
+  P_zend_internal_arg_info = ^_zend_internal_arg_info;
+  P_zend_arg_info = ^_zend_arg_info;
+  P_zend_internal_function_info = ^_zend_internal_function_info;
+  P_zend_op_array = ^_zend_op_array;
+  PP_zend_op_array = ^P_zend_op_array;
+  PPP_zend_op_array = ^PP_zend_op_array;
+  Pzend_op_array = ^_zend_op_array;
+  PPzend_op_array = ^P_zend_op_array;
+  PPPzend_op_array = ^PP_zend_op_array;
+  PHashTableIterator = ^HashTableIterator;
+  P_zend_object_handlers = ^_zend_object_handlers;
+  PBucket = ^Bucket;
+  Pzend_refcounted_h = ^zend_refcounted_h;
+  Pzend_auto_global = ^zend_auto_global;
+  Pzend_internal_function = ^zend_internal_function;
+  P_zend_internal_function = ^_zend_internal_function;
+  P_zend_call_kind = ^_zend_call_kind;
+  P_zend_auto_global = ^_zend_auto_global;
+  P_zend_refcounted_h = ^_zend_refcounted_h;
+  P_Bucket = ^_Bucket;
+  PHashPosition = ^HashPosition;
+  P_HashTableIterator = ^_HashTableIterator;
+  Pzend_object_read_property_t = ^zend_object_read_property_t;
+  Pzend_object_read_dimension_t = ^zend_object_read_dimension_t;
+  Pzend_object_get_property_ptr_ptr_t = ^zend_object_get_property_ptr_ptr_t;
+  Pzend_object_get_t = ^zend_object_get_t;
+  Pzend_object_get_properties_t = ^zend_object_get_properties_t;
+  Pzend_object_get_method_t = ^zend_object_get_method_t;
+  Pzend_object_get_constructor_t = ^zend_object_get_constructor_t;
+  Pzend_object_get_debug_info_t = ^zend_object_get_debug_info_t;
+  Pzend_call_kind = ^zend_call_kind;
+  Pzend_object_clone_obj_t = ^zend_object_clone_obj_t;
+  Pzend_object_get_class_name_t = ^zend_object_get_class_name_t;
+  Pzend_object_get_gc_t = ^zend_object_get_gc_t;
+  P_zend_class_iterator_funcs = ^_zend_class_iterator_funcs;
+  P_zend_object_iterator_funcs = ^_zend_object_iterator_funcs;
+  Pzend_object_iterator_funcs = ^zend_object_iterator_funcs;
+   P_zend_arena = ^_zend_arena;
+  Pzend_leak_info = ^zend_leak_info;
+  Pzend_mm_debug_info = ^zend_mm_debug_info;
+  Pzend_mm_handlers = ^zend_mm_handlers;
+  P_zend_mm_storage = ^_zend_mm_storage;
+  P_zend_mm_handlers = ^_zend_mm_handlers;
+ P_zend_leak_info = ^_zend_leak_info;
+  P_zend_object_iterator = ^_zend_object_iterator;
+  PP_zend_object_iterator = ^P_zend_object_iterator;
+  PPP_zend_object_iterator = ^PP_zend_object_iterator;
+  Pzend_object_iterator = ^_zend_object_iterator;
+  PPzend_object_iterator = ^P_zend_object_iterator;
+  PPPzend_object_iterator = ^PP_zend_object_iterator;
+  Pzend_class_iterator_funcs = ^zend_class_iterator_funcs;
+  P_zend_module_dep = ^_zend_module_dep;
+  P_zend_module_entry = ^_zend_module_entry;
+  PP_zend_module_entry    = ^P_zend_module_entry;
+  PPP_zend_module_entry    = ^PP_zend_module_entry;
+  Pzend_module_entry = ^_zend_module_entry;
+  PPzend_module_entry    = ^P_zend_module_entry;
+  PPPzend_module_entry    = ^PP_zend_module_entry;
+    psmart_str = ^Tsmart_str;
+
+  Psapi_globals_struct = ^sapi_globals_struct;
+  Psapi_header_struct = ^sapi_header_struct;
+  Psapi_headers_struct = ^sapi_headers_struct;
+  Pzend_mm_chunk_free_t = ^zend_mm_chunk_free_t;
+  Pzend_mm_chunk_truncate_t = ^zend_mm_chunk_truncate_t;
+   Pzend_mm_chunk_extend_tt = ^zend_mm_chunk_extend_t;
+  Psapi_request_info = ^sapi_request_info;
+  P_sapi_globals_struct = ^_sapi_globals_struct;
+  Psapi_header_line = ^sapi_header_line;
+  Psapi_header_op_enum = ^sapi_header_op_enum;
+  P_sapi_module_struct = ^_sapi_module_struct;
+  PP_sapi_module_struct = ^P_sapi_module_struct;
+  PPP_sapi_module_struct = ^PP_sapi_module_struct;
+  Psapi_module_struct = ^_sapi_module_struct;
+  PPsapi_module_struct = ^P_sapi_module_struct;
+  PPPsapi_module_struct = ^PP_sapi_module_struct;
+  P_sapi_post_entry = ^_sapi_post_entry;
+  PP_sapi_post_entry = ^P_sapi_post_entry;
+  PPP_sapi_post_entry = ^PP_sapi_post_entry;
+  Psapi_post_entry = ^_sapi_post_entry;
+  PPsapi_post_entry = ^P_sapi_post_entry;
+  PPPsapi_post_entry = ^PP_sapi_post_entry;
+  Pphp_stream_dirent = ^php_stream_dirent;
+  Pphp_stream_ops = ^php_stream_ops;
+  P_php_stream = ^_php_stream;
+  PP_php_stream = ^P_php_stream;
+  PPP_php_stream = ^PP_php_stream;
+  Pphp_stream = ^_php_stream;
+  PPphp_stream = ^P_php_stream;
+  PPPphp_stream = ^PP_php_stream;
+  P_php_stream_wrapper = ^_php_stream_wrapper;
+  PP_php_stream_wrapper = ^P_php_stream_wrapper;
+  PPP_php_stream_wrapper = ^PP_php_stream_wrapper;
+  Pphp_stream_wrapper = ^_php_stream_wrapper;
+  PPphp_stream_wrapper = ^P_php_stream_wrapper;
+  PPPphp_stream_wrapper = ^PP_php_stream_wrapper;
+  P_php_stream_wrapper_ops = ^_php_stream_wrapper_ops;
+  P_php_stream_ops = ^_php_stream_ops;
+  P_php_stream_statbuf = ^_php_stream_statbuf;
+  Pzend_llist = ^zend_llist;
+  Pzend_llist_element = ^zend_llist_element;
+  P_zend_llist_element = ^_zend_llist_element;
+  P_zend_llist = ^_zend_llist;
+  Pzend_llist_position = ^zend_llist_position;
+  Pphp_stream_filter_ops = ^php_stream_filter_ops;
+  Pphp_stream_filter_chain = ^php_stream_filter_chain;
+   Pphp_stream_filter_factory = ^php_stream_filter_factory;
+  P_php_stream_filter_factory = ^_php_stream_filter_factory;
+  P_php_stream_filter = ^_php_stream_filter;
+  PP_php_stream_filter = ^P_php_stream_filter;
+  PPP_php_stream_filter = ^PP_php_stream_filter;
+  Pphp_stream_filter = ^_php_stream_filter;
+  PPphp_stream_filter = ^P_php_stream_filter;
+  PPPphp_stream_filter = ^PP_php_stream_filter;
+  P_php_stream_filter_chain = ^_php_stream_filter_chain;
+  P_php_stream_filter_ops = ^_php_stream_filter_ops;
+  Pphp_stream_filter_status_t = ^php_stream_filter_status_t;
+  P_php_stream_bucket_brigade = ^_php_stream_bucket_brigade;
+  PP_php_stream_bucket_brigade = ^P_php_stream_bucket_brigade;
+  PPP_php_stream_bucket_brigade = ^PP_php_stream_bucket_brigade;
+  Pphp_stream_bucket_brigade = ^_php_stream_bucket_brigade;
+  PPphp_stream_bucket_brigade = ^P_php_stream_bucket_brigade;
+  PPPphp_stream_bucket_brigade = ^PP_php_stream_bucket_brigade;
+  P_php_stream_bucket = ^_php_stream_bucket;
+  PP_php_stream_bucket = ^P_php_stream_bucket;
+  PPP_php_stream_bucket = ^PP_php_stream_bucket;
+  Pphp_stream_bucket = ^_php_stream_bucket;
+  PPphp_stream_bucket = ^P_php_stream_bucket;
+  PPPphp_stream_bucket = ^PP_php_stream_bucket;
+  Puid_t = ^uid_t;
+  uid_t = longint;
+ Pphp_stream_wrapper_ops = ^php_stream_wrapper_ops;                                          zend_encoding = pointer ;
+  Pzend_encoding= ^zend_encoding;
+  PPzend_encoding = ^Pzend_encoding;
+  PPPzend_encoding = ^PPzend_encoding;
+  Pgid_t = ^gid_t;
+  gid_t = longint;
+Pzend_ptr_stack = ^zend_ptr_stack;
+  P_zend_ptr_stack = ^_zend_ptr_stack;
+  Pzend_free_op = ^zend_free_op;
+  zend_free_op = Pzval;
+
+  Pzend_vm_stack = ^_zend_vm_stack;
+     Pzend_ini_parser_param = ^zend_ini_parser_param;
+   P_zend_ini_parser_param = ^_zend_ini_parser_param;
+
+    P_zend_php_scanner_globals = ^_zend_php_scanner_globals;
+  Pzend_php_scanner_event = ^zend_php_scanner_event;
+  zend_php_scanner_event = (ON_TOKEN,ON_FEEDBACK,ON_STOP);
+  P_zend_ini_scanner_globals = ^_zend_ini_scanner_globals;
+  P_zend_executor_globals = ^_zend_executor_globals;
+  P_zend_compiler_globals = ^_zend_compiler_globals;
+
+
+  Pcaddr_t = ^caddr_t;
+  caddr_t = zend_pchar;
+  _zend_fcall_info_cache = record
+      initialized : zend_bool;
+      function_handler : P_zend_function;
+      calling_scope : P_zend_class_entry;
+      called_scope : P_zend_class_entry;
+      _object : P_zend_object;
+    end;
+  zend_fcall_info_cache = _zend_fcall_info_cache;
+  Pphp_stream_statbuf = ^php_stream_statbuf;
+  P_php_stream_notifier = ^_php_stream_notifier;
+  P_php_stream_context = ^_php_stream_context;
+  PP_php_stream_context = ^P_php_stream_context;
+  PPP_php_stream_context = ^PP_php_stream_context;
+  Pphp_stream_context = ^_php_stream_context;
+  PPphp_stream_context = ^P_php_stream_context;
+  PPPphp_stream_context = ^PP_php_stream_context;
+
+  P_php_stream_dirent = ^_php_stream_dirent;
+
+  PP_zend_llist_element = ^P_zend_llist_element;
+  PPP_zend_llist_element = ^PP_zend_llist_element;
+
+   zend_stat_t = pointer;
+   P_zend_stat_t =^zend_stat_t;
+   PP_zend_stat_t = ^P_zend_stat_t;
+   PPP_zend_stat_t = ^PP_zend_stat_t;
+  _zend_value = Packed  record
+      case longint of
+        0 : ( lval : zend_long );
+        1 : ( dval : double );
+        2 : ( counted : P_zend_refcounted );
+        3 : ( str : Pzend_string );
+        4 : ( arr : Pzend_array );
+        5 : ( obj : Pzend_object );
+        6 : ( res : Pzend_resource );
+        7 : ( ref : P_zend_reference );
+        8 : ( ast : P_zend_ast_ref );
+        9 : ( zv : Pzval );
+        10 : ( ptr : pointer );
+        11 : ( ce : P_zend_class_entry );
+        12 : ( func : P_zend_function );
+        13 : ( ww : Packed record
+            w1 : cardinal;
+            w2 : cardinal;
+          end );
+      end;
+    zend_value = _zend_value;
+
+  _zval_struct = Packed  record
+      value : zend_value;
+      u1 : Packed  record
+          case longint of
+            0 : ( v : record
+                _type : zend_uchar;
+                type_flags : zend_uchar;
+                const_flags : zend_uchar;
+                reserved : zend_uchar;
+              end );
+            1 : ( type_info : cardinal );
+          end;
+      u2 :  Packed  record
+          case longint of
+            0 : ( var_flags : LongWord );
+            1 : ( next : cardinal );
+            2 : ( cache_slot : cardinal );
+            3 : ( lineno : cardinal );
+            4 : ( num_args : cardinal );
+            5 : ( fe_pos : cardinal );
+            6 : ( fe_iter_idx : cardinal );
+          end;
+    end;
+    zval = _zval_struct;
+
+
+  compare_func_t = function (_para1:pointer; _para2:pointer):longint;cdecl;
+
+  swap_func_t = procedure (_para1:pointer; _para2:pointer);cdecl;
+
+  sort_func_t = procedure (_para1:pointer; _para2:size_t; _para3:size_t; _para4:compare_func_t; _para5:swap_func_t);cdecl;
+
+  dtor_func_t = procedure (pDest:pzval);cdecl;
+
+  copy_ctor_func_t = procedure (pElement:pzval);cdecl;
+
+
+  P_zend_vm_stack = ^_zend_vm_stack;
+
+  _zend_vm_stack = record
+      top : Pzval;
+      _end : Pzval;
+      prev : POINTER;
+    end;
+
+
+  _zend_refcounted_h = record
+      refcount : cardinal;
+      u : record
+          case longint of
+            0 : ( v : record
+                _type : zend_uchar;
+                flags : zend_uchar;
+                gc_info : word;
+              end );
+            1 : ( type_info : cardinal );
+          end;
+    end;
+
+
+  zend_refcounted_h = _zend_refcounted_h;
+
+  _zend_refcounted = record
+      gc : zend_refcounted_h;
+    end;
+ zend_refcounted = _zend_refcounted;
+
+
+
+  _zend_string = record
+      gc : zend_refcounted_h;
+      h : zend_ulong;
+      len : size_t;
+      val : zend_pchar;
+    end;
+    zend_string = _zend_string;
+
+  _Bucket = record
+      val : zval;
+      h : zend_ulong;
+      key : P_zend_string;
+    end;
+  Bucket = _Bucket;
+  _zend_ini_entry = record
+      name : P_zend_string;
+      on_modify : pointer;
+      mh_arg1 : pointer;
+      mh_arg2 : pointer;
+      mh_arg3 : pointer;
+      value : P_zend_string;
+      orig_value : P_zend_string;
+      displayer : procedure (ini_entry:p_zend_ini_entry; _type:longint);cdecl;
+      modifiable : longint;
+      orig_modifiable : longint;
+      modified : longint;
+      module_number : longint;
+    end;
+
+  _zend_ini_entry_def = record
+      name : zend_pchar;
+      on_modify : pointer;
+      mh_arg1 : pointer;
+      mh_arg2 : pointer;
+      mh_arg3 : pointer;
+      value : zend_pchar;
+      displayer : procedure (ini_entry:p_zend_ini_entry; _type:longint);cdecl;
+      modifiable : longint;
+      name_length : uint;
+      value_length : uint;
+    end;
+  zend_ini_entry_def = _zend_ini_entry_def;
+zend_ini_parser_cb_t = procedure (arg1:pzval; arg2:pzval; arg3:pzval; callback_type:longint; arg:pointer);cdecl;
+
+
+
+  _zend_array = record
+      gc : zend_refcounted_h;
+      u : record
+          case longint of
+            0 : ( v : record
+                flags : zend_uchar;
+                nApplyCount : zend_uchar;
+                nIteratorsCount : zend_uchar;
+                reserve : zend_uchar;
+              end );
+            1 : ( flags : cardinal );
+          end;
+      nTableMask : cardinal;
+      arData : PBucket;
+      nNumUsed : cardinal;
+      nNumOfElements : cardinal;
+      nTableSize : cardinal;
+      nInternalPointer : cardinal;
+      nNextFreeElement : zend_long;
+      pDestructor : dtor_func_t;
+    end;
+    HashTable = _zend_array ;
+    	zend_array = _zend_array;
+
+  _zend_ast = record
+      kind : zend_ast_kind;
+      attr : zend_ast_attr;
+      lineno : Cardinal;
+      child : array[0..0] of P_zend_ast;
+    end;
+
+  	zend_ast = _zend_ast;
+   pzend_ast = ^zend_ast;
+   ppzend_ast = ^pzend_ast;
+   pppzend_ast = ^ppzend_ast;
+
+  _zend_ast_list = record
+      kind : zend_ast_kind;
+      attr : zend_ast_attr;
+      lineno : Cardinal;
+      children : Cardinal;
+      child : array[0..0] of P_zend_ast;
+    end;
+  zend_ast_list = _zend_ast_list;
+
+
+
+
+  P_zend_fcall_info = ^_zend_fcall_info;
+  _zend_fcall_info = record
+      size : size_t;
+      function_table : PHashTable;
+      function_name : zval;
+      symbol_table : P_zend_array;
+      retval : Pzval;
+      params : Pzval;
+      _object : P_zend_object;
+      no_separation : zend_bool;
+      param_count : cardinal;
+    end;
+  zend_fcall_info = _zend_fcall_info;
+  Pzend_fcall_info = ^zend_fcall_info;
+
+
+  _zend_ast_zval = record
+      kind : zend_ast_kind;
+      attr : zend_ast_attr;
+      val : zval;
+    end;
+  zend_ast_zval = _zend_ast_zval;
+
+  _zend_ast_decl = record
+      kind : zend_ast_kind;
+      attr : zend_ast_attr;
+      start_lineno : Cardinal;
+      end_lineno : Cardinal;
+      flags : Cardinal;
+      lex_pos : Pbyte;
+      doc_comment : P_zend_string;
+      name : P_zend_string;
+      child : array[0..3] of P_zend_ast;
+    end;
+  zend_ast_decl = _zend_ast_decl;
+
+  zend_ast_process_t = procedure (ast:pzend_ast);cdecl;
+
+
+  zend_ast_apply_func = procedure (ast_ptr:pPzend_ast);cdecl;
+
+
+
+
+
+  {$IFDEF _WIN64}
+  IntPtr = Int64;
+  UIntPtr = UInt64;
+  {$ELSE}
+  IntPtr = Longint;
+  UIntPtr = LongWord;
+  {$ENDIF}
+
+
+
+  uintptr_t = Cardinal;
+
+
+  ZEND_RESULT_CODE = (SUCCESS_ = 0,FAILURE_ = -(1));
+
+  zend_intptr_t = intptr;
+
+  zend_uintptr_t = uintptr_t;
+	//zend_object_handlers = _zend_object_handlers;
+
+
+ // Pzend_function = ^zend_function;
+
+
+  Pzend_mm_page_info = ^zend_mm_page_info;
+  zend_mm_page_info = uint32_t;
+
+
+  Pzend_mm_bitset = ^zend_mm_bitset;
+  zend_mm_bitset = zend_ulong;
+
+
+
+
+
+
+
+
+  _zend_serialize_data = record end;
+
+  _zend_unserialize_data = record end;
+
+   zend_serialize_data = _zend_serialize_data;
+ zend_unserialize_data = _zend_unserialize_data;
+
+  _zend_trait_method_reference = record
+      method_name : P_zend_string;
+      ce : P_zend_class_entry;
+      class_name : P_zend_string;
+    end;
+  zend_trait_method_reference = _zend_trait_method_reference;
+
+
+  hgerhrh343erg = record
+          case longint of
+            0 : ( ce : P_zend_class_entry );
+            1 : ( class_name : P_zend_string );
+          end;
+  _zend_trait_precedence = record
+      trait_method : Pzend_trait_method_reference;
+      exclude_from_classes : ^hgerhrh343erg;
+    end;
+  zend_trait_precedence = _zend_trait_precedence;
+
+  _zend_trait_alias = record
+      trait_method : Pzend_trait_method_reference;
+      alias : P_zend_string;
+      modifiers : Cardinal;
+    end;
+  zend_trait_alias = _zend_trait_alias;
+
+  _zend_class_iterator_funcs = record
+      funcs : Pzend_object_iterator_funcs;
+      zf_new_iterator : P_zend_function;
+      zf_valid : P_zend_function;
+      zf_current : P_zend_function;
+      zf_key : P_zend_function;
+      zf_next : P_zend_function;
+      zf_rewind : P_zend_function;
+    end;
+  zend_class_iterator_funcs = _zend_class_iterator_funcs;
+
+  _zend_class_entry = record
+      _type : char;
+      name : P_zend_string;
+      parent : P_zend_class_entry;
+      refcount : longint;
+      ce_flags : Cardinal;
+      default_properties_count : longint;
+      default_static_members_count : longint;
+      default_properties_table : Pzval;
+      default_static_members_table : Pzval;
+      static_members_table : Pzval;
+      function_table : HashTable;
+      properties_info : HashTable;
+      constants_table : HashTable;
+      _constructor : P_zend_function;
+      _destructor : P_zend_function;
+      clone : P_zend_function;
+      __get : P_zend_function;
+      __set : P_zend_function;
+      __unset : P_zend_function;
+      __isset : P_zend_function;
+      __call : P_zend_function;
+      __callstatic : P_zend_function;
+      __tostring : P_zend_function;
+      __debugInfo : P_zend_function;
+      serialize_func : P_zend_function;
+      unserialize_func : P_zend_function;
+      iterator_funcs : zend_class_iterator_funcs;
+      create_object : function (class_type:p_zend_class_entry):P_zend_object;cdecl;
+      get_iterator : function (ce:p_zend_class_entry; _object:pzval; by_ref:longint):P_zend_object_iterator;cdecl;
+      interface_gets_implemented : function (iface:p_zend_class_entry; class_type:p_zend_class_entry):longint;cdecl;
+      get_static_method : function (ce:p_zend_class_entry; method:p_zend_string):P_zend_function;cdecl;
+      serialize : function (_object:pzval; buffer:LPBYTE; buf_len:Psize_t; data:p_zend_serialize_data):longint;cdecl;
+      unserialize : function (_object:pzval; ce:p_zend_class_entry; buf:pbyte; buf_len:size_t; data:p_zend_unserialize_data):longint;cdecl;
+      num_interfaces : Cardinal;
+      num_traits : Cardinal;
+      interfaces : ^P_zend_class_entry;
+      traits : ^P_zend_class_entry;
+      trait_aliases : ^Pzend_trait_alias;
+      trait_precedences : ^Pzend_trait_precedence;
+      info : record
+          case longint of
+            0 : ( user : record
+                filename : P_zend_string;
+                line_start : Cardinal;
+                line_end : Cardinal;
+                doc_comment : P_zend_string;
+              end );
+            1 : ( internal : record
+                builtin_functions : P_zend_function_entry;
+                module : P_zend_module_entry;
+              end );
+          end;
+    end;
+    	zend_class_entry = _zend_class_entry;
+  TZend_class_entry = _zend_class_entry;
+
+  zend_stream_fsizer_t = function ( handle:pointer):size_t;cdecl;
+
+  zend_stream_reader_t = function ( handle:pointer; buf:zend_pchar; len:size_t):size_t;cdecl;
+
+  zend_stream_closer_t = procedure ( handle:pointer);cdecl;
+
+
+
+ // __stat64 = zend_stat_t;
+ // stat = zend_stat_t;
+
+  zend_stream_type = (ZEND_HANDLE_FILENAME,ZEND_HANDLE_FD,ZEND_HANDLE_FP,
+    ZEND_HANDLE_STREAM,ZEND_HANDLE_MAPPED);
+
+_zend_mmap = record
+  len : size_t;
+  pos : size_t;
+  map : pointer;
+  buf : zend_pchar;
+  old_handle : pointer;
+  old_closer : zend_stream_closer_t;
+end;
+  zend_mmap = _zend_mmap;
+
+  _zend_stream = record
+      handle : pointer;
+      isatty : longint;
+      mmap : zend_mmap;
+      reader : zend_stream_reader_t;
+      fsizer : zend_stream_fsizer_t;
+      closer : zend_stream_closer_t;
+    end;
+  zend_stream = _zend_stream;
+
+  _zend_file_handle = record
+      handle : record
+          case longint of
+            0 : ( fd : longint );
+            1 : ( fp : pointer );
+            2 : ( stream : zend_stream );
+          end;
+      filename : zend_pchar;
+      opened_path : P_zend_string;
+      _type : zend_stream_type;
+      free_filename : zend_bool;
+    end;
+  zend_file_handle = _zend_file_handle;
+
+
+  _zend_utility_functions = record
+      error_function : procedure (_type:longint; error_filename:zend_pchar; error_lineno:uint; format:zend_pchar; args:va_list);cdecl;
+      printf_function : function (format:zend_pchar):size_t;cdecl varargs;
+      write_function : function (str:zend_pchar; str_length:size_t):size_t;cdecl;
+      fopen_function : function (filename:zend_pchar; opened_path:pP_zend_string):POINTER;cdecl;
+      message_handler : procedure (message:zend_long; data:pointer);cdecl;
+      block_interruptions : procedure ;cdecl;
+      unblock_interruptions : procedure ;cdecl;
+      get_configuration_directive : function (name:p_zend_string):Pzval;cdecl;
+      ticks_function : procedure (ticks:longint);cdecl;
+      on_timeout : procedure (seconds:longint);cdecl;
+      stream_open_function : function (filename:zend_pchar; handle:pzend_file_handle):longint;cdecl;
+      vspprintf_function : function (pbuf:PPchar; max_len:size_t; format:zend_pchar; ap:va_list):size_t;cdecl;
+      vstrpprintf_function : function (max_len:size_t; format:zend_pchar; ap:va_list):P_zend_string;cdecl;
+      getenv_function : function (name:zend_pchar; name_len:size_t):zend_pchar;cdecl;
+      resolve_path_function : function (filename:zend_pchar; filename_len:longint):P_zend_string;cdecl;
+    end;
+  zend_utility_functions = _zend_utility_functions;
+
+  _zend_utility_values = record
+      import_use_extension : zend_pchar;
+      import_use_extension_length : uint;
+      html_errors : zend_bool;
+    end;
+  zend_utility_values = _zend_utility_values;
+
+  zend_write_func_t = function (str:zend_pchar; str_length:size_t):longint;cdecl;
+
+
+  zend_error_handling_t = (EH_NORMAL = 0,EH_SUPPRESS,EH_THROW);
+
+  zend_error_handling = record
+      handling : zend_error_handling_t;
+      exception : P_zend_class_entry;
+      user_handler : zval;
+    end;
+
+
+
+
+
+
+  _znode_op = record
+      case longint of
+        0 : ( constant : cardinal );
+        1 : ( _var : cardinal );
+        2 : ( num : cardinal );
+        3 : ( opline_num : cardinal );
+        4 : ( jmp_offset : cardinal );
+        5 : ( zv : Pzval );
+      end;
+  znode_op = _znode_op;
+
+  _znode = record
+      op_type : zend_uchar;
+      flag : zend_uchar;
+      u : record
+          case longint of
+            0 : ( op : znode_op );
+            1 : ( constant : zval );
+          end;
+    end;
+  znode = _znode;
+
+  _zend_ast_znode = record
+      kind : zend_ast_kind;
+      attr : zend_ast_attr;
+      lineno : Cardinal;
+      node : znode;
+    end;
+  zend_ast_znode = _zend_ast_znode;
+
+  _zend_declarables = record
+      ticks : zend_long;
+    end;
+  zend_declarables = _zend_declarables;
+
+  _zend_oparray_context = record
+      opcodes_size : Cardinal;
+      vars_size : longint;
+      literals_size : longint;
+      current_brk_cont : longint;
+      backpatch_count : longint;
+      in_finally : longint;
+      fast_call_var : Cardinal;
+      labels : PHashTable;
+    end;
+  zend_oparray_context = _zend_oparray_context;
+
+  _zend_file_context = record
+      declarables : zend_declarables;
+      implementing_class : znode;
+      current_namespace : P_zend_string;
+      in_namespace : zend_bool;
+      has_bracketed_namespaces : zend_bool;
+      imports : PHashTable;
+      imports_function : PHashTable;
+      imports_const : PHashTable;
+    end;
+  zend_file_context = _zend_file_context;
+
+  _zend_parser_stack_elem = record
+      case longint of
+        0 : ( ast : P_zend_ast );
+        1 : ( str : P_zend_string );
+        2 : ( num : zend_ulong );
+      end;
+  zend_parser_stack_elem = _zend_parser_stack_elem;
+
+
+  _zend_execute_data = record
+      opline : P_zend_op;
+      call :P_zend_execute_data;
+      return_value :Pzval;
+      func : P_zend_function;
+      This : zval;
+      called_scope : P_zend_class_entry;
+      prev_execute_data :P_zend_execute_data;
+      symbol_table :P_zend_array;
+      run_time_cache : ^pointer;
+      literals : Pzval;
+    end;
+   zend_execute_data = _zend_execute_data;
+
+  user_opcode_handler_t = function (execute_data:p_zend_execute_data):longint;cdecl;
+
+  _zend_op = record
+      handler : pointer;
+      op1 : znode_op;
+      op2 : znode_op;
+      result : znode_op;
+      extended_value : Cardinal;
+      lineno : Cardinal;
+      opcode : zend_uchar;
+      op1_type : zend_uchar;
+      op2_type : zend_uchar;
+      result_type : zend_uchar;
+    end;
+    zend_op = _zend_op ;
+
+
+  _zend_brk_cont_element = record
+      start : longint;
+      cont : longint;
+      brk : longint;
+      parent : longint;
+    end;
+  zend_brk_cont_element = _zend_brk_cont_element;
+
+  _zend_label = record
+      brk_cont : longint;
+      opline_num : Cardinal;
+    end;
+  zend_label = _zend_label;
+
+  _zend_try_catch_element = record
+      try_op : Cardinal;
+      catch_op : Cardinal;
+      finally_op : Cardinal;
+      finally_end : Cardinal;
+    end;
+  zend_try_catch_element = _zend_try_catch_element;
+
+  _zend_property_info = record
+      offset : Cardinal;
+      flags : Cardinal;
+      name : P_zend_string;
+      doc_comment : P_zend_string;
+      ce : P_zend_class_entry;
+    end;
+  zend_property_info = _zend_property_info;
+
+  _zend_internal_arg_info = record
+      name : zend_pchar;
+      class_name : zend_pchar;
+      type_hint : zend_uchar;
+      pass_by_reference : zend_uchar;
+      allow_null : zend_bool;
+      is_variadic : zend_bool;
+    end;
+  zend_internal_arg_info = _zend_internal_arg_info;
+
+  _zend_arg_info = record
+      name : P_zend_string;
+      class_name : P_zend_string;
+      type_hint : zend_uchar;
+      pass_by_reference : zend_uchar;
+      allow_null : zend_bool;
+      is_variadic : zend_bool;
+    end;
+  zend_arg_info = _zend_arg_info;
+
+  _zend_internal_function_info = record
+      required_num_args : zend_uintptr_t;
+      class_name : zend_pchar;
+      type_hint : zend_uchar;
+      return_reference : zend_bool;
+      allow_null : zend_bool;
+      _is_variadic : zend_bool;
+    end;
+  zend_internal_function_info = _zend_internal_function_info;
+
+  _zend_op_array = record
+      _type : zend_uchar;
+      arg_flags : array[0..2] of zend_uchar;
+      fn_flags : Cardinal;
+      function_name : P_zend_string;
+      scope : P_zend_class_entry;
+      prototype : P_zend_function;
+      num_args : Cardinal;
+      required_num_args : Cardinal;
+      arg_info : Pzend_arg_info;
+      refcount : ^Cardinal;
+      this_var : Cardinal;
+      last : Cardinal;
+      opcodes : P_zend_op;
+      last_var : longint;
+      T : Cardinal;
+      vars : ^P_zend_string;
+      last_brk_cont : longint;
+      last_try_catch : longint;
+      brk_cont_array : Pzend_brk_cont_element;
+      try_catch_array : Pzend_try_catch_element;
+      static_variables : PHashTable;
+      filename : P_zend_string;
+      line_start : Cardinal;
+      line_end : Cardinal;
+      doc_comment : P_zend_string;
+      early_binding : Cardinal;
+      last_literal : longint;
+      literals : Pzval;
+      cache_size : longint;
+      run_time_cache : ^pointer;
+      reserved : array[0..3] of pointer;
+    end;
+     zend_op_array = _zend_op_array;
+
+
+  _zend_internal_function = record
+      _type : zend_uchar;
+      arg_flags : array[0..2] of zend_uchar;
+      fn_flags : Cardinal;
+      function_name : P_zend_string;
+      scope : P_zend_class_entry;
+      prototype : P_zend_function;
+      num_args : Cardinal;
+      required_num_args : Cardinal;
+      arg_info : Pzend_internal_arg_info;
+      handler : procedure (execute_data:p_zend_execute_data; return_value:pzval);cdecl;
+      module : P_zend_module_entry;
+      reserved : array[0..3] of pointer;
+    end;
+  zend_internal_function = _zend_internal_function;
+
+
+
+
+  _zend_function = record
+      case longint of
+        0 : ( _type : zend_uchar );
+        1 : ( common : record
+            _type : zend_uchar;
+            arg_flags : array[0..2] of zend_uchar;
+            fn_flags : Cardinal;
+            function_name : P_zend_string;
+            scope : P_zend_class_entry;
+            prototype : P_zend_function;
+            num_args : Cardinal;
+            required_num_args : Cardinal;
+            arg_info : Pzend_arg_info;
+          end );
+        2 : ( op_array : zend_op_array );
+        3 : ( internal_function : zend_internal_function );
+      end;
+
+  zend_function = _zend_function;
+
+
+
+
+  _zend_call_kind = (ZEND_CALL_NESTED_FUNCTION,ZEND_CALL_NESTED_CODE,
+    ZEND_CALL_TOP_FUNCTION,ZEND_CALL_TOP_CODE
+    );
+  zend_call_kind = _zend_call_kind;
+
+
+
+
+
+
+
+  unary_op_type = function (a:pzval; b:pzval):longint;cdecl;
+
+  binary_op_type = function (a:pzval; b:pzval; c:pzval):longint;cdecl;
+  zend_auto_global_callback = function (name:p_zend_string):zend_bool;cdecl;
+
+
+  _zend_auto_global = record
+      name : P_zend_string;
+      auto_global_callback : zend_auto_global_callback;
+      jit : zend_bool;
+      armed : zend_bool;
+    end;
+  zend_auto_global = _zend_auto_global;
+
+
+
+
+
+
+
+
+
+
+
+
+
+  HashPosition = cardinal;
+
+  _HashTableIterator = record
+      ht : PHashTable;
+      pos : HashPosition;
+    end;
+  HashTableIterator = _HashTableIterator;
+
+  _zend_object = record
+      gc : zend_refcounted_h;
+      handle : cardinal;
+      ce : P_zend_class_entry;
+      handlers : P_zend_object_handlers;
+      properties : PHashTable;
+      properties_table : array[0..0] of zval;
+    end;
+   zend_object = _zend_object;
+
+  _zend_resource = record
+      gc : zend_refcounted_h;
+      handle : longint;
+      _type : longint;
+      ptr : pointer;
+    end;
+   zend_resource = _zend_resource;
+
+  _zend_reference = record
+      gc : zend_refcounted_h;
+      val : zval;
+    end;
+    zend_reference = _zend_reference;
+
+  _zend_ast_ref = record
+      gc : zend_refcounted_h;
+      ast : P_zend_ast;
+    end;
+   zend_ast_ref = _zend_ast_ref;
+
+
+  zend_object_read_property_t = function (_object:pzval; member:pzval; _type:longint; cache_slot:ppointer; rv:pzval):Pzval;cdecl;
+
+  zend_object_read_dimension_t = function (_object:pzval; offset:pzval; _type:longint; rv:pzval):Pzval;cdecl;
+
+  zend_object_write_property_t = procedure (_object:pzval; member:pzval; value:pzval; cache_slot:ppointer);cdecl;
+
+  zend_object_write_dimension_t = procedure (_object:Pzval; offset:Pzval; value:pzval);cdecl;
+
+  zend_object_get_property_ptr_ptr_t = function (_object:Pzval; member:Pzval; _type:longint; cache_slot:pointer):Pzval;cdecl;
+
+  zend_object_set_t = procedure (_object:Pzval; value:pzval);cdecl;
+
+  zend_object_get_t = function (_object:Pzval; rv:pzval):Pzval;cdecl;
+
+  zend_object_has_property_t = function (_object:Pzval; member:Pzval; has_set_exists:longint; cache_slot:pointer):longint;cdecl;
+
+
+  zend_object_has_dimension_t = function (_object:Pzval; member:Pzval; check_empty:longint):longint;cdecl;
+
+
+  zend_object_unset_property_t = procedure (_object:Pzval; member:Pzval; cache_slot:pointer);cdecl;
+
+
+  zend_object_unset_dimension_t = procedure (_object:Pzval; offset:pzval);cdecl;
+
+
+  zend_object_get_properties_t = function (_object:pzval):PHashTable;cdecl;
+
+
+  zend_object_get_debug_info_t = function (_object:Pzval; is_temp:plongint):PHashTable;cdecl;
+
+
+
+
+  zend_object_call_method_t = function (method:P_zend_string; _object:P_zend_object; execute_data:P_zend_execute_data; return_value:pzval):longint;cdecl;
+
+  zend_object_get_method_t = function (_object:PP_zend_object; method:P_zend_string; key:pzval):P_zend_function;cdecl;
+
+  zend_object_get_constructor_t = function (_object:pzend_object):P_zend_function;cdecl;
+
+
+  zend_object_dtor_obj_t = procedure (_object:pzend_object);cdecl;
+
+  zend_object_free_obj_t = procedure (_object:pzend_object);cdecl;
+
+  zend_object_clone_obj_t = function (_object:pzval):P_zend_object;cdecl;
+
+  zend_object_get_class_name_t = function (_object:pzend_object):P_zend_string;cdecl;
+
+  zend_object_compare_t = function (object1:Pzval; object2:pzval):longint;cdecl;
+
+  zend_object_compare_zvals_t = function (resul:Pzval; op1:Pzval; op2:pzval):longint;cdecl;
+
+
+  zend_object_cast_t = function (readobj:Pzval; retval:Pzval; _type:longint):longint;cdecl;
+
+
+  zend_object_count_elements_t = function (_object:Pzval; count:pzend_long):longint;cdecl;
+
+  zend_object_get_closure_t = function (obj:Pzval; ce_ptr:PP_zend_class_entry; fptr_ptr:PP_zend_function; obj_ptr:pP_zend_object):longint;cdecl;
+
+  zend_object_get_gc_t = function (_object:Pzval; table:PPzval; n:plongint):PHashTable;cdecl;
+
+  zend_object_do_operation_t = function (opcode:zend_uchar; result:Pzval; op1:Pzval; op2:pzval):longint;cdecl;
+
+
+  _zend_stack = record
+      size : longint;
+      top : longint;
+      max : longint;
+      elements : pointer;
+    end;
+  zend_stack = _zend_stack;
+
+
+  _zend_object_handlers = record
+      offset : longint;
+      free_obj : zend_object_free_obj_t;
+      dtor_obj : zend_object_dtor_obj_t;
+      clone_obj : zend_object_clone_obj_t;
+      read_property : zend_object_read_property_t;
+      write_property : zend_object_write_property_t;
+      read_dimension : zend_object_read_dimension_t;
+      write_dimension : zend_object_write_dimension_t;
+      get_property_ptr_ptr : zend_object_get_property_ptr_ptr_t;
+      get : zend_object_get_t;
+      _set : zend_object_set_t;
+      has_property : zend_object_has_property_t;
+      unset_property : zend_object_unset_property_t;
+      has_dimension : zend_object_has_dimension_t;
+      unset_dimension : zend_object_unset_dimension_t;
+      get_properties : zend_object_get_properties_t;
+      get_method : zend_object_get_method_t;
+      call_method : zend_object_call_method_t;
+      get_constructor : zend_object_get_constructor_t;
+      get_class_name : zend_object_get_class_name_t;
+      compare_objects : zend_object_compare_t;
+      cast_object : zend_object_cast_t;
+      count_elements : zend_object_count_elements_t;
+      get_debug_info : zend_object_get_debug_info_t;
+      get_closure : zend_object_get_closure_t;
+      get_gc : zend_object_get_gc_t;
+      do_operation : zend_object_do_operation_t;
+      compare : zend_object_compare_zvals_t;
+    end;
+
+
+
+
+
+
+  _zend_object_iterator = record
+      std : zend_object;
+      data : zval;
+      funcs : Pzend_object_iterator_funcs;
+      index : zend_ulong;
+    end;
+
+
+     zend_object_iterator = _zend_object_iterator;
+  _zend_object_iterator_funcs = record
+      dtor : procedure (iter:pzend_object_iterator);cdecl;
+      valid : function (iter:pzend_object_iterator):longint;cdecl;
+      get_current_data : function (iter:pzend_object_iterator):Pzval;cdecl;
+      get_current_key : procedure (iter:P_zend_object_iterator; key:pzval);cdecl;
+      move_forward : procedure (iter:pzend_object_iterator);cdecl;
+      rewind : procedure (iter:pzend_object_iterator);cdecl;
+      invalidate_current : procedure (iter:pzend_object_iterator);cdecl;
+    end;
+  zend_object_iterator_funcs = _zend_object_iterator_funcs;
+
+
+
+  _zend_ini_parser_param = record
+      ini_parser_cb : zend_ini_parser_cb_t;
+      arg : pointer;
+    end;
+  zend_ini_parser_param = _zend_ini_parser_param;
+
+
+  _zend_module_entry = record
+      size : word;
+      zend_api : dword;
+      zend_debug : byte;
+      zts : byte;
+      ini_entry : P_zend_ini_entry;
+      deps : P_zend_module_dep;
+      name : zend_pchar;
+      functions : P_zend_function_entry;
+      module_startup_func : function (_type:longint; module_number:longint):longint;cdecl;
+      module_shutdown_func : function (_type:longint; module_number:longint):longint;cdecl;
+      request_startup_func : function (_type:longint; module_number:longint):longint;cdecl;
+      request_shutdown_func : function (_type:longint; module_number:longint):longint;cdecl;
+      info_func : procedure (zend_module:p_zend_module_entry);cdecl;
+      version : zend_pchar;
+      globals_size : size_t;
+      globals_ptr : pointer;
+      globals_ctor : procedure (global:pointer);cdecl;
+      globals_dtor : procedure (global:pointer);cdecl;
+      post_deactivate_func : function :longint;cdecl;
+      module_started : longint;
+      _type : byte;
+      handle : pointer;
+      module_number : longint;
+      build_id : zend_pchar;
+    end;
+    zend_module_entry = _zend_module_entry;
+
+
+
+
+
+  _zend_module_dep = record
+      name : zend_pchar;
+      rel : zend_pchar;
+      version : zend_pchar;
+      _type : byte;
+    end;
+
+      zend_module_dep = _zend_module_dep;
+
+  _zend_function_entry = record
+      fname : zend_pchar;
+      handler : pointer;
+      //handler: procedure (execute_data:P_zend_execute_data; return_value:Pointer);cdecl;
+      arg_info : P_zend_internal_arg_info;
+      num_args : Cardinal;
+      flags : Cardinal;
+    end;
+  zend_function_entry = _zend_function_entry;
+
+  _php_stream_context = record
+      notifier : P_php_stream_notifier;
+      options : zval;
+      res : P_zend_resource;
+    end;
+   php_stream_context = _php_stream_context ;
+  php_stream_notification_func = procedure (context:P_php_stream_context; notifycode:longint; severity:longint; xmsg:zend_pchar; xcode:longint;
+                bytes_sofar:size_t; bytes_max:size_t; ptr:pointer);cdecl;
+
+
+  _php_stream_notifier = record
+      func : php_stream_notification_func;
+      dtor : procedure (notifier:p_php_stream_notifier);
+      ptr : zval;
+      mask : longint;
+      progress : size_t;
+      progress_max : size_t;
+    end;
+
+
+
+
+
+
+
+
+
+  _php_stream_bucket = record
+      next : P_php_stream_bucket;
+      prev : P_php_stream_bucket;
+      brigade : P_php_stream_bucket_brigade;
+      buf : zend_pchar;
+      buflen : size_t;
+      own_buf : longint;
+      is_persistent : longint;
+      refcount : longint;
+    end;
+
+  _php_stream_bucket_brigade = record
+      head : P_php_stream_bucket;
+      tail : P_php_stream_bucket;
+    end;
+
+  php_stream_bucket = _php_stream_bucket ;
+  php_stream_bucket_brigade = _php_stream_bucket_brigade ;
+
+  php_stream_filter_status_t = (PSFS_ERR_FATAL,PSFS_FEED_ME,PSFS_PASS_ON
+    );
+
+
+  _php_stream_filter_chain = record
+      head : P_php_stream_filter;
+      tail : P_php_stream_filter;
+      stream : P_php_stream;
+    end;
+  php_stream_filter_chain = _php_stream_filter_chain;
+  _php_stream = record
+      ops : Pphp_stream_ops;
+      _abstract : pointer;
+      readfilters : php_stream_filter_chain;
+      writefilters : php_stream_filter_chain;
+      wrapper : P_php_stream_wrapper;
+      wrapperthis : pointer;
+      wrapperdata : zval;
+      fgetss_state : longint;
+      is_persistent : longint;
+      mode : array[0..15] of char;
+      res : P_zend_resource;
+      in_free : longint;
+      fclose_stdiocast : longint;
+      stdiocast : POINTER;
+      __exposed : longint;
+      orig_path : zend_pchar;
+      ctx : P_zend_resource;
+      flags : longint;
+      eof : longint;
+      position : zend_off_t;
+      readbuf : Pbyte;
+      readbuflen : size_t;
+      readpos : zend_off_t;
+      writepos : zend_off_t;
+      chunk_size : size_t;
+      open_filename : zend_pchar;
+      open_lineno : uint;
+      enclosing_stream : P_php_stream;
+    end;
+
+    php_stream = _php_stream   ;
+  _php_stream_filter = record
+      fops : Pphp_stream_filter_ops;
+      _abstract : zval;
+      next : P_php_stream_filter;
+      prev : P_php_stream_filter;
+      is_persistent : longint;
+      chain : Pphp_stream_filter_chain;
+      buffer : php_stream_bucket_brigade;
+      res : P_zend_resource;
+    end;
+    php_stream_filter = _php_stream_filter  ;
+  _php_stream_filter_ops = record
+      filter : function (stream:P_php_stream; thisfilter:P_php_stream_filter; buckets_in:P_php_stream_bucket_brigade; buckets_out:P_php_stream_bucket_brigade; bytes_consumed:Psize_t;
+                   flags:longint):php_stream_filter_status_t;cdecl;
+      dtor : procedure (thisfilter:p_php_stream_filter);cdecl;
+      _label : zend_pchar;
+    end;
+  php_stream_filter_ops = _php_stream_filter_ops;
+
+
+
+
+
+  _php_stream_filter_factory = record
+      create_filter : function (filtername:zend_pchar; filterparams:Pzval; persistent:longint):P_php_stream_filter;cdecl;
+    end;
+  php_stream_filter_factory = _php_stream_filter_factory;
+
+
+
+
+
+
+  _php_stream_statbuf = record
+      sb : zend_stat_t;
+    end;
+  php_stream_statbuf = _php_stream_statbuf;
+
+  _php_stream_dirent = record
+      d_name : array[0..(256)-1] of char;
+    end;
+  php_stream_dirent = _php_stream_dirent;
+
+
+
+  _php_stream_ops = record
+      write : function (stream:P_php_stream; buf:zend_pchar; count:size_t):size_t;cdecl;
+      read : function (stream:P_php_stream; buf:zend_pchar; count:size_t):size_t;cdecl;
+      close : function (stream:P_php_stream; close_handle:longint):longint;cdecl;
+      flush : function (stream:p_php_stream):longint;cdecl;
+      _label : zend_pchar;
+      seek : function (stream:P_php_stream; offset:zend_off_t; whence:longint; newoffset:pzend_off_t):longint;cdecl;
+      cast : function (stream:P_php_stream; castas:longint; ret:ppointer):longint;cdecl;
+      stat : function (stream:P_php_stream; ssb:pphp_stream_statbuf):longint;cdecl;
+      set_option : function (stream:P_php_stream; option:longint; value:longint; ptrparam:pointer):longint;cdecl;
+    end;
+  php_stream_ops = _php_stream_ops;
+
+  _php_stream_wrapper = record
+      wops : Pphp_stream_wrapper_ops;
+      _abstract : pointer;
+      is_url : longint;
+    end;
+  php_stream_wrapper = _php_stream_wrapper   ;
+
+  _php_stream_wrapper_ops = record
+      stream_opener : function (wrapper:P_php_stream_wrapper; filename:zend_pchar; mode:zend_pchar; options:longint; opened_path:PP_zend_string; context:P_php_stream_context; __php_stream_call_depth:longint; __zend_filename:zend_pchar; __zend_lineno:uint; __zend_orig_filename:zend_pchar;  __zend_orig_lineno:uint):P_php_stream;cdecl;
+      stream_closer : function (wrapper:P_php_stream_wrapper; stream:p_php_stream):longint;cdecl;
+      stream_stat : function (wrapper:P_php_stream_wrapper; stream:P_php_stream; ssb:pphp_stream_statbuf):longint;cdecl;
+      url_stat : function (wrapper:P_php_stream_wrapper; url:zend_pchar; flags:longint; ssb:Pphp_stream_statbuf; context:pphp_stream_context):longint;cdecl;
+      dir_opener : function (wrapper:P_php_stream_wrapper; filename:zend_pchar; mode:zend_pchar; options:longint; opened_path:PP_zend_string; context:P_php_stream_context; __php_stream_call_depth:longint; __zend_filename:zend_pchar; __zend_lineno:uint; __zend_orig_filename:zend_pchar;  __zend_orig_lineno:uint):P_php_stream;cdecl;
+      _label : zend_pchar;
+      unlink : function (wrapper:P_php_stream_wrapper; url:zend_pchar; options:longint; context:pphp_stream_context):longint;cdecl;
+      rename : function (wrapper:P_php_stream_wrapper; url_from:zend_pchar; url_to:zend_pchar; options:longint; context:pphp_stream_context):longint;cdecl;
+      stream_mkdir : function (wrapper:P_php_stream_wrapper; url:zend_pchar; mode:longint; options:longint; context:pphp_stream_context):longint;cdecl;
+      stream_rmdir : function (wrapper:P_php_stream_wrapper; url:zend_pchar; options:longint; context:Pphp_stream_context):longint;cdecl;
+      stream_metadata : function (wrapper:P_php_stream_wrapper; url:zend_pchar; options:longint; value:Ppointer; context:Pphp_stream_context):longint;cdecl;
+    end;
+  php_stream_wrapper_ops = _php_stream_wrapper_ops;
+
+
+
+
+
+
+
+  sapi_header_struct = record
+      header : zend_pchar;
+      header_len : size_t;
+    end;
+
+
+
+
+  _zend_llist_element = record
+      next : P_zend_llist_element;
+      prev : P_zend_llist_element;
+      data : array[0..0] of char;
+    end;
+  zend_llist_element = _zend_llist_element;
+
+
+  llist_dtor_func_t = procedure (_para1:pointer);cdecl;
+
+  llist_compare_func_t = function (_para1:PP_zend_llist_element; _para2:PP_zend_llist_element):longint;cdecl;
+
+  llist_apply_with_args_func_t = procedure (data:Ppointer; num_args:longint; args:va_list);cdecl;
+
+  llist_apply_with_arg_func_t = procedure (data:Ppointer; arg:Ppointer);cdecl;
+
+  llist_apply_func_t = procedure (_para1:pointer);cdecl;
+
+  _zend_llist = record
+      head : Pzend_llist_element;
+      tail : Pzend_llist_element;
+      count : size_t;
+      size : size_t;
+      dtor : llist_dtor_func_t;
+      persistent : byte;
+      traverse_ptr : Pzend_llist_element;
+    end;
+  zend_llist = _zend_llist;
+
+  zend_llist_position = Pzend_llist_element;
+
+
+  sapi_headers_struct = record
+      headers : zend_llist;
+      http_response_code : longint;
+      send_default_content_type : byte;
+      mimetype : zend_pchar;
+      http_status_line : zend_pchar;
+    end;
+
+  _sapi_post_entry = record
+      content_type : zend_pchar;
+      content_type_len : uint;
+      post_reader : procedure ;cdecl;
+      post_handler : procedure (content_type_dup:zend_pchar; arg:Ppointer);cdecl;
+    end;
+  sapi_post_entry = _sapi_post_entry;
+
+
+
+  sapi_request_info = record
+      request_method : zend_pchar;
+      query_string : zend_pchar;
+      cookie_data : zend_pchar;
+      content_length : zend_long;
+      path_translated : zend_pchar;
+      request_uri : zend_pchar;
+      request_body : P_php_stream;
+      content_type : zend_pchar;
+      headers_only : zend_bool;
+      no_headers : zend_bool;
+      headers_read : zend_bool;
+      post_entry : P_sapi_post_entry;
+      content_type_dup : zend_pchar;
+      auth_user : zend_pchar;
+      auth_password : zend_pchar;
+      auth_digest : zend_pchar;
+      argv0 : zend_pchar;
+      current_user : zend_pchar;
+      current_user_length : longint;
+      argc : longint;
+      argv : ^zend_pchar;
+      proto_num : longint;
+    end;
+
+
+  _sapi_globals_struct = record
+      server_context : pointer;
+      request_info : sapi_request_info;
+      sapi_headers : sapi_headers_struct;
+      read_post_bytes : FixedUInt ;
+      post_read : byte;
+      headers_sent : byte;
+      global_stat : zend_stat_t;
+      default_mimetype : zend_pchar;
+      default_charset : zend_pchar;
+      rfc1867_uploaded_files : PHashTable;
+      post_max_size : zend_long;
+      options : longint;
+      sapi_started : zend_bool;
+      global_request_time : double;
+      known_post_content_types : HashTable;
+      callback_func : zval;
+      fci_cache : zend_fcall_info_cache;
+    end;
+  sapi_globals_struct = _sapi_globals_struct;
+
+  sapi_header_line = record
+      line : zend_pchar;
+      line_len : size_t;
+      response_code : zend_long;
+    end;
+
+
+
+
+
+  sapi_header_op_enum = (SAPI_HEADER_REPLACE,SAPI_HEADER_ADD_,SAPI_HEADER_DELETE,
+    SAPI_HEADER_DELETE_ALL,SAPI_HEADER_SET_STATUS
+    );
+
+
+  _sapi_module_struct = record
+      name : zend_pchar;
+      pretty_name : zend_pchar;
+      startup : function (sapi_module:P_sapi_module_struct):longint;cdecl;
+      shutdown : function (sapi_module:P_sapi_module_struct):longint;cdecl;
+      activate : function :longint;cdecl;
+      deactivate : function :longint;cdecl;
+      ub_write : function (str:zend_pchar; str_length:size_t):size_t;cdecl;
+      flush : procedure (server_context:Ppointer);cdecl;
+      get_stat : function :P_zend_stat_t;cdecl;
+      getenv : function (name:zend_pchar; name_len:size_t):zend_pchar;cdecl;
+      sapi_error : procedure (_type:longint; error_msg:zend_pchar);cdecl varargs;
+      header_handler : function (sapi_header:Psapi_header_struct; op:sapi_header_op_enum; sapi_headers:Psapi_headers_struct):longint;cdecl;
+      send_headers : function (sapi_headers:Psapi_headers_struct):longint;cdecl;
+      send_header : procedure (sapi_header:Psapi_header_struct; server_context:Ppointer);cdecl;
+      read_post : function (buffer:zend_pchar; count_bytes:size_t):size_t;cdecl;
+      read_cookies : function :zend_pchar;cdecl;
+      register_server_variables : procedure (track_vars_array:Pzval);cdecl;
+      log_message : procedure (message:zend_pchar);cdecl;
+      get_request_time : function :double;cdecl;
+      terminate_process : procedure ;cdecl;
+      php_ini_path_override : zend_pchar;
+      block_interruptions : procedure ;cdecl;
+      unblock_interruptions : procedure ;cdecl;
+      default_post_reader : procedure ;cdecl;
+      treat_data : procedure (arg:longint; str:zend_pchar; destArray:Pzval);cdecl;
+      executable_location : zend_pchar;
+      php_ini_ignore : longint;
+      php_ini_ignore_cwd : longint;
+      get_fd : function (fd:Plongint):longint;cdecl;
+      force_http_10 : function :longint;cdecl;
+      get_target_uid : function (_para1:Puid_t):longint;cdecl;
+      get_target_gid : function (_para1:Pgid_t):longint;cdecl;
+      input_filter : function (arg:longint; _var:zend_pchar; val:PPchar; val_len:size_t; new_val_len:Psize_t):dword;cdecl;
+      ini_defaults : procedure (configuration_hash:PHashTable);cdecl;
+      phpinfo_as_text : longint;
+      ini_entries : zend_pchar;
+      additional_functions : Pzend_function_entry;
+      input_filter_init : function :dword;cdecl;
+    end;
+     sapi_module_struct = _sapi_module_struct;
+
+
+  Ptsrm_intptr_t = ^tsrm_intptr_t;
+  Ptsrm_uintptr_t = ^tsrm_uintptr_t;
+   Pts_rsrc_id = ^ts_rsrc_id;
+
+  tsrm_intptr_t = intptr;
+  tsrm_uintptr_t = uintptr_t;
+
+
+  ts_rsrc_id = longint;
+
+  Pbeos_ben = ^beos_ben;
+  beos_ben = record
+      sem : integer;
+      ben : longint;
+    end;
+
+  ts_allocate_ctor = procedure (_para1:pointer);cdecl;
+
+  ts_allocate_dtor = procedure (_para1:pointer);cdecl;
+
+  tsrm_thread_begin_func_t = procedure (thread_id:DWORD);cdecl;
+
+  tsrm_thread_end_func_t = procedure (thread_id:DWORD);cdecl;
+
+
+
+  zend_ini_entry = _zend_ini_entry ;
+
+
+
+  _zend_arena = record
+      ptr : zend_pchar;
+      _end : zend_pchar;
+      prev : P_zend_arena;
+    end;
+   zend_arena = _zend_arena;
+  _zend_compiler_globals = record
+      loop_var_stack : zend_stack;
+      active_class_entry : P_zend_class_entry;
+      compiled_filename : P_zend_string;
+      zend_lineno : longint;
+      active_op_array : P_zend_op_array;
+      function_table : PHashTable;
+      class_table : PHashTable;
+      filenames_table : HashTable;
+      auto_globals : PHashTable;
+      parse_error : zend_bool;
+      in_compilation : zend_bool;
+      short_tags : zend_bool;
+      unclean_shutdown : zend_bool;
+      ini_parser_unbuffered_errors : zend_bool;
+      open_files : zend_llist;
+      ini_parser_param : P_zend_ini_parser_param;
+      start_lineno : uint32_t;
+      increment_lineno : zend_bool;
+      doc_comment : P_zend_string;
+      compiler_options : uint32_t;
+      const_filenames : HashTable;
+      context : zend_oparray_context;
+      file_context : zend_file_context;
+      arena : P_zend_arena;
+      empty_string : P_zend_string;
+      one_char_string : array[0..255] of P_zend_string;
+      interned_strings : HashTable;
+      script_encoding_list : PPzend_encoding;
+      script_encoding_list_size : size_t;
+      multibyte : zend_bool;
+      detect_unicode : zend_bool;
+      encoding_declared : zend_bool;
+      ast : P_zend_ast;
+      ast_arena : P_zend_arena;
+      delayed_oplines_stack : pointer;
+      static_members_table : ^Pzval;
+      last_static_member : longint;
+    end;
+
+
+  _zend_objects_store = record
+      object_buckets : ^P_zend_object;
+      top : uint32_t;
+      size : uint32_t;
+      free_list_head : longint;
+    end;
+  zend_objects_store = _zend_objects_store;
+
+
+  _zend_executor_globals = record
+      uninitialized_zval : zval;
+      error_zval : zval;
+      symtable_cache : array[0..(32)-1] of P_zend_array;
+      symtable_cache_limit : ^P_zend_array;
+      symtable_cache_ptr : ^P_zend_array;
+      symbol_table : zend_array;
+      included_files : HashTable;
+      bailout : pointer;
+      error_reporting : longint;
+      exit_status : longint;
+      function_table : PHashTable;
+      class_table : PHashTable;
+      zend_constants : PHashTable;
+      vm_stack_top : Pzval;
+      vm_stack_end : Pzval;
+      vm_stack : _zend_vm_stack;
+      current_execute_data : P_zend_execute_data;
+      scope : P_zend_class_entry;
+      precision : zend_long;
+      ticks_count : longint;
+      in_autoload : PHashTable;
+      autoload_func : P_zend_function;
+      full_tables_cleanup : zend_bool;
+      no_extensions : zend_bool;
+      timed_out : zend_bool;
+      windows_version_info : OSVERSIONINFOEX;
+      regular_list : HashTable;
+      persistent_list : HashTable;
+      user_error_handler_error_reporting : longint;
+      user_error_handler : zval;
+      user_exception_handler : zval;
+      user_error_handlers_error_reporting : zend_stack;
+      user_error_handlers : zend_stack;
+      user_exception_handlers : zend_stack;
+      error_handling : zend_error_handling_t;
+      exception_class : P_zend_class_entry;
+      timeout_seconds : zend_long;
+      lambda_count : longint;
+      ini_directives : PHashTable;
+      modified_ini_directives : PHashTable;
+      error_reporting_ini_entry : P_zend_ini_entry;
+      objects_store : zend_objects_store;
+      exception : P_zend_object;
+      prev_exception : P_zend_object;
+      opline_before_exception : P_zend_op;
+      exception_op : array[0..2] of zend_op;
+      current_module : P_zend_module_entry;
+      active : zend_bool;
+      valid_symbol_table : zend_bool;
+      assertions : zend_long;
+      ht_iterators_count : uint32_t;
+      ht_iterators_used : uint32_t;
+      ht_iterators : PHashTableIterator;
+      ht_iterators_slots : array[0..15] of HashTableIterator;
+     // saved_fpu_cw_ptr : pointer;
+      saved_fpu_cw : LONGINT;
+      trampoline : zend_function;
+      call_trampoline_op : zend_op;
+      reserved : array[0..(4)-1] of pointer;
+    end;
+
+  _zend_ini_scanner_globals = record
+      yy_in : Pzend_file_handle;
+      yy_out : Pzend_file_handle;
+      yy_leng : dword;
+      yy_start : Pbyte;
+      yy_text : Pbyte;
+      yy_cursor : Pbyte;
+      yy_marker : Pbyte;
+      yy_limit : Pbyte;
+      yy_state : longint;
+      state_stack : zend_stack;
+      filename : zend_pchar;
+      lineno : longint;
+      scanner_mode : longint;
+    end;
+
+  _zend_ptr_stack = record
+      top : longint;
+      max : longint;
+      elements : ^pointer;
+      top_element : ^pointer;
+      persistent : zend_bool;
+    end;
+  zend_ptr_stack = _zend_ptr_stack;
+
+
+
+
+  zend_encoding_filter = function (str:LPBYTE; str_length:Psize_t; buf:Pbyte; length:size_t):size_t;cdecl;
+
+  Pzend_encoding_fetcher = ^zend_encoding_fetcher;
+  zend_encoding_fetcher = function (encoding_name:zend_pchar):Pzend_encoding;cdecl;
+
+  Pzend_encoding_name_getter = ^zend_encoding_name_getter;
+  zend_encoding_name_getter = function (encoding:Pzend_encoding):zend_pchar;cdecl;
+
+  zend_encoding_lexer_compatibility_checker = function (encoding:Pzend_encoding):longint;cdecl;
+
+  zend_encoding_detector = function (_string:Pbyte; length:size_t; list:PPzend_encoding; list_size:size_t):Pzend_encoding;cdecl;
+
+  zend_encoding_converter = function (_to:LPBYTE; to_length:Psize_t; from:Pbyte; from_length:size_t; encoding_to:Pzend_encoding;
+               encoding_from:Pzend_encoding):size_t;cdecl;
+
+  zend_encoding_list_parser = function (encoding_list:zend_pchar; encoding_list_len:size_t; return_list:PPPzend_encoding; return_size:Psize_t; persistent:longint):longint;cdecl;
+
+  zend_encoding_internal_encoding_getter = function :Pzend_encoding;cdecl;
+
+  zend_encoding_internal_encoding_setter = function (encoding:Pzend_encoding):longint;cdecl;
+
+
+  _zend_multibyte_functions = record
+      provider_name : zend_pchar;
+      encoding_fetcher : zend_encoding_fetcher;
+      encoding_name_getter : zend_encoding_name_getter;
+      lexer_compatibility_checker : zend_encoding_lexer_compatibility_checker;
+      encoding_detector : zend_encoding_detector;
+      encoding_converter : zend_encoding_converter;
+      encoding_list_parser : zend_encoding_list_parser;
+      internal_encoding_getter : zend_encoding_internal_encoding_getter;
+      internal_encoding_setter : zend_encoding_internal_encoding_setter;
+    end;
+  zend_multibyte_functions = _zend_multibyte_functions;
+
+  _zend_leak_info = record
+      addr : pointer;
+      size : size_t;
+      filename : zend_pchar;
+      orig_filename : zend_pchar;
+      lineno : uint;
+      orig_lineno : uint;
+    end;
+  zend_leak_info = _zend_leak_info;
+
+
+
+  _zend_mm_debug_info = record
+      size : size_t;
+      filename : zend_pchar;
+      orig_filename : zend_pchar;
+      lineno : uint;
+      orig_lineno : uint;
+    end;
+  zend_mm_debug_info = _zend_mm_debug_info;
+
+  _zend_mm_heap = record
+      use_custom_heap : longint;
+      storage : P_zend_mm_storage;
+      size : size_t;
+      peak : size_t;
+      free_slot : array[0..(30)-1] of P_zend_mm_free_slot;
+      real_size : size_t;
+      real_peak : size_t;
+      limit : size_t;
+      overflow : longint;
+      huge_list : P_zend_mm_huge_list;
+      main_chunk : P_zend_mm_chunk;
+      cached_chunks : P_zend_mm_chunk;
+      chunks_count : longint;
+      peak_chunks_count : longint;
+      cached_chunks_count : longint;
+      avg_chunks_count : double;
+      custom_heap : record
+          case longint of
+            0 : ( std : record
+                _malloc : function (_para1:size_t):pointer;cdecl;
+                _free : procedure (_para1:pointer);cdecl;
+                _realloc : function (_para1:pointer; _para2:size_t):pointer;cdecl;
+              end );
+            1 : ( debug : record
+                _malloc : function (g:size_t; __zend_filename:zend_pchar; __zend_lineno:uint; __zend_orig_filename:zend_pchar; __zend_orig_lineno:uint):pointer;cdecl;
+                _free : procedure (g:Ppointer; __zend_filename:zend_pchar; __zend_lineno:uint; __zend_orig_filename:zend_pchar; __zend_orig_lineno:uint);cdecl;
+                _realloc : function (g:Ppointer; gg:size_t; __zend_filename:zend_pchar; __zend_lineno:uint; __zend_orig_filename:zend_pchar;
+                             __zend_orig_lineno:uint):pointer;cdecl;
+              end );
+          end;
+    end;
+
+
+  _zend_mm_chunk = record
+      heap : P_zend_mm_heap;
+      next : P_zend_mm_chunk;
+      prev : P_zend_mm_chunk;
+      free_pages : longint;
+      free_tail : longint;
+      num : longint;
+      reserve : array[0..(64 - (sizeof(POINTER) * 3 + sizeof(integer) * 3))] of char;
+      heap_slot : _zend_mm_heap;
+      free_map : pointer;
+      map : Pointer;
+    end;
+
+  _zend_mm_page = record
+      bytes : array[0..(4 * 1024)-1] of char;
+    end;
+
+  _zend_mm_bin = record
+      bytes : array[0..(4 * 1024*8)-1] of char;
+    end;
+
+  _zend_mm_free_slot = record
+      next_free_slot : P_zend_mm_free_slot;
+    end;
+
+
+  _zend_mm_huge_list = record
+      ptr : pointer;
+      size : size_t;
+      next : P_zend_mm_huge_list;
+      dbg : zend_mm_debug_info;
+    end;
+
+
+
+  zend_mm_chunk_alloc_t = function (storage:PPointer; size:size_t; alignment:size_t):pointer;cdecl;
+
+  zend_mm_chunk_free_t = procedure (storage:PPointer; chunk:Ppointer; size:size_t);cdecl;
+
+  zend_mm_chunk_truncate_t = function (storage:PPointer; chunk:Ppointer; old_size:size_t; new_size:size_t):longint;cdecl;
+
+  zend_mm_chunk_extend_t = function (storage:PPointer; chunk:Ppointer; old_size:size_t; new_size:size_t):longint;cdecl;
+
+
+
+  zend_mm_heap =_zend_mm_heap ;
+   _zend_mm_handlers = record
+      chunk_alloc : zend_mm_chunk_alloc_t;
+      chunk_free : zend_mm_chunk_free_t;
+      chunk_truncate : zend_mm_chunk_truncate_t;
+      chunk_extend : zend_mm_chunk_extend_t;
+    end;
+  zend_mm_handlers = _zend_mm_handlers;
+  _zend_mm_storage = record
+      handlers : zend_mm_handlers;
+      data : pointer;
+    end;
+    zend_mm_storage = _zend_mm_storage ;
+
+
+  _zend_closure = record
+      std : zend_object;
+      func : zend_function;
+      this_ptr : zval;
+      called_scope : Pzend_class_entry;
+      orig_internal_handler : procedure (var execute_data:zend_execute_data; var return_value:zval);cdecl;
+    end;
+  zend_closure = _zend_closure;
+
+
+
+  _zend_php_scanner_globals = record
+      yy_in : Pzend_file_handle;
+      yy_out : Pzend_file_handle;
+      yy_leng : dword;
+      yy_start : Pbyte;
+      yy_text : Pbyte;
+      yy_cursor : Pbyte;
+      yy_marker : Pbyte;
+      yy_limit : Pbyte;
+      yy_state : longint;
+      state_stack : zend_stack;
+      heredoc_label_stack : zend_ptr_stack;
+      script_org : Pbyte;
+      script_org_size : size_t;
+      script_filtered : Pbyte;
+      script_filtered_size : size_t;
+      input_filter : zend_encoding_filter;
+      output_filter : zend_encoding_filter;
+      script_encoding : Pzend_encoding;
+      scanned_string_len : longint;
+      on_event : procedure (event:zend_php_scanner_event; token:longint; line:longint);cdecl;
+    end;
+
+  Pzend_hash_key = ^Tzend_hash_key;
+  Tzend_hash_key = record
+      h : zend_ulong;
+      key : Pzend_string;
+    end;
+
+   Tsmart_str = record
+      s:Pzend_string;
+      a:size_t;
+   end;
+
+
+
+
+
+  Tmerge_checker_func_t = function (target_ht:PHashTable; source_data:Pzval; hash_key:Pzend_hash_key; pParam:Ppointer):zend_bool;cdecl;
+  Tapply_func_t = function (pDest:Pzval):longint;cdecl;
+  Tapply_func_arg_t = function (pDest:Pzval; argument:Ppointer):longint;cdecl;
+  Tapply_func_args_t = function (pDest:Pzval; num_args:longint; args:va_list; hash_key:Pzend_hash_key):longint;cdecl;
+
+
+
+
+
+IEJORGJIERGE = procedure (ini_entry:P_zend_ini_entry; _type:longint);
+EWKGERGJ945YG45 = procedure (_para1:size_t);
+OERGJOERJGIERGHRE = procedure (_para1:size_t);
+
+ERG4JG09E84GJ8945H45H = procedure (_para1:pointer; _para2:size_t; __zend_filename:zend_pchar; __zend_lineno:uint; __zend_orig_filename:zend_pchar; __zend_orig_lineno:uint);
+EWFG439EGRG45 =   procedure (_para1:pointer);
+G5J90E4GK495Y4  = procedure (_para1:pointer);
+  f584hj4i5hth = procedure (_para1:pointer);
+  KD45T5H65HTHRTH = function (element:Ppointer; arg:Ppointer):longint;
+  IEJG9458U9845Y45 = function (element:Ppointer):longint;
+  ERGERG43T4T545YH546 = function (element1:Ppointer; element2:Ppointer):longint;
+ RGEKG34I9TI3434 = function (data:Ppointer):longint;
+var
+smart_str_erealloc:procedure(str:psmart_str; len:size_t);cdecl;
+smart_str_realloc:procedure(str:psmart_str; len:size_t); cdecl;
+tsrm_set_new_thread_begin_handler:function(new_thread_begin_handler:tsrm_thread_begin_func_t):pointer; cdecl;
+tsrm_set_new_thread_end_handler:function(new_thread_end_handler:tsrm_thread_end_func_t):pointer; cdecl;
+tsrm_new_interpreter_context:function:pointer; cdecl;
+tsrm_set_interpreter_context:function(new_ctx:Ppointer):pointer; cdecl;
+tsrm_free_interpreter_context:procedure(context:Ppointer); cdecl;
+tsrm_get_ls_cache:function:pointer; cdecl;
+tsrm_error_set:procedure(level:longint; debug_filename:zend_pchar); cdecl;
+tsrm_thread_id:function:DWORD; cdecl;
+tsrm_mutex_alloc:function:pointer; cdecl;
+tsrm_mutex_free:procedure(mutexp:Ppointer); cdecl;
+tsrm_mutex_lock:function(mutexp:Ppointer):longint; cdecl;
+tsrm_mutex_unlock:function(mutexp:Ppointer):longint; cdecl;
+tsrm_startup:function(expected_threads:longint; expected_resources:longint; debug_level:longint; debug_filename:zend_pchar):longint; cdecl;
+tsrm_shutdown:procedure; cdecl;
+ts_allocate_id:function(rsrc_id:Pts_rsrc_id; size:size_t; ctor:ts_allocate_ctor; dtor:ts_allocate_dtor):ts_rsrc_id; cdecl;
+ts_resource_ex:function(id:ts_rsrc_id; th_id:pointer):pointer; cdecl;
+ts_free_thread:procedure; cdecl;
+ts_free_id:procedure(id:ts_rsrc_id); cdecl;
+php_request_startup:function:longint; cdecl;
+php_request_shutdown:procedure( dummy:pointer); cdecl;
+php_request_shutdown_for_exec:procedure(dummy:Ppointer); cdecl;
+php_module_startup:function( sf:p_sapi_module_struct; additional_modules:p_zend_module_entry; num_additional_modules:uint):longint; cdecl;
+php_module_shutdown:procedure; cdecl;
+php_module_shutdown_for_exec:procedure; cdecl;
+php_module_shutdown_wrapper:function(sapi_globals:Psapi_module_struct):longint; cdecl;
+php_request_startup_for_hook:function:longint; cdecl;
+php_request_shutdown_for_hook:procedure(dummy:Ppointer); cdecl;
+php_register_extensions:function(ptr:PP_zend_module_entry; count:longint):longint; cdecl;
+php_execute_script:function( primary_file:p_zend_file_handle):longint; cdecl;
+php_execute_simple_script:function(primary_file:Pzend_file_handle; ret:Pzval):longint; cdecl;
+php_handle_special_queries:function:longint; cdecl;
+php_lint_script:function(_file:Pzend_file_handle):longint; cdecl;
+php_handle_aborted_connection:procedure; cdecl;
+php_handle_auth_data:function(auth:zend_pchar):longint; cdecl;
+php_html_puts:procedure(str:zend_pchar; siz:size_t); cdecl;
+php_stream_open_for_zend_ex:function(filename:zend_pchar; handle:Pzend_file_handle; mode:longint):longint; cdecl;
+
+
+zend_strndup:function(s:zend_pchar; length:size_t):zend_pchar; cdecl;
+_emalloc:function(size:size_t; __zend_filename:zend_pchar; __zend_lineno:uint; __zend_orig_filename:zend_pchar; __zend_orig_lineno:uint):pointer; cdecl;
+_safe_emalloc:function(nmemb:size_t; size:size_t; offset:size_t; __zend_filename:zend_pchar; __zend_lineno:uint;  __zend_orig_filename:zend_pchar; __zend_orig_lineno:uint):pointer; cdecl;
+_safe_malloc:function(nmemb:size_t; size:size_t; offset:size_t):pointer; cdecl;
+_efree:procedure(ptr:Ppointer; __zend_filename:zend_pchar; __zend_lineno:uint; __zend_orig_filename:zend_pchar; __zend_orig_lineno:uint); cdecl;
+_ecalloc:function(nmemb:size_t; size:size_t; __zend_filename:zend_pchar; __zend_lineno:uint; __zend_orig_filename:zend_pchar;  __zend_orig_lineno:uint):pointer; cdecl;
+_erealloc:function(ptr:Ppointer; size:size_t; __zend_filename:zend_pchar; __zend_lineno:uint; __zend_orig_filename:zend_pchar; __zend_orig_lineno:uint):pointer; cdecl;
+_erealloc2:function(ptr:Ppointer; size:size_t; copy_size:size_t; __zend_filename:zend_pchar; __zend_lineno:uint; __zend_orig_filename:zend_pchar; __zend_orig_lineno:uint):pointer; cdecl;
+_safe_erealloc:function(ptr:Ppointer; nmemb:size_t; size:size_t; offset:size_t; __zend_filename:zend_pchar; __zend_lineno:uint; __zend_orig_filename:zend_pchar; __zend_orig_lineno:uint):pointer; cdecl;
+_safe_realloc:function(ptr:Ppointer; nmemb:size_t; size:size_t; offset:size_t):pointer; cdecl;
+_estrdup:function(s:zend_pchar; __zend_filename:zend_pchar; __zend_lineno:uint; __zend_orig_filename:zend_pchar; __zend_orig_lineno:uint):zend_pchar; cdecl;
+_estrndup:function(s:zend_pchar; length:size_t; __zend_filename:zend_pchar; __zend_lineno:uint; __zend_orig_filename:zend_pchar; __zend_orig_lineno:uint):zend_pchar; cdecl;
+_zend_mem_block_size:function(ptr:Ppointer; __zend_filename:zend_pchar; __zend_lineno:uint; __zend_orig_filename:zend_pchar; __zend_orig_lineno:uint):size_t; cdecl;
+_emalloc_large:function(size:size_t):pointer; cdecl;
+_emalloc_huge:function(size:size_t):pointer; cdecl;
+_efree_large:procedure(_para1:pointer; size:size_t); cdecl;
+_efree_huge:procedure(_para1:pointer; size:size_t); cdecl;
+__zend_malloc:function(len:size_t):pointer; cdecl;
+__zend_calloc:function(nmemb:size_t; len:size_t):pointer; cdecl;
+__zend_realloc:function(p:Ppointer; len:size_t):pointer; cdecl;
+zend_set_memory_limit:function(memory_limit:size_t):longint; cdecl;
+start_memory_manager:procedure; cdecl;
+shutdown_memory_manager:procedure(silent:longint; full_shutdown:longint); cdecl;
+is_zend_mm:function:longint; cdecl;
+zend_memory_usage:function(real_usage:longint):size_t; cdecl;
+zend_memory_peak_usage:function(real_usage:longint):size_t; cdecl;
+zend_mm_startup:function:P_zend_mm_heap; cdecl;
+zend_mm_shutdown:procedure(heap:P_zend_mm_heap; full_shutdown:longint; silent:longint); cdecl;
+_zend_mm_alloc:function(heap:P_zend_mm_heap; size:size_t; __zend_filename:zend_pchar; __zend_lineno:uint; __zend_orig_filename:zend_pchar; __zend_orig_lineno:uint):pointer; cdecl;
+_zend_mm_free:procedure(heap:P_zend_mm_heap; p:Ppointer; __zend_filename:zend_pchar; __zend_lineno:uint; __zend_orig_filename:zend_pchar; __zend_orig_lineno:uint); cdecl;
+_zend_mm_realloc:function(heap:P_zend_mm_heap; p:Ppointer; size:size_t; __zend_filename:zend_pchar; __zend_lineno:uint; __zend_orig_filename:zend_pchar; __zend_orig_lineno:uint):pointer; cdecl;
+_zend_mm_realloc2:function(heap:P_zend_mm_heap; p:Ppointer; size:size_t; copy_size:size_t; __zend_filename:zend_pchar; __zend_lineno:uint; __zend_orig_filename:zend_pchar; __zend_orig_lineno:uint):pointer; cdecl;
+_zend_mm_block_size:function(heap:P_zend_mm_heap; p:Ppointer; __zend_filename:zend_pchar; __zend_lineno:uint; __zend_orig_filename:zend_pchar; __zend_orig_lineno:uint):size_t; cdecl;
+zend_mm_set_heap:function(new_heap:Pzend_mm_heap):P_zend_mm_heap; cdecl;
+zend_mm_get_heap:function:P_zend_mm_heap; cdecl;
+zend_mm_gc:function(heap:Pzend_mm_heap):size_t; cdecl;
+zend_mm_is_custom_heap:function(new_heap:Pzend_mm_heap):longint; cdecl;
+
+zend_mm_get_storage:function(heap:Pzend_mm_heap):P_zend_mm_storage; cdecl;
+zend_mm_startup_ex:function(handlers:Pzend_mm_handlers; data:Ppointer; data_size:size_t):P_zend_mm_heap; cdecl;
+
+
+ zend_stack_init:function(stack:Pzend_stack; size:longint):longint;
+ zend_stack_push:function(stack:Pzend_stack; element:Ppointer):longint;
+ zend_stack_top:function(stack:Pzend_stack):pointer;
+ zend_stack_del_top:function(stack:Pzend_stack):longint;
+ zend_stack_int_top:function(stack:Pzend_stack):longint;
+ zend_stack_is_empty:function(stack:Pzend_stack):longint;
+ zend_stack_destroy:function(stack:Pzend_stack):longint;
+ zend_stack_base:function(stack:Pzend_stack):pointer;
+ zend_stack_count:function(stack:Pzend_stack):longint;
+ zend_stack_apply:procedure(stack:Pzend_stack; _type:longint; apply_function:IEJG9458U9845Y45);
+ zend_stack_apply_with_argument:procedure(stack:Pzend_stack; _type:longint; apply_function:KD45T5H65HTHRTH; arg:Ppointer);
+ zend_stack_clean:procedure(stack:Pzend_stack; func:f584hj4i5hth; free_elements:zend_bool);
+
+	zend_std_get_static_method:function(ce:P_zend_class_entry; function_name_strval:P_zend_string; key:Pzval):P_zend_function; cdecl;
+	zend_std_get_static_property:function(ce:P_zend_class_entry; property_name:P_zend_string; silent:zend_bool):Pzval; cdecl;
+	zend_std_unset_static_property:function(ce:P_zend_class_entry; property_name:P_zend_string):zend_bool; cdecl;
+	zend_std_get_constructor:function(_object:Pzend_object):P_zend_function; cdecl;
+	zend_get_property_info:function(ce:P_zend_class_entry; member:P_zend_string; silent:longint):P_zend_property_info; cdecl;
+	zend_std_get_properties:function(_object:Pzval):PHashTable; cdecl;
+	zend_std_get_debug_info:function(_object:Pzval; is_temp:Plongint):PHashTable; cdecl;
+	zend_std_cast_object_tostring:function(readobj:Pzval; writeobj:Pzval; _type:longint):longint; cdecl;
+	zend_std_write_property:procedure(_object:Pzval; member:Pzval; value:Pzval; cache_slot:Ppointer); cdecl;
+	rebuild_object_properties:procedure(zobj:Pzend_object); cdecl;
+	zend_check_private:function(fbc:P_zend_function; ce:P_zend_class_entry; function_name:Pzend_string):longint; cdecl;
+	zend_check_protected:function(ce:P_zend_class_entry; scope:Pzend_class_entry):longint; cdecl;
+	zend_check_property_access:function(zobj:P_zend_object; prop_info_name:P_zend_string):longint; cdecl;
+	zend_get_call_trampoline_func:function(ce:P_zend_class_entry; method_name:P_zend_string; is_static:longint):P_zend_function; cdecl;
+	zend_ast_create_znode:function(node:Pznode):P_zend_ast; cdecl;
+	lex_scan:function(zendlval:Pzval):longint; cdecl;
+	zend_set_compiled_filename:function(new_compiled_filename:P_zend_string):P_zend_string; cdecl;
+	zend_restore_compiled_filename:procedure(original_compiled_filename:P_zend_string); cdecl;
+	zend_get_compiled_filename:function:P_zend_string; cdecl;
+	zend_get_compiled_lineno:function:longint; cdecl;
+	zend_get_scanned_file_offset:function:size_t; cdecl;
+	zend_get_compiled_variable_name:function(op_array:P_zend_op_array; _var:Cardinal):P_zend_string; cdecl;
+	get_unary_op:function(opcode:longint):unary_op_type; cdecl;
+	get_binary_op:function(opcode:longint):binary_op_type; cdecl;
+	do_bind_function:function(op_array:P_zend_op_array; opline:P_zend_op; function_table:PHashTable; compile_time:zend_bool):longint; cdecl;
+	do_bind_class:function(op_array:P_zend_op_array; opline:P_zend_op; class_table:PHashTable; compile_time:zend_bool):P_zend_class_entry; cdecl;
+	do_bind_inherited_class:function(op_array:P_zend_op_array; opline:P_zend_op; class_table:PHashTable; parent_ce:P_zend_class_entry; compile_time:zend_bool):P_zend_class_entry; cdecl;
+	zend_do_delayed_early_binding:procedure(op_array:Pzend_op_array); cdecl;
+	function_add_ref:procedure(_function:Pzend_function); cdecl;
+	compile_file:function(file_handle:Pzend_file_handle; _type:longint):P_zend_op_array; cdecl;
+	compile_string:function(source_string:Pzval; filename:zend_pchar):P_zend_op_array; cdecl;
+	compile_filename:function(_type:longint; filename:Pzval):P_zend_op_array; cdecl;
+	zend_try_exception_handler:procedure; cdecl;
+	zend_execute_scripts:function(_type:longint; retval:Pzval; file_count:longint):longint; cdecl varargs;
+	open_file_for_scanning:function(file_handle:Pzend_file_handle):longint; cdecl;
+	init_op_array:procedure(op_array:P_zend_op_array; _type:zend_uchar; initial_ops_size:longint); cdecl;
+	destroy_op_array:procedure(op_array:Pzend_op_array); cdecl;
+	zend_destroy_file_handle:procedure(file_handle:Pzend_file_handle); cdecl;
+	zend_cleanup_user_class_data:procedure(ce:Pzend_class_entry); cdecl;
+	zend_cleanup_internal_class_data:procedure(ce:Pzend_class_entry); cdecl;
+	zend_cleanup_internal_classes:procedure; cdecl;
+	zend_cleanup_op_array_data:procedure(op_array:Pzend_op_array); cdecl;
+	clean_non_persistent_function_full:function(zv:Pzval):longint; cdecl;
+	clean_non_persistent_class_full:function(zv:Pzval):longint; cdecl;
+	destroy_zend_function:procedure(_function:Pzend_function); cdecl;
+	zend_function_dtor:procedure(zv:Pzval); cdecl;
+	destroy_zend_class:procedure(zv:Pzval); cdecl;
+	zend_mangle_property_name:function(src1:zend_pchar; src1_length:size_t; src2:zend_pchar; src2_length:size_t; internal:longint):P_zend_string; cdecl;
+	zend_unmangle_property_name_ex:function(name:Pzend_string; class_name:PPchar; prop_name:PPchar; prop_len:Psize_t):longint; cdecl;
+	pass_two:function(op_array:Pzend_op_array):longint; cdecl;
+	zend_is_compiling:function:zend_bool; cdecl;
+	zend_make_compiled_string_description:function(name:zend_pchar):zend_pchar; cdecl;
+	zend_initialize_class_data:procedure(ce:Pzend_class_entry; nullify_handlers:zend_bool); cdecl;
+	zend_get_call_op:function(init_op:zend_uchar; fbc:Pzend_function):zend_uchar; cdecl;
+	zend_register_auto_global:function(name:Pzend_string; jit:zend_bool; auto_global_callback:zend_auto_global_callback):longint; cdecl;
+	zend_activate_auto_globals:procedure; cdecl;
+	zend_is_auto_global:function(name:Pzend_string):zend_bool; cdecl;
+	zend_is_auto_global_str:function(name:zend_pchar; len:size_t):zend_bool; cdecl;
+	zend_dirname:function(path:zend_pchar; len:size_t):size_t; cdecl;
+	zend_set_function_arg_flags:procedure(func:Pzend_function); cdecl;
+	zend_assert_valid_class_name:procedure(const_name:Pzend_string); cdecl;
+	zend_ast_create_zval_ex:function(zv:Pzval; attr:zend_ast_attr):P_zend_ast; cdecl;
+	zend_ast_create_ex:function(kind:zend_ast_kind; attr:zend_ast_attr):P_zend_ast; cdecl varargs;
+	zend_ast_create:function(kind:zend_ast_kind):P_zend_ast; cdecl varargs;
+	zend_ast_create_decl:function(kind:zend_ast_kind; flags:Cardinal; start_lineno:Cardinal; doc_comment:Pzend_string; name:Pzend_string;  child0:Pzend_ast; child1:Pzend_ast; child2:Pzend_ast; child3:Pzend_ast):P_zend_ast; cdecl;
+	zend_ast_create_list:function(init_children:Cardinal; kind:zend_ast_kind):P_zend_ast; cdecl varargs;
+	zend_ast_list_add:function(list:Pzend_ast; op:Pzend_ast):P_zend_ast; cdecl;
+	zend_ast_evaluate:function(result:Pzval; ast:Pzend_ast; scope:Pzend_class_entry):longint; cdecl;
+	zend_ast_export:function(prefix:zend_pchar; ast:Pzend_ast; suffix:zend_pchar):P_zend_string; cdecl;
+	zend_ast_copy:function(ast:Pzend_ast):P_zend_ast; cdecl;
+	zend_ast_destroy:procedure(ast:Pzend_ast); cdecl;
+	zend_ast_destroy_and_free:procedure(ast:Pzend_ast); cdecl;
+	zend_ast_apply:procedure(ast:Pzend_ast; fn:zend_ast_apply_func); cdecl;
+	zend_stream_open:function(filename:zend_pchar; handle:Pzend_file_handle):longint; cdecl;
+	zend_stream_fixup:function(file_handle:Pzend_file_handle; buf:PPchar; len:Psize_t):longint; cdecl;
+	zend_file_handle_dtor:procedure(fh:Pzend_file_handle); cdecl;
+	zend_compare_file_handles:function(fh1:Pzend_file_handle; fh2:Pzend_file_handle):longint; cdecl;
+	zend_startup:function(utility_functions:Pzend_utility_functions; extensions:PPchar):longint; cdecl;
+	zend_shutdown:procedure; cdecl;
+	zend_register_standard_ini_entries:procedure; cdecl;
+	zend_post_startup:procedure; cdecl;
+	zend_set_utility_values:procedure(utility_values:Pzend_utility_values); cdecl;
+	_zend_bailout:procedure(filename:zend_pchar; lineno:uint); cdecl;
+	get_zend_version:function:zend_pchar; cdecl;
+	zend_make_printable_zval:function(expr:Pzval; expr_copy:Pzval):longint; cdecl;
+	zend_print_zval:function(expr:Pzval; indent:longint):size_t; cdecl;
+	zend_print_zval_ex:function(write_func:zend_write_func_t; expr:Pzval; indent:longint):size_t; cdecl;
+	zend_print_zval_r:procedure(expr:Pzval; indent:longint); cdecl;
+	zend_print_flat_zval_r:procedure(expr:Pzval); cdecl;
+	zend_print_zval_r_ex:procedure(write_func:zend_write_func_t; expr:Pzval; indent:longint); cdecl;
+	zend_output_debug_string:procedure(trigger_break:zend_bool; format:zend_pchar); cdecl varargs;
+	zend_activate:procedure; cdecl;
+	zend_deactivate:procedure; cdecl;
+	zend_call_destructors:procedure; cdecl;
+	zend_activate_modules:procedure; cdecl;
+	zend_deactivate_modules:procedure; cdecl;
+	zend_post_deactivate_modules:procedure; cdecl;
+	free_estring:procedure(str_p:PPchar); cdecl;
+	zend_error:procedure(_type:longint; format:zend_pchar); cdecl varargs;
+	zend_throw_error:procedure(exception_ce:Pzend_class_entry; format:zend_pchar); cdecl varargs;
+	zend_type_error:procedure(format:zend_pchar); cdecl varargs;
+	zend_internal_type_error:procedure(throw_exception:zend_bool; format:zend_pchar); cdecl varargs;
+	zenderror:procedure(error:zend_pchar); cdecl;
+	zend_message_dispatcher:procedure(message:zend_long; data:Ppointer); cdecl;
+	zend_get_configuration_directive:function(name:Pzend_string):Pzval; cdecl;
+	zend_next_free_module:function:longint cdecl;
+	zend_get_parameters:function(ht:longint; param_count:longint):longint; cdecl varargs;
+	zend_get_parameters_ex:function(param_count:longint):longint; cdecl varargs;
+   ZvalGetArgs: function(Count: Integer; Args: ppzval): Integer;cdecl varargs;
+	_zend_get_parameters_array_ex:function(param_count:longint; argument_array:Pzval):longint; cdecl;
+	zend_copy_parameters_array:function(param_count:longint; argument_array:Pzval):longint; cdecl;
+	zend_parse_parameters:function(num_args:longint; type_spec:zend_pchar):longint; cdecl varargs;
+	zend_parse_parameters_ex:function(flags:longint; num_args:longint; type_spec:zend_pchar):longint; cdecl varargs;
+	zend_parse_parameters_throw:function(num_args:longint; type_spec:zend_pchar):longint; cdecl varargs;
+	zend_zval_type_name:function(arg:Pzval):zend_pchar; cdecl;
+	zend_parse_method_parameters:function(num_args:longint; this_ptr:Pzval; type_spec:zend_pchar):longint; cdecl varargs;
+	zend_parse_method_parameters_ex:function(flags:longint; num_args:longint; this_ptr:Pzval; type_spec:zend_pchar):longint; cdecl varargs;
+	zend_parse_parameter:function(flags:longint; arg_num:longint; arg:Pzval; spec:zend_pchar):longint; cdecl varargs;
+	zend_register_functions:function(scope:Pzend_class_entry; functions:Pzend_function_entry; function_table:PHashTable; _type:longint):longint; cdecl;
+	zend_unregister_functions:procedure(functions:Pzend_function_entry; count:longint; function_table:PHashTable); cdecl;
+	zend_startup_module:function(module_entry:Pzend_module_entry):longint; cdecl;
+	zend_register_internal_module:function(module_entry:Pzend_module_entry):P_zend_module_entry; cdecl;
+	zend_register_module_ex:function(module:Pzend_module_entry):P_zend_module_entry; cdecl;
+	zend_startup_module_ex:function(module:Pzend_module_entry):longint; cdecl;
+	zend_startup_modules:function:longint cdecl;
+	zend_check_magic_method_implementation:procedure(ce:Pzend_class_entry; fptr:Pzend_function; error_type:longint); cdecl;
+	zend_register_internal_class:function(class_entry:Pzend_class_entry):P_zend_class_entry; cdecl;
+	zend_register_internal_class_ex:function(class_entry:Pzend_class_entry; parent_ce:Pzend_class_entry):P_zend_class_entry; cdecl;
+	zend_register_internal_interface:function(orig_class_entry:Pzend_class_entry):P_zend_class_entry; cdecl;
+	zend_class_implements:procedure(class_entry:Pzend_class_entry; num_interfaces:longint); cdecl varargs;
+	zend_register_class_alias_ex:function(name:zend_pchar; name_len:size_t; ce:Pzend_class_entry):longint; cdecl;
+	zend_disable_function:function(function_name:zend_pchar; function_name_length:size_t):longint; cdecl;
+	zend_disable_class:function(class_name:zend_pchar; class_name_length:size_t):longint; cdecl;
+	zend_is_callable_ex:function(callable:Pzval; _object:Pzend_object; check_flags:uint; callable_name:PP_zend_string; fcc:Pzend_fcall_info_cache; error:PPchar):zend_bool; cdecl;
+	zend_is_callable:function(callable:Pzval; check_flags:uint; callable_name:PP_zend_string):zend_bool; cdecl;
+	zend_make_callable:function(callable:Pzval; callable_name:PP_zend_string):zend_bool; cdecl;
+	zend_get_module_version:function(module_name:zend_pchar):zend_pchar; cdecl;
+	zend_get_module_started:function(module_name:zend_pchar):longint; cdecl;
+	zend_declare_property_ex:function(ce:Pzend_class_entry; name:Pzend_string; _property:Pzval; access_type:longint; doc_comment:Pzend_string):longint; cdecl;
+	zend_declare_property:function(ce:Pzend_class_entry; name:zend_pchar; name_length:size_t; _property:Pzval; access_type:longint):longint; cdecl;
+	zend_declare_property_null:function(ce:Pzend_class_entry; name:zend_pchar; name_length:size_t; access_type:longint):longint; cdecl;
+	zend_declare_property_bool:function(ce:Pzend_class_entry; name:zend_pchar; name_length:size_t; value:zend_long; access_type:longint):longint; cdecl;
+	zend_declare_property_long:function(ce:Pzend_class_entry; name:zend_pchar; name_length:size_t; value:zend_long; access_type:longint):longint; cdecl;
+	zend_declare_property_double:function(ce:Pzend_class_entry; name:zend_pchar; name_length:size_t; value:double; access_type:longint):longint; cdecl;
+	zend_declare_property_string:function(ce:Pzend_class_entry; name:zend_pchar; name_length:size_t; value:zend_pchar; access_type:longint):longint; cdecl;
+	zend_declare_property_stringl:function(ce:Pzend_class_entry; name:zend_pchar; name_length:size_t; value:zend_pchar; value_len:size_t; access_type:longint):longint; cdecl;
+	zend_declare_class_constant:function(ce:Pzend_class_entry; name:zend_pchar; name_length:size_t; value:Pzval):longint; cdecl;
+	zend_declare_class_constant_null:function(ce:Pzend_class_entry; name:zend_pchar; name_length:size_t):longint; cdecl;
+	zend_declare_class_constant_long:function(ce:Pzend_class_entry; name:zend_pchar; name_length:size_t; value:zend_long):longint; cdecl;
+	zend_declare_class_constant_bool:function(ce:Pzend_class_entry; name:zend_pchar; name_length:size_t; value:zend_bool):longint; cdecl;
+	zend_declare_class_constant_double:function(ce:Pzend_class_entry; name:zend_pchar; name_length:size_t; value:double):longint; cdecl;
+	zend_declare_class_constant_stringl:function(ce:Pzend_class_entry; name:zend_pchar; name_length:size_t; value:zend_pchar; value_length:size_t):longint; cdecl;
+	zend_declare_class_constant_string:function(ce:Pzend_class_entry; name:zend_pchar; name_length:size_t; value:zend_pchar):longint; cdecl;
+	zend_update_class_constants:function(class_type:Pzend_class_entry):longint; cdecl;
+	zend_update_property_ex:procedure(scope:Pzend_class_entry; _object:Pzval; name:Pzend_string; value:Pzval); cdecl;
+	zend_update_property:procedure(scope:Pzend_class_entry; _object:Pzval; name:zend_pchar; name_length:size_t; value:Pzval); cdecl;
+	zend_update_property_null:procedure(scope:Pzend_class_entry; _object:Pzval; name:zend_pchar; name_length:size_t); cdecl;
+	zend_update_property_bool:procedure(scope:Pzend_class_entry; _object:Pzval; name:zend_pchar; name_length:size_t; value:zend_long); cdecl;
+	zend_update_property_long:procedure(scope:Pzend_class_entry; _object:Pzval; name:zend_pchar; name_length:size_t; value:zend_long); cdecl;
+	zend_update_property_double:procedure(scope:Pzend_class_entry; _object:Pzval; name:zend_pchar; name_length:size_t; value:double); cdecl;
+	zend_update_property_str:procedure(scope:Pzend_class_entry; _object:Pzval; name:zend_pchar; name_length:size_t; value:Pzend_string); cdecl;
+	zend_update_property_string:procedure(scope:Pzend_class_entry; _object:Pzval; name:zend_pchar; name_length:size_t; value:zend_pchar); cdecl;
+	zend_update_property_stringl:procedure(scope:Pzend_class_entry; _object:Pzval; name:zend_pchar; name_length:size_t; value:zend_pchar; value_length:size_t); cdecl;
+	zend_update_static_property:function(scope:Pzend_class_entry; name:zend_pchar; name_length:size_t; value:Pzval):longint; cdecl;
+	zend_update_static_property_null:function(scope:Pzend_class_entry; name:zend_pchar; name_length:size_t):longint; cdecl;
+	zend_update_static_property_bool:function(scope:Pzend_class_entry; name:zend_pchar; name_length:size_t; value:zend_long):longint; cdecl;
+	zend_update_static_property_long:function(scope:Pzend_class_entry; name:zend_pchar; name_length:size_t; value:zend_long):longint; cdecl;
+	zend_update_static_property_double:function(scope:Pzend_class_entry; name:zend_pchar; name_length:size_t; value:double):longint; cdecl;
+	zend_update_static_property_string:function(scope:Pzend_class_entry; name:zend_pchar; name_length:size_t; value:zend_pchar):longint; cdecl;
+	zend_update_static_property_stringl:function(scope:Pzend_class_entry; name:zend_pchar; name_length:size_t; value:zend_pchar; value_length:size_t):longint; cdecl;
+	zend_read_property:function(scope:Pzend_class_entry; _object:Pzval; name:zend_pchar; name_length:size_t; silent:zend_bool; rv:Pzval):Pzval; cdecl;
+	zend_read_static_property:function(scope:Pzend_class_entry; name:zend_pchar; name_length:size_t; silent:zend_bool):Pzval; cdecl;
+	zend_get_type_by_const:function(_type:longint):zend_pchar; cdecl;
+	_array_init:function(arg:Pzval; size:Cardinal):longint; cdecl;
+	_object_init:function(arg:Pzval; __zend_filename:zend_pchar; __zend_lineno:uint):longint; cdecl;
+	_object_init_ex:function(arg:Pzval; ce:Pzend_class_entry; __zend_filename:zend_pchar; __zend_lineno:uint):longint; cdecl;
+	_object_and_properties_init:function(arg:Pzval; ce:Pzend_class_entry; properties:PHashTable; __zend_filename:zend_pchar; __zend_lineno:uint):longint; cdecl;
+	object_properties_init:procedure(_object:Pzend_object; class_type:Pzend_class_entry); cdecl;
+	object_properties_init_ex:procedure(_object:Pzend_object; properties:PHashTable); cdecl;
+	object_properties_load:procedure(_object:Pzend_object; properties:PHashTable); cdecl;
+	zend_merge_properties:procedure(obj:Pzval; properties:PHashTable); cdecl;
+	add_assoc_long_ex:function(arg:Pzval; key:zend_pchar; key_len:size_t; n:zend_long):longint; cdecl;
+	add_assoc_null_ex:function(arg:Pzval; key:zend_pchar; key_len:size_t):longint; cdecl;
+	add_assoc_bool_ex:function(arg:Pzval; key:zend_pchar; key_len:size_t; b:longint):longint; cdecl;
+	add_assoc_resource_ex:function(arg:Pzval; key:zend_pchar; key_len:size_t; r:Pzend_resource):longint; cdecl;
+	add_assoc_double_ex:function(arg:Pzval; key:zend_pchar; key_len:size_t; d:double):longint; cdecl;
+	add_assoc_str_ex:function(arg:Pzval; key:zend_pchar; key_len:size_t; str:Pzend_string):longint; cdecl;
+	add_assoc_string_ex:function(arg:Pzval; key:zend_pchar; key_len:size_t; str:zend_pchar):longint; cdecl;
+	add_assoc_stringl_ex:function(arg:Pzval; key:zend_pchar; key_len:size_t; str:zend_pchar; length:size_t):longint; cdecl;
+	add_assoc_zval_ex:function(arg:Pzval; key:zend_pchar; key_len:size_t; value:Pzval):longint; cdecl;
+	add_index_long:function(arg:Pzval; idx:zend_ulong; n:zend_long):longint; cdecl;
+	add_index_null:function(arg:Pzval; idx:zend_ulong):longint; cdecl;
+	add_index_bool:function(arg:Pzval; idx:zend_ulong; b:longint):longint; cdecl;
+	add_index_resource:function(arg:Pzval; idx:zend_ulong; r:Pzend_resource):longint; cdecl;
+	add_index_double:function(arg:Pzval; idx:zend_ulong; d:double):longint; cdecl;
+	add_index_str:function(arg:Pzval; idx:zend_ulong; str:Pzend_string):longint; cdecl;
+	add_index_string:function(arg:Pzval; idx:zend_ulong; str:zend_pchar):longint; cdecl;
+	add_index_stringl:function(arg:Pzval; idx:zend_ulong; str:zend_pchar; length:size_t):longint; cdecl;
+	add_index_zval:function(arg:Pzval; index:zend_ulong; value:Pzval):longint; cdecl;
+	add_next_index_long:function(arg:Pzval; n:zend_long):longint; cdecl;
+	add_next_index_null:function(arg:Pzval):longint; cdecl;
+	add_next_index_bool:function(arg:Pzval; b:longint):longint; cdecl;
+	add_next_index_resource:function(arg:Pzval; r:Pzend_resource):longint; cdecl;
+	add_next_index_double:function(arg:Pzval; d:double):longint; cdecl;
+	add_next_index_str:function(arg:Pzval; str:Pzend_string):longint; cdecl;
+	add_next_index_string:function(arg:Pzval; str:zend_pchar):longint; cdecl;
+	add_next_index_stringl:function(arg:Pzval; str:zend_pchar; length:size_t):longint; cdecl;
+	add_next_index_zval:function(arg:Pzval; value:Pzval):longint; cdecl;
+	add_get_assoc_string_ex:function(arg:Pzval; key:zend_pchar; key_len:uint; str:zend_pchar):Pzval; cdecl;
+	add_get_assoc_stringl_ex:function(arg:Pzval; key:zend_pchar; key_len:uint; str:zend_pchar; length:size_t):Pzval; cdecl;
+	add_get_index_long:function(arg:Pzval; idx:zend_ulong; l:zend_long):Pzval; cdecl;
+	add_get_index_double:function(arg:Pzval; idx:zend_ulong; d:double):Pzval; cdecl;
+	add_get_index_str:function(arg:Pzval; index:zend_ulong; str:Pzend_string):Pzval; cdecl;
+	add_get_index_string:function(arg:Pzval; idx:zend_ulong; str:zend_pchar):Pzval; cdecl;
+	add_get_index_stringl:function(arg:Pzval; idx:zend_ulong; str:zend_pchar; length:size_t):Pzval; cdecl;
+	array_set_zval_key:function(ht:PHashTable; key:Pzval; value:Pzval):longint; cdecl;
+	add_property_long_ex:function(arg:Pzval; key:zend_pchar; key_len:size_t; l:zend_long):longint; cdecl;
+	add_property_null_ex:function(arg:Pzval; key:zend_pchar; key_len:size_t):longint; cdecl;
+	add_property_bool_ex:function(arg:Pzval; key:zend_pchar; key_len:size_t; b:zend_long):longint; cdecl;
+	add_property_resource_ex:function(arg:Pzval; key:zend_pchar; key_len:size_t; r:Pzend_resource):longint; cdecl;
+	add_property_double_ex:function(arg:Pzval; key:zend_pchar; key_len:size_t; d:double):longint; cdecl;
+	add_property_str_ex:function(arg:Pzval; key:zend_pchar; key_len:size_t; str:Pzend_string):longint; cdecl;
+	add_property_string_ex:function(arg:Pzval; key:zend_pchar; key_len:size_t; str:zend_pchar):longint; cdecl;
+	add_property_stringl_ex:function(arg:Pzval; key:zend_pchar; key_len:size_t; str:zend_pchar; length:size_t):longint; cdecl;
+	add_property_zval_ex:function(arg:Pzval; key:zend_pchar; key_len:size_t; value:Pzval):longint; cdecl;
+	call_user_function:function(function_table:PHashTable; _object:Pzval; function_name:Pzval; retval_ptr:Pzval; param_count:Cardinal; params:Pzval):longint; cdecl;
+	call_user_function_ex:function(function_table:PHashTable; _object:Pzval; function_name:Pzval; retval_ptr:Pzval; param_count:Cardinal;  params:Pzval; no_separation:longint; symbol_table:Pzend_array):longint; cdecl;
+	zend_fcall_info_init:function(callable:Pzval; check_flags:uint; fci:Pzend_fcall_info; fcc:Pzend_fcall_info_cache; callable_name:PP_zend_string;  error:PPchar):longint; cdecl;
+	zend_fcall_info_args_clear:procedure(fci:Pzend_fcall_info; free_mem:longint); cdecl;
+	zend_fcall_info_args_save:procedure(fci:Pzend_fcall_info; param_count:Plongint; params:PPzval); cdecl;
+	zend_fcall_info_args_restore:procedure(fci:Pzend_fcall_info; param_count:longint; params:Pzval); cdecl;
+	zend_fcall_info_args:function(fci:Pzend_fcall_info; args:Pzval):longint; cdecl;
+	zend_fcall_info_args_ex:function(fci:Pzend_fcall_info; func:Pzend_function; args:Pzval):longint; cdecl;
+	zend_fcall_info_argp:function(fci:Pzend_fcall_info; argc:longint; argv:Pzval):longint; cdecl;
+	zend_fcall_info_argv:function(fci:Pzend_fcall_info; argc:longint; argv:pPChar):longint; cdecl;
+	zend_fcall_info_argn:function(fci:Pzend_fcall_info; argc:longint):longint; cdecl varargs;
+	zend_fcall_info_call:function(fci:Pzend_fcall_info; fcc:Pzend_fcall_info_cache; retval:Pzval; args:Pzval):longint; cdecl;
+	zend_call_function:function(fci:Pzend_fcall_info; fci_cache:Pzend_fcall_info_cache):longint; cdecl;
+	zend_set_hash_symbol:function(symbol:Pzval; name:zend_pchar; name_length:longint; is_ref:zend_bool; num_symbol_tables:longint;  args:array of const):longint; cdecl;
+	zend_delete_global_variable:function(name:Pzend_string):longint; cdecl;
+	zend_rebuild_symbol_table:function:P_zend_array cdecl;
+	zend_attach_symbol_table:procedure(execute_data:P_zend_execute_data); cdecl;
+	zend_detach_symbol_table:procedure(execute_data:P_zend_execute_data); cdecl;
+	zend_set_local_var:function(name:Pzend_string; value:Pzval; force:longint):longint; cdecl;
+	zend_set_local_var_str:function(name:zend_pchar; len:size_t; value:Pzval; force:longint):longint; cdecl;
+	zend_find_alias_name:function(ce:Pzend_class_entry; name:Pzend_string):P_zend_string; cdecl;
+	zend_resolve_method_name:function(ce:Pzend_class_entry; f:Pzend_function):P_zend_string; cdecl;
+	zend_get_object_type:function(ce:Pzend_class_entry):zend_pchar; cdecl;
+	zend_wrong_paramers_count_error:procedure(num_args:longint; min_num_args:longint; max_num_args:longint); cdecl;
+	zend_wrong_paramer_type_error:procedure(num:longint; expected_type:Ppointer; arg:Pzval); cdecl;
+	zend_wrong_paramer_class_error:procedure(num:longint; name:zend_pchar; arg:Pzval); cdecl;
+	zend_wrong_callback_error:procedure(severity:longint; num:longint; error:zend_pchar); cdecl;
+	zend_parse_arg_class:function(arg:Pzval; pce:PP_zend_class_entry; num:longint; check_null:longint):longint; cdecl;
+	zend_parse_arg_bool_slow:function(arg:Pzval; dest:Pzend_bool):longint; cdecl;
+	zend_parse_arg_bool_weak:function(arg:Pzval; dest:Pzend_bool):longint; cdecl;
+	zend_parse_arg_long_slow:function(arg:Pzval; dest:Pzend_long):longint; cdecl;
+	zend_parse_arg_long_weak:function(arg:Pzval; dest:Pzend_long):longint; cdecl;
+	zend_parse_arg_long_cap_slow:function(arg:Pzval; dest:Pzend_long):longint; cdecl;
+	zend_parse_arg_long_cap_weak:function(arg:Pzval; dest:Pzend_long):longint; cdecl;
+	zend_parse_arg_double_slow:function(arg:Pzval; dest:Pdouble):longint; cdecl;
+	zend_parse_arg_double_weak:function(arg:Pzval; dest:Pdouble):longint; cdecl;
+	zend_parse_arg_str_slow:function(arg:Pzval; dest:PP_zend_string):longint; cdecl;
+	zend_parse_arg_str_weak:function(arg:Pzval; dest:PP_zend_string):longint; cdecl;
+	module_destructor:procedure(module:Pzend_module_entry); cdecl;
+	module_registry_request_startup:function(module:Pzend_module_entry):longint; cdecl;
+	module_registry_unload_temp:function(module:Pzend_module_entry):longint; cdecl;
+
+
+  sapi_startup:procedure( sf:p_sapi_module_struct); cdecl;
+  sapi_shutdown:procedure; cdecl;
+  sapi_activate:procedure; cdecl;
+  sapi_deactivate:procedure; cdecl;
+  sapi_initialize_empty_request:procedure; cdecl;
+  sapi_header_op:function(op:sapi_header_op_enum; arg:Ppointer):longint; cdecl;
+  sapi_add_header_ex:function(header_line:zend_pchar; header_line_len:size_t; duplicate:zend_bool; replace:zend_bool):longint; cdecl;
+  sapi_send_headers:function:longint; cdecl;
+  sapi_free_header:procedure(sapi_header:Psapi_header_struct); cdecl;
+  sapi_handle_post:procedure(arg:Ppointer); cdecl;
+  sapi_read_post_block:function(buffer:zend_pchar; buflen:size_t):size_t; cdecl;
+  sapi_register_post_entries:function(post_entry:Psapi_post_entry):longint; cdecl;
+  sapi_register_post_entry:function(post_entry:Psapi_post_entry):longint; cdecl;
+  sapi_unregister_post_entry:procedure(post_entry:Psapi_post_entry); cdecl;
+  sapi_register_default_post_reader:pointer;
+  sapi_register_treat_data:function(treat_data:pointer):longint;
+  sapi_register_input_filter:function(input_filter:pointer; input_filter_init:pointer):longint; 
+  sapi_flush:function:longint; cdecl;
+  sapi_get_stat:function:P_zend_stat_t; cdecl;
+  sapi_getenv:function(name:zend_pchar; name_len:size_t):zend_pchar; cdecl;
+  sapi_get_default_content_type:function:zend_pchar; cdecl;
+  sapi_get_default_content_type_header:procedure(default_header:Psapi_header_struct); cdecl;
+  sapi_apply_default_charset:function(mimetype:PPchar; len:size_t):size_t; cdecl;
+  sapi_activate_headers_only:procedure; cdecl;
+  sapi_get_fd:function(fd:Plongint):longint; cdecl;
+  sapi_force_http_10:function:longint; cdecl;
+  sapi_get_target_uid:function(_para1:Puid_t):longint; cdecl;
+  sapi_get_target_gid:function(_para1:Pgid_t):longint; cdecl;
+  sapi_get_request_time:function:double; cdecl;
+  sapi_terminate_process:procedure; cdecl;
+_php_stream_alloc:function(ops:Pphp_stream_ops; _abstract:Ppointer; persistent_id:zend_pchar; mode:zend_pchar; __php_stream_call_depth:longint; __zend_filename:zend_pchar; __zend_lineno:uint; __zend_orig_filename:zend_pchar; __zend_orig_lineno:uint):P_php_stream; cdecl;
+_php_stream_tell:function(stream:Pphp_stream):zend_off_t; cdecl;
+_php_stream_read:function(stream:Pphp_stream; buf:zend_pchar; count:size_t):size_t; cdecl;
+_php_stream_write:function(stream:Pphp_stream; buf:zend_pchar; count:size_t):size_t; cdecl;
+_php_stream_fill_read_buffer:procedure(stream:Pphp_stream; size:size_t); cdecl;
+_php_stream_printf:function(stream:Pphp_stream; fmt:zend_pchar):size_t; cdecl varargs;
+_php_stream_eof:function(stream:Pphp_stream):longint; cdecl;
+_php_stream_seek:function(stream:Pphp_stream; offset:zend_off_t; whence:longint):longint; cdecl;
+_php_stream_free:function(stream:Pphp_stream; close_options:longint):longint; cdecl;
+php_stream_encloses:function(enclosing:Pphp_stream; enclosed:Pphp_stream):P_php_stream; cdecl;
+_php_stream_free_enclosed:function(stream_enclosed:Pphp_stream; close_options:longint):longint; cdecl;
+php_stream_from_persistent_id:function(persistent_id:zend_pchar; stream:PP_php_stream):longint; cdecl;
+php_file_le_stream:function:longint; cdecl;
+php_file_le_pstream:function:longint; cdecl;
+php_file_le_stream_filter:function:longint; cdecl;
+_php_stream_getc:function(stream:Pphp_stream):longint; cdecl;
+_php_stream_putc:function(stream:Pphp_stream; c:longint):longint; cdecl;
+_php_stream_flush:function(stream:Pphp_stream; closing:longint):longint; cdecl;
+_php_stream_get_line:function(stream:Pphp_stream; buf:zend_pchar; maxlen:size_t; returned_len:Psize_t):zend_pchar; cdecl;
+_php_stream_get_url_stream_wrappers_hash:function:PHashTable; cdecl;
+php_stream_get_url_stream_wrappers_hash_global:function:PHashTable; cdecl;
+_php_get_stream_filters_hash:function:PHashTable; cdecl;
+php_get_stream_filters_hash_global:function:PHashTable; cdecl;
+_php_stream_truncate_set_size:function(stream:Pphp_stream; newsize:size_t):longint; cdecl;
+_php_stream_make_seekable:function(origstream:Pphp_stream; newstream:PP_php_stream; flags:longint; __php_stream_call_depth:longint; __zend_filename:zend_pchar; __zend_lineno:uint; __zend_orig_filename:zend_pchar; __zend_orig_lineno:uint):longint; cdecl;
+_php_stream_copy_to_stream:function(src:Pphp_stream; dest:Pphp_stream; maxlen:size_t; __php_stream_call_depth:longint; __zend_filename:zend_pchar; __zend_lineno:uint; __zend_orig_filename:zend_pchar; __zend_orig_lineno:uint):size_t; cdecl;
+_php_stream_copy_to_mem:function(src:Pphp_stream; maxlen:size_t; persistent:longint; __php_stream_call_depth:longint; __zend_filename:zend_pchar; __zend_lineno:uint; __zend_orig_filename:zend_pchar; __zend_orig_lineno:uint):P_zend_string; cdecl;
+_php_stream_copy_to_stream_ex:function(src:Pphp_stream; dest:Pphp_stream; maxlen:size_t; len:Psize_t; __php_stream_call_depth:longint; __zend_filename:zend_pchar; __zend_lineno:uint; __zend_orig_filename:zend_pchar; __zend_orig_lineno:uint):longint; cdecl;
+_php_stream_passthru:function(src:Pphp_stream; __php_stream_call_depth:longint; __zend_filename:zend_pchar; __zend_lineno:uint; __zend_orig_filename:zend_pchar;  __zend_orig_lineno:uint):size_t; cdecl;
+_php_stream_cast:function(stream:Pphp_stream; castas:longint; ret:Ppointer; show_err:longint):longint; cdecl;
+php_register_url_stream_wrapper:function(protocol:zend_pchar; wrapper:Pphp_stream_wrapper):longint; cdecl;
+php_unregister_url_stream_wrapper:function(protocol:zend_pchar):longint; cdecl;
+php_register_url_stream_wrapper_volatile:function(protocol:zend_pchar; wrapper:Pphp_stream_wrapper):longint; cdecl;
+php_unregister_url_stream_wrapper_volatile:function(protocol:zend_pchar):longint; cdecl;
+_php_stream_open_wrapper_ex:function(path:zend_pchar; mode:zend_pchar; options:longint; opened_path:PP_zend_string; context:Pphp_stream_context;  __php_stream_call_depth:longint; __zend_filename:zend_pchar; __zend_lineno:uint; __zend_orig_filename:zend_pchar; __zend_orig_lineno:uint):P_php_stream; cdecl;
+php_stream_locate_url_wrapper:function(path:zend_pchar; path_for_open:PPchar; options:longint):P_php_stream_wrapper; cdecl;
+php_stream_locate_eol:function(stream:Pphp_stream; buf:Pzend_string):zend_pchar; cdecl;
+php_stream_get_record:function(stream:Pphp_stream; maxlen:size_t; delim:zend_pchar; delim_len:size_t):P_zend_string; cdecl;
+php_stream_wrapper_log_error:procedure(wrapper:Pphp_stream_wrapper; options:longint; fmt:zend_pchar); cdecl varargs;
+_php_stream_puts:function(stream:Pphp_stream; buf:zend_pchar):longint; cdecl;
+_php_stream_stat:function(stream:Pphp_stream; ssb:Pphp_stream_statbuf):longint; cdecl;
+_php_stream_stat_path:function(path:zend_pchar; flags:longint; ssb:Pphp_stream_statbuf; context:Pphp_stream_context):longint; cdecl;
+_php_stream_mkdir:function(path:zend_pchar; mode:longint; options:longint; context:Pphp_stream_context):longint; cdecl;
+_php_stream_rmdir:function(path:zend_pchar; options:longint; context:Pphp_stream_context):longint; cdecl;
+_php_stream_opendir:function(path:zend_pchar; options:longint; context:Pphp_stream_context; __php_stream_call_depth:longint; __zend_filename:zend_pchar;  __zend_lineno:uint; __zend_orig_filename:zend_pchar; __zend_orig_lineno:uint):P_php_stream; cdecl;
+_php_stream_readdir:function(dirstream:Pphp_stream; ent:Pphp_stream_dirent):Pphp_stream_dirent; cdecl;
+php_stream_dirent_alphasort:function(a:PP_zend_string; b:PP_zend_string):longint; cdecl;
+php_stream_dirent_alphasortr:function(a:PP_zend_string; b:PP_zend_string):longint; cdecl;
+ _php_stream_scandir:function(dirname:zend_pchar; namelist:PPP_zend_string; flags:longint; context:Pphp_stream_context; compare:pointer):longint;
+_php_stream_set_option:function(stream:Pphp_stream; option:longint; value:longint; ptrparam:Ppointer):longint; cdecl;
+php_stream_context_free:procedure(context:Pphp_stream_context); cdecl;
+php_stream_context_alloc:function:P_php_stream_context; cdecl;
+php_stream_context_get_option:function(context:Pphp_stream_context; wrappername:zend_pchar; optionname:zend_pchar):Pzval; cdecl;
+php_stream_context_set_option:function(context:Pphp_stream_context; wrappername:zend_pchar; optionname:zend_pchar; optionvalue:Pzval):longint; cdecl;
+php_stream_notification_alloc:function:P_php_stream_notifier; cdecl;
+php_stream_notification_free:procedure(notifier:P_php_stream_notifier); cdecl;
+php_stream_notification_notify:procedure(context:Pphp_stream_context; notifycode:longint; severity:longint; xmsg:zend_pchar; xcode:longint;
+bytes_sofar:size_t; bytes_max:size_t; ptr:Ppointer);
+php_stream_context_set:function(stream:Pphp_stream; context:Pphp_stream_context):P_php_stream_context; cdecl;
+zend_llist_init:procedure(l:Pzend_llist; size:size_t; dtor:llist_dtor_func_t; persistent:byte); cdecl;
+zend_llist_add_element:procedure(l:Pzend_llist; element:Ppointer); cdecl;
+zend_llist_prepend_element:procedure(l:Pzend_llist; element:Ppointer); cdecl;
+zend_llist_del_element:procedure(l:Pzend_llist; element:Ppointer; compare:ERGERG43T4T545YH546);
+zend_llist_destroy:procedure(l:Pzend_llist); cdecl;
+zend_llist_clean:procedure(l:Pzend_llist); cdecl;
+zend_llist_remove_tail:procedure(l:Pzend_llist); cdecl;
+zend_llist_copy:procedure(dst:Pzend_llist; src:Pzend_llist); cdecl;
+zend_llist_apply:procedure(l:Pzend_llist; func:llist_apply_func_t); cdecl;
+zend_llist_apply_with_del:procedure(l:Pzend_llist; func:RGEKG34I9TI3434); cdecl;
+zend_llist_apply_with_argument:procedure(l:Pzend_llist; func:llist_apply_with_arg_func_t; arg:Ppointer); cdecl;
+zend_llist_apply_with_arguments:procedure(l:Pzend_llist; func:llist_apply_with_args_func_t; num_args:longint); cdecl varargs;
+zend_llist_count:function(l:Pzend_llist):size_t; cdecl;
+zend_llist_sort:procedure(l:Pzend_llist; comp_func:llist_compare_func_t); cdecl;
+zend_llist_get_first_ex:function(l:Pzend_llist; pos:Pzend_llist_position):pointer; cdecl;
+zend_llist_get_last_ex:function(l:Pzend_llist; pos:Pzend_llist_position):pointer; cdecl;
+zend_llist_get_next_ex:function(l:Pzend_llist; pos:Pzend_llist_position):pointer; cdecl;
+zend_llist_get_prev_ex:function(l:Pzend_llist; pos:Pzend_llist_position):pointer; cdecl;
+php_stream_filter_register_factory:function(filterpattern:zend_pchar; factory:Pphp_stream_filter_factory):longint; cdecl;
+php_stream_filter_unregister_factory:function(filterpattern:zend_pchar):longint; cdecl;
+php_stream_filter_register_factory_volatile:function(filterpattern:zend_pchar; factory:Pphp_stream_filter_factory):longint; cdecl;
+php_stream_filter_create:function(filtername:zend_pchar; filterparams:Pzval; persistent:longint):P_php_stream_filter; cdecl;
+_php_stream_filter_prepend:procedure(chain:Pphp_stream_filter_chain; filter:Pphp_stream_filter); cdecl;
+php_stream_filter_prepend_ex:function(chain:Pphp_stream_filter_chain; filter:Pphp_stream_filter):longint; cdecl;
+_php_stream_filter_append:procedure(chain:Pphp_stream_filter_chain; filter:Pphp_stream_filter); cdecl;
+php_stream_filter_append_ex:function(chain:Pphp_stream_filter_chain; filter:Pphp_stream_filter):longint; cdecl;
+_php_stream_filter_flush:function(filter:Pphp_stream_filter; finish:longint):longint; cdecl;
+php_stream_filter_remove:function(filter:Pphp_stream_filter; call_dtor:longint):P_php_stream_filter; cdecl;
+php_stream_filter_free:procedure(filter:Pphp_stream_filter); cdecl;
+_php_stream_filter_alloc:function(fops:Pphp_stream_filter_ops; _abstract:Ppointer; persistent:longint; __php_stream_call_depth:longint; __zend_filename:zend_pchar; __zend_lineno:uint; __zend_orig_filename:zend_pchar; __zend_orig_lineno:uint):P_php_stream_filter; cdecl;
+php_stream_bucket_new:function(stream:Pphp_stream; buf:zend_pchar; buflen:size_t; own_buf:longint; buf_persistent:longint):P_php_stream_bucket; cdecl;
+php_stream_bucket_split:function(_in:Pphp_stream_bucket; left:PP_php_stream_bucket; right:PP_php_stream_bucket; length:size_t):longint; cdecl;
+php_stream_bucket_delref:procedure(bucket:Pphp_stream_bucket); cdecl;
+php_stream_bucket_prepend:procedure(brigade:Pphp_stream_bucket_brigade; bucket:Pphp_stream_bucket); cdecl;
+php_stream_bucket_append:procedure(brigade:Pphp_stream_bucket_brigade; bucket:Pphp_stream_bucket); cdecl;
+php_stream_bucket_unlink:procedure(bucket:Pphp_stream_bucket); cdecl;
+php_stream_bucket_make_writeable:function(bucket:Pphp_stream_bucket):P_php_stream_bucket; cdecl;
+zend_init_execute_data:procedure(execute_data:Pzend_execute_data; op_array:Pzend_op_array; return_value:Pzval); cdecl;
+zend_create_generator_execute_data:function(call:Pzend_execute_data; op_array:Pzend_op_array; return_value:Pzval):P_zend_execute_data; cdecl;
+zend_execute:procedure(op_array:Pzend_op_array; return_value:Pzval); cdecl;
+execute_ex:procedure(execute_data:Pzend_execute_data); cdecl;
+execute_internal:procedure(execute_data:Pzend_execute_data; return_value:Pzval); cdecl;
+zend_lookup_class:function(name:Pzend_string):P_zend_class_entry; cdecl;
+zend_lookup_class_ex:function(name:Pzend_string; key:Pzval; use_autoload:longint):P_zend_class_entry; cdecl;
+zend_get_called_scope:function(ex:Pzend_execute_data):P_zend_class_entry; cdecl;
+zend_get_this_object:function(ex:Pzend_execute_data):P_zend_object; cdecl;
+zend_eval_string:function(str:zend_pchar; retval_ptr:Pzval; string_name:zend_pchar):longint; cdecl;
+zend_eval_stringl:function(str:zend_pchar; str_len:size_t; retval_ptr:Pzval; string_name:zend_pchar):longint; cdecl;
+zend_eval_string_ex:function(str:zend_pchar;  retval_ptr:pzval; string_name:zend_pchar; handle_exceptions:longint):longint; cdecl;
+zend_eval_stringl_ex:function(str:zend_pchar; str_len:size_t; retval_ptr:Pzval; string_name:zend_pchar; handle_exceptions:longint):longint; cdecl;
+zval_update_constant:function(pp:Pzval; inline_change:zend_bool):longint; cdecl;
+zval_update_constant_ex:function(pp:Pzval; inline_change:zend_bool; scope:Pzend_class_entry):longint; cdecl;
+zend_vm_stack_init:procedure; cdecl;
+zend_vm_stack_destroy:procedure; cdecl;
+zend_vm_stack_extend:function(size:size_t):pointer; cdecl;
+get_active_class_name:function(space:PPchar):zend_pchar; cdecl;
+get_active_function_name:function:zend_pchar; cdecl;
+zend_get_executed_filename:function:zend_pchar; cdecl;
+zend_get_executed_filename_ex:function:P_zend_string; cdecl;
+zend_get_executed_lineno:function:uint; cdecl;
+zend_is_executing:function:zend_bool; cdecl;
+zend_set_timeout:procedure(seconds:zend_long; reset_signals:longint); cdecl;
+zend_unset_timeout:procedure; cdecl;
+zend_timeout:procedure(dummy:longint); cdecl;
+zend_fetch_class:function(class_name:Pzend_string; fetch_type:longint):P_zend_class_entry; cdecl;
+zend_fetch_class_by_name:function(class_name:Pzend_string; key:Pzval; fetch_type:longint):P_zend_class_entry; cdecl;
+zend_fetch_dimension_by_zval:procedure(result:Pzval; container:Pzval; dim:Pzval); cdecl;
+zend_fetch_dimension_by_zval_is:procedure(result:Pzval; container:Pzval; dim:Pzval; dim_type:longint); cdecl;
+EX_VAR:function(execute_data_ptr:Pzend_execute_data; _var:uint32_t):Pzval; cdecl;
+zend_set_user_opcode_handler:function(opcode:zend_uchar; handler:user_opcode_handler_t):longint; cdecl;
+zend_get_user_opcode_handler:function(opcode:zend_uchar):user_opcode_handler_t; cdecl;
+zend_get_zval_ptr:function(op_type:longint; node:Pznode_op; execute_data:Pzend_execute_data; should_free:Pzend_free_op; _type:longint):Pzval; cdecl;
+zend_clean_and_cache_symbol_table:procedure(symbol_table:Pzend_array); cdecl;
+zend_objects_store_init:procedure(objects:Pzend_objects_store; init_size:uint32_t); cdecl;
+zend_objects_store_call_destructors:procedure(objects:Pzend_objects_store); cdecl;
+zend_objects_store_mark_destructed:procedure(objects:Pzend_objects_store); cdecl;
+zend_objects_store_destroy:procedure(objects:Pzend_objects_store); cdecl;
+zend_objects_store_put:procedure(_object:Pzend_object); cdecl;
+zend_objects_store_del:procedure(_object:Pzend_object); cdecl;
+zend_objects_store_free:procedure(_object:Pzend_object); cdecl;
+zend_object_store_set_object:procedure(zobject:Pzval; _object:Pzend_object); cdecl;
+zend_object_store_ctor_failed:procedure(_object:Pzend_object); cdecl;
+zend_objects_store_free_object_storage:procedure(objects:Pzend_objects_store); cdecl;
+zend_get_std_object_handlers:function:P_zend_object_handlers; cdecl;
+
+zend_ptr_stack_init:procedure(stack:Pzend_ptr_stack); cdecl;
+zend_ptr_stack_init_ex:procedure(stack:Pzend_ptr_stack; persistent:zend_bool); cdecl;
+zend_ptr_stack_n_push:procedure(stack:Pzend_ptr_stack; count:longint; args:array of const); cdecl;
+zend_ptr_stack_n_pop:procedure(stack:Pzend_ptr_stack; count:longint; args:array of const); cdecl;
+zend_ptr_stack_destroy:procedure(stack:Pzend_ptr_stack); cdecl;
+zend_ptr_stack_apply:procedure(stack:Pzend_ptr_stack; func:EWFG439EGRG45); cdecl;
+zend_ptr_stack_clean:procedure(stack:Pzend_ptr_stack; func:G5J90E4GK495Y4; free_elements:zend_bool); cdecl;
+zend_ptr_stack_num_elements:function(stack:Pzend_ptr_stack):longint; cdecl;
+zend_ini_startup:function:longint; cdecl;
+zend_ini_shutdown:function:longint; cdecl;
+zend_ini_global_shutdown:function:longint; cdecl;
+zend_ini_deactivate:function:longint; cdecl;
+zend_ini_dtor:procedure(ini_directives:PHashTable); cdecl;
+zend_copy_ini_directives:function:longint; cdecl;
+zend_ini_sort_entries:procedure; cdecl;
+zend_register_ini_entries:function(ini_entry:Pzend_ini_entry_def; module_number:longint):longint; cdecl;
+zend_unregister_ini_entries:procedure(module_number:longint); cdecl;
+zend_ini_refresh_caches:procedure(stage:longint); cdecl;
+zend_alter_ini_entry:function( name:zend_string; new_value:Pzend_string; modify_type:longint; stage:longint):longint; cdecl;
+zend_alter_ini_entry_ex:function(name:Pzend_string; new_value:Pzend_string; modify_type:longint; stage:longint; force_change:longint):longint; cdecl;
+zend_alter_ini_entry_chars:function(name:Pzend_string; value:Pchar; value_length:size_t; modify_type:longint; stage:longint):longint; cdecl;
+zend_alter_ini_entry_chars_ex:function(name:Pzend_string; value:Pchar; value_length:size_t; modify_type:longint; stage:longint;  force_change:longint):longint; cdecl;
+zend_restore_ini_entry:function(name:Pzend_string; stage:longint):longint; cdecl;
+display_ini_entries:procedure(module:Pzend_module_entry); cdecl;
+zend_ini_long:function(name:Pchar; name_length:uint; orig:longint):zend_long; cdecl;
+zend_ini_double:function(name:Pchar; name_length:uint; orig:longint):double; cdecl;
+zend_ini_string:function(name:Pchar; name_length:uint; orig:longint):Pchar; cdecl;
+zend_ini_string_ex:function(name:Pchar; name_length:uint; orig:longint; exists:Pzend_bool):Pchar; cdecl;
+zend_ini_register_displayer:function(name:Pchar; name_length:uint; displayer:IEJORGJIERGE):longint; cdecl;
+zend_parse_ini_file:function(fh:Pzend_file_handle; unbuffered_errors:zend_bool; scanner_mode:longint; ini_parser_cb:zend_ini_parser_cb_t; arg:Ppointer):longint; cdecl;
+zend_parse_ini_string:function(str:Pchar; unbuffered_errors:zend_bool; scanner_mode:longint; ini_parser_cb:zend_ini_parser_cb_t; arg:Ppointer):longint; cdecl;
+
+
+
+_zend_hash_init:procedure(ht:PHashTable; nSize:uint32_t; pDestructor:dtor_func_t; persistent:zend_bool; __zend_filename:Pchar; __zend_lineno:uint); cdecl;
+_zend_hash_init_ex:procedure(ht:PHashTable; nSize:uint32_t; pDestructor:dtor_func_t; persistent:zend_bool; bApplyProtection:zend_bool; __zend_filename:Pchar; __zend_lineno:uint); cdecl;
+zend_hash_destroy:procedure(ht:PHashTable); cdecl;
+zend_hash_clean:procedure(ht:PHashTable); cdecl;
+zend_hash_real_init:procedure(ht:PHashTable; _packed:zend_bool); cdecl;
+zend_hash_packed_to_hash:procedure(ht:PHashTable); cdecl;
+zend_hash_to_packed:procedure(ht:PHashTable); cdecl;
+zend_hash_extend:procedure(ht:PHashTable; nSize:uint32_t; _packed:zend_bool); cdecl;
+_zend_hash_add_or_update:function(ht:PHashTable; key:Pzend_string; pData:Pzval; flag:uint32_t; __zend_filename:Pchar; __zend_lineno:uint):Pzval; cdecl;
+_zend_hash_update:function(ht:PHashTable; key:Pzend_string; pData:Pzval; __zend_filename:Pchar; __zend_lineno:uint):Pzval; cdecl;
+_zend_hash_update_ind:function(ht:PHashTable; key:Pzend_string; pData:Pzval; __zend_filename:Pchar; __zend_lineno:uint):Pzval; cdecl;
+_zend_hash_add:function(ht:PHashTable; key:Pzend_string; pData:Pzval; __zend_filename:Pchar; __zend_lineno:uint):Pzval; cdecl;
+_zend_hash_add_new:function(ht:PHashTable; key:Pzend_string; pData:Pzval; __zend_filename:Pchar; __zend_lineno:uint):Pzval; cdecl;
+_zend_hash_str_add_or_update:function(ht:PHashTable; key:Pchar; len:size_t; pData:Pzval; flag:uint32_t; __zend_filename:Pchar; __zend_lineno:uint):Pzval; cdecl;
+_zend_hash_str_update:function(ht:PHashTable; key:Pchar; len:size_t; pData:Pzval; __zend_filename:Pchar; __zend_lineno:uint):Pzval; cdecl;
+_zend_hash_str_update_ind:function(ht:PHashTable; key:Pchar; len:size_t; pData:Pzval; __zend_filename:Pchar; __zend_lineno:uint):Pzval; cdecl;
+_zend_hash_str_add:function(ht:PHashTable; key:Pchar; len:size_t; pData:Pzval; __zend_filename:Pchar; __zend_lineno:uint):Pzval; cdecl;
+_zend_hash_str_add_new:function(ht:PHashTable; key:Pchar; len:size_t; pData:Pzval; __zend_filename:Pchar; __zend_lineno:uint):Pzval; cdecl;
+_zend_hash_index_add_or_update:function(ht:PHashTable; h:zend_ulong; pData:Pzval; flag:uint32_t):Pzval; cdecl;
+_zend_hash_index_add:function(ht:PHashTable; h:zend_ulong; pData:Pzval):Pzval; cdecl;
+_zend_hash_index_add_new:function(ht:PHashTable; h:zend_ulong; pData:Pzval; __zend_filename:Pchar; __zend_lineno:uint):Pzval; cdecl;
+_zend_hash_index_update:function(ht:PHashTable; h:zend_ulong; pData:Pzval; __zend_filename:Pchar; __zend_lineno:uint):Pzval; cdecl;
+_zend_hash_next_index_insert:function(ht:PHashTable; pData:Pzval; __zend_filename:Pchar; __zend_lineno:uint):Pzval; cdecl;
+_zend_hash_next_index_insert_new:function(ht:PHashTable; pData:zval; __zend_filename:Pchar; __zend_lineno:uint):Pzval; cdecl;
+zend_hash_index_add_empty_element:function(ht:PHashTable; h:zend_ulong):Pzval; cdecl;
+zend_hash_add_empty_element:function(ht:PHashTable; key:Pzend_string):Pzval; cdecl;
+zend_hash_str_add_empty_element:function(ht:PHashTable; key:Pchar; len:size_t):Pzval; cdecl;
+zend_hash_graceful_destroy:procedure(ht:PHashTable); cdecl;
+zend_hash_graceful_reverse_destroy:procedure(ht:PHashTable); cdecl;
+zend_hash_apply:procedure(ht:PHashTable; apply_func:Tapply_func_t); cdecl;
+zend_hash_apply_with_argument:procedure(ht:PHashTable; apply_func:Tapply_func_arg_t; para3:pointer); cdecl;
+zend_hash_apply_with_arguments:procedure(ht:PHashTable; apply_func:Tapply_func_args_t; para3:longint; args:array of const); cdecl;
+zend_hash_reverse_apply:procedure(ht:PHashTable; apply_func:Tapply_func_t); cdecl;
+zend_hash_del:function(ht:PHashTable; key:Pzend_string):longint; cdecl;
+zend_hash_del_ind:function(ht:PHashTable; key:Pzend_string):longint; cdecl;
+zend_hash_str_del:function(ht:PHashTable; key:Pchar; len:size_t):longint; cdecl;
+zend_hash_str_del_ind:function(ht:PHashTable; key:Pchar; len:size_t):longint; cdecl;
+zend_hash_index_del:function(ht:PHashTable; h:zend_ulong):longint; cdecl;
+zend_hash_del_bucket:procedure(ht:PHashTable; p:PBucket); cdecl;
+zend_hash_find:function(ht:PHashTable; key:Pzend_string):Pzval; cdecl;
+zend_hash_str_find:function(ht:PHashTable; key:Pchar; len:size_t):Pzval; cdecl;
+
+zend_hash_index_findZval:function( ht:pzval; h:zend_ulong):Pzval;    cdecl;
+zend_symtable_findTest:function( ht:pzval;  key:pzend_string):Pzval;   cdecl;
+zend_hash_index_existsZval:function( ht:pzval; h:zend_ulong):zend_bool;  cdecl;
+
+
+zend_hash_index_find:function(ht:PHashTable; h:zend_ulong):Pzval; cdecl;
+
+zend_hash_exists:function(ht:PHashTable; key:Pzend_string):zend_bool; cdecl;
+zend_hash_str_exists:function(ht:PHashTable; str:Pchar; len:size_t):zend_bool; cdecl;
+zend_hash_index_exists:function(ht:PHashTable; h:zend_ulong):zend_bool; cdecl;
+zend_hash_has_more_elements_ex:function(ht,pos : longint) : longint; cdecl;
+zend_hash_move_forward_ex:function(ht:PHashTable; pos:PHashPosition):longint; cdecl;
+zend_hash_move_backwards_ex:function(ht:PHashTable; pos:PHashPosition):longint; cdecl;
+zend_hash_get_current_key_ex:function(ht:PHashTable; str_index:PPzend_string; num_index:P_zend_ulong; pos:PHashPosition):longint; cdecl;
+zend_hash_get_current_key_zval_ex:procedure(ht:PHashTable; key:Pzval; pos:PHashPosition); cdecl;
+zend_hash_get_current_key_type_ex:function(ht:PHashTable; pos:PHashPosition):longint; cdecl;
+zend_hash_get_current_data_ex:function(ht:PHashTable; pos:PHashPosition):Pzval; cdecl;
+zend_hash_internal_pointer_reset_ex:procedure(ht:PHashTable; pos:PHashPosition); cdecl;
+zend_hash_internal_pointer_end_ex:procedure(ht:PHashTable; pos:PHashPosition); cdecl;
+zend_hash_copy:procedure(target:PHashTable; source:PHashTable; pCopyConstructor:copy_ctor_func_t; tmp: pointer; size: uint); cdecl;
+_zend_hash_merge:procedure(target:PHashTable; source:PHashTable; pCopyConstructor:copy_ctor_func_t; size:uint; overwrite:zend_bool); cdecl;
+zend_hash_merge_ex:procedure(target:PHashTable; source:PHashTable; pCopyConstructor:copy_ctor_func_t; pMergeSource:Tmerge_checker_func_t; pParam:Ppointer); cdecl;
+zend_hash_bucket_swap:procedure(p:PBucket; q:PBucket); cdecl;
+zend_hash_bucket_renum_swap:procedure(p:PBucket; q:PBucket); cdecl;
+zend_hash_bucket_packed_swap:procedure(p:PBucket; q:PBucket); cdecl;
+zend_hash_compare:function(ht1:PHashTable; ht2:PHashTable; compar:compare_func_t; ordered:zend_bool):longint; cdecl;
+zend_hash_sort_ex:function(ht:PHashTable; sort_func:sort_func_t; compare_func:compare_func_t; renumber:zend_bool; TSRMLS_DC: pointer):longint; cdecl;
+zend_hash_minmax:function(ht:PHashTable; compar:compare_func_t; flag:uint32_t):Pzval; cdecl;
+zend_hash_rehash:function(ht:PHashTable):longint; cdecl;
+zend_array_count:function(ht:PHashTable):uint32_t; cdecl;
+zend_array_dup:function(source:PHashTable):PHashTable; cdecl;
+zend_array_destroy:procedure(ht:PHashTable); cdecl;
+zend_symtable_clean:procedure(ht:PHashTable); cdecl;
+_zend_handle_numeric_str_ex:function(key:Pchar; length:size_t; idx:P_zend_ulong):longint; cdecl;
+zend_hash_iterator_add:function(ht:PHashTable; pos:HashPosition):uint32_t; cdecl;
+zend_hash_iterator_pos:function(idx:uint32_t; ht:PHashTable):HashPosition; cdecl;
+zend_hash_iterator_pos_ex:function(idx:uint32_t; _array:Pzval):HashPosition; cdecl;
+zend_hash_iterator_del:procedure(idx:uint32_t); cdecl;
+zend_hash_iterators_lower_pos:function(ht:PHashTable; start:HashPosition):HashPosition; cdecl;
+_zend_hash_iterators_update:procedure(ht:PHashTable; from:HashPosition; _to:HashPosition); cdecl;
+
+//tsrm_error:function(level:longint; format:zend_pchar; args:array of const):longint; cdecl;
+//zend_mm_set_custom_handlers(heap:Pzend_mm_heap; _malloc:PEWKGERGJ945YG45; _free:procedure (_para1:pointer); var _realloc:procedure :procedure(_para1:pointer; _para2:size_t)); cdecl;
+//zend_mm_get_custom_handlers(heap:Pzend_mm_heap; _malloc:PPOERGJOERJGIERGHRE; _free:Pprocedure (_para1:pointer); var _realloc:Pprocedure :procedure(_para1:pointer; _para2:size_t)); cdecl;
+//zend_mm_set_custom_debug_handlers(heap:Pzend_mm_heap; var _malloc:procedure (_para1:size_t; __zend_filename:zend_pchar; __zend_lineno:uint; __zend_orig_filename:zend_pchar; __zend_orig_lineno:uint); _free:procedure :procedure(_para1:pointer; __zend_filename:zend_pchar; __zend_lineno:uint; __zend_orig_filename:zend_pchar; __zend_orig_lineno:uint); _realloc:PERG4JG09E84GJ8945H45H); cdecl;
+//zend_object_create_proxy:function(_object:Pzval; member:Pzval):P_zend_object; cdecl;
+zend_check_internal_arg_type:procedure(zf:P_zend_function; arg_num:uint32_t; arg:Pzval); cdecl;
+//zend_check_arg_type:function(zf:Pzend_function; arg_num:uint32_t; arg:Pzval; default_value:Pzval; cache_slot:Ppointer):longint; cdecl;
+//zend_check_missing_arg:procedure(execute_data:Pzend_execute_data; arg_num:uint32_t; cache_slot:Ppointer); cdecl;
+
+
+add_function:function(result:Pzval; op1:Pzval; op2:Pzval):longint; cdecl;
+sub_function:function(result:Pzval; op1:Pzval; op2:Pzval):longint; cdecl;
+mul_function:function(result:Pzval; op1:Pzval; op2:Pzval):longint; cdecl;
+pow_function:function(result:Pzval; op1:Pzval; op2:Pzval):longint; cdecl;
+div_function:function(result:Pzval; op1:Pzval; op2:Pzval):longint; cdecl;
+mod_function:function(result:Pzval; op1:Pzval; op2:Pzval):longint; cdecl;
+boolean_xor_function:function(result:Pzval; op1:Pzval; op2:Pzval):longint; cdecl;
+boolean_not_function:function(result:Pzval; op1:Pzval):longint; cdecl;
+bitwise_not_function:function(result:Pzval; op1:Pzval):longint; cdecl;
+bitwise_or_function:function(result:Pzval; op1:Pzval; op2:Pzval):longint; cdecl;
+bitwise_and_function:function(result:Pzval; op1:Pzval; op2:Pzval):longint; cdecl;
+bitwise_xor_function:function(result:Pzval; op1:Pzval; op2:Pzval):longint; cdecl;
+shift_left_function:function(result:Pzval; op1:Pzval; op2:Pzval):longint; cdecl;
+shift_right_function:function(result:Pzval; op1:Pzval; op2:Pzval):longint; cdecl;
+concat_function:function(result:Pzval; op1:Pzval; op2:Pzval):longint; cdecl;
+zend_is_identical:function(op1:Pzval; op2:Pzval):longint; cdecl;
+is_equal_function:function(result:Pzval; op1:Pzval; op2:Pzval):longint; cdecl;
+is_identical_function:function(result:Pzval; op1:Pzval; op2:Pzval):longint; cdecl;
+is_not_identical_function:function(result:Pzval; op1:Pzval; op2:Pzval):longint; cdecl;
+is_not_equal_function:function(result:Pzval; op1:Pzval; op2:Pzval):longint; cdecl;
+is_smaller_function:function(result:Pzval; op1:Pzval; op2:Pzval):longint; cdecl;
+is_smaller_or_equal_function:function(result:Pzval; op1:Pzval; op2:Pzval):longint; cdecl;
+instanceof_function_ex:function(instance_ce:Pzend_class_entry; ce:Pzend_class_entry; interfaces_only:zend_bool):zend_bool; cdecl;
+instanceof_function:function(instance_ce:Pzend_class_entry; ce:Pzend_class_entry):zend_bool; cdecl;
+_is_numeric_string_ex:function(str:Pchar; length:size_t; lval:Pzend_long; dval:Pdouble; allow_errors:longint; oflow_info:Plongint):zend_uchar; cdecl;
+zend_memnstr_ex:function(haystack:Pchar; needle:Pchar; needle_len:size_t; _end:Pchar):Pchar; cdecl;
+zend_memnrstr_ex:function(haystack:Pchar; needle:Pchar; needle_len:size_t; _end:Pchar):Pchar; cdecl;
+zend_dval_to_lval_slow:function(d:double):zend_long; cdecl;
+is_numeric_str_function:function(str:Pzend_string; lval:Pzend_long; dval:Pdouble):zend_uchar; cdecl;
+increment_function:function(op1:Pzval):longint; cdecl;
+decrement_function:function(op2:Pzval):longint; cdecl;
+convert_scalar_to_number:procedure(op:Pzval); cdecl;
+_convert_to_cstring:procedure(op:Pzval; __zend_filename:Pchar; __zend_lineno:uint); cdecl;
+_convert_to_string:procedure(op:Pzval; __zend_filename:Pchar; __zend_lineno:uint); cdecl;
+convert_to_long:procedure(op:Pzval); cdecl;
+convert_to_double:procedure(op:Pzval); cdecl;
+convert_to_long_base:procedure(op:Pzval; base:longint); cdecl;
+convert_to_null:procedure(op:Pzval); cdecl;
+convert_to_boolean:procedure(op:Pzval); cdecl;
+convert_to_array:procedure(op:Pzval); cdecl;
+convert_to_object:procedure(op:Pzval); cdecl;
+multi_convert_to_long_ex:procedure(argc:longint; args:array of const); cdecl;
+multi_convert_to_double_ex:procedure(argc:longint; args:array of const); cdecl;
+multi_convert_to_string_ex:procedure(argc:longint; args:array of const); cdecl;
+_zval_get_long_func:function(op:Pzval):zend_long; cdecl;
+_zval_get_double_func:function(op:Pzval):double; cdecl;
+_zval_get_string_func:function(op:Pzval):Pzend_string; cdecl;
+zend_is_true:function(op:Pzval):longint; cdecl;
+zend_object_is_true:function(op:Pzval):longint; cdecl;
+compare_function:function(result:Pzval; op1:Pzval; op2:Pzval):longint; cdecl;
+numeric_compare_function:function(op1:Pzval; op2:Pzval):longint; cdecl;
+string_compare_function_ex:function(op1:Pzval; op2:Pzval; case_insensitive:zend_bool):longint; cdecl;
+string_compare_function:function(op1:Pzval; op2:Pzval):longint; cdecl;
+string_case_compare_function:function(op1:Pzval; op2:Pzval):longint; cdecl;
+string_locale_compare_function:function(op1:Pzval; op2:Pzval):longint; cdecl;
+zend_str_tolower:procedure(str:Pchar; length:size_t); cdecl;
+zend_str_tolower_copy:function(dest:Pchar; source:Pchar; length:size_t):Pchar; cdecl;
+zend_str_tolower_dup:function(source:Pchar; length:size_t):Pchar; cdecl;
+zend_str_tolower_dup_ex:function(source:Pchar; length:size_t):Pchar; cdecl;
+zend_string_tolower:function(str:Pzend_string):Pzend_string; cdecl;
+zend_binary_zval_strcmp:function(s1:Pzval; s2:Pzval):longint; cdecl;
+zend_binary_zval_strncmp:function(s1:Pzval; s2:Pzval; s3:Pzval):longint; cdecl;
+zend_binary_zval_strcasecmp:function(s1:Pzval; s2:Pzval):longint; cdecl;
+zend_binary_zval_strncasecmp:function(s1:Pzval; s2:Pzval; s3:Pzval):longint; cdecl;
+zend_binary_strcmp:function(s1:Pchar; len1:size_t; s2:Pchar; len2:size_t):longint; cdecl;
+zend_binary_strncmp:function(s1:Pchar; len1:size_t; s2:Pchar; len2:size_t; length:size_t):longint; cdecl;
+zend_binary_strcasecmp:function(s1:Pchar; len1:size_t; s2:Pchar; len2:size_t):longint; cdecl;
+zend_binary_strncasecmp:function(s1:Pchar; len1:size_t; s2:Pchar; len2:size_t; length:size_t):longint; cdecl;
+zend_binary_strcasecmp_l:function(s1:Pchar; len1:size_t; s2:Pchar; len2:size_t):longint; cdecl;
+zend_binary_strncasecmp_l:function(s1:Pchar; len1:size_t; s2:Pchar; len2:size_t; length:size_t):longint; cdecl;
+zendi_smart_strcmp:function(s1:Pzend_string; s2:Pzend_string):zend_long; cdecl;
+zend_compare_symbol_tables:function(ht1:PHashTable; ht2:PHashTable):longint; cdecl;
+zend_compare_arrays:function(a1:Pzval; a2:Pzval):longint; cdecl;
+zend_compare_objects:function(o1:Pzval; o2:Pzval):longint; cdecl;
+zend_atoi:function(str:Pchar; str_len:longint):longint; cdecl;
+zend_atol:function(str:Pchar; str_len:longint):zend_long; cdecl;
+zend_locale_sprintf_double:procedure(op:Pzval; __zend_filename:Pchar; __zend_lineno:uint); cdecl;
+zend_update_current_locale:procedure; cdecl;
+zend_long_to_str:function(num:zend_long):Pzend_string; cdecl;
+
+ZvalGetPChar:function(z:pzval):zend_pchar; cdecl;
+ZvalSetPChar:procedure(z:pzval; p:zend_pchar; l, b:integer); cdecl;
+
+read_property22:function(elem:pzval; name:zend_pchar; flags:Integer):pzval;   cdecl;
+isset_property:function(_object:pzval; property_name:zend_pchar):Integer;    cdecl;
+
+
+
+lookup_class_ce:function(ce:pzend_class_entry; property_name:zend_pchar; property_length:SIZE_T):pzend_class_entry; cdecl;
+class_exists:function(class_name:zend_pchar):Integer;    cdecl;
+class_exists2:function(class_name:zend_pchar):Integer;    cdecl;
+update_property_zval:function(_object:pzval; property_name:zend_pchar; value:pzval):integer; cdecl;
+__create_php_object:function(classname:pzend_string; return_value:pzval; __params:pzval; argc:Integer):pzend_class_entry; cdecl;
+
+
+
+__call_function:procedure(func:pzval; argv:pzval; argc:integer);cdecl;
+safe_emalloc2:function(nmemb:size_t; size:size_t; offset:size_t):Pointer;cdecl;
+
+ZvalEmalloc:function(nmemb:size_t):pzval;cdecl;
+
+pZVAL_NEW_REF:procedure(arg1, arg2:pointer);cdecl;
+
+NewPzval:function(z:pzval):pzval;cdecl;
+
+CreateCll:function(result:pzval; class_name:zend_pchar; Self:integer):pzval;cdecl;
+
+PHPInitSetValue:procedure(name, new_value:zend_pchar; modify_type, stage:integer);cdecl;
+
+implementation
+
+
+end.
diff --git a/Source/php4delphi.pas b/Source/php4delphi.pas
index fb42abc..7df32d9 100644
--- a/Source/php4delphi.pas
+++ b/Source/php4delphi.pas
@@ -38,6 +38,7 @@ interface
 uses
   Windows, Messages, SysUtils, System.Types, Classes, VCL.Graphics,
   PHPCommon, WinApi.WinSock,
+  {$IFDEF PHP7} hzend_types, {$ENDIF}
   ZendTypes, PHPTypes, PHPAPI, ZENDAPI,
   DelphiFunctions, phpFunctions, strUtils, varUtils,
   {$IFDEF PHP_UNICE}WideStrUtils, {$ENDIF}
@@ -863,10 +864,15 @@ procedure delphi_error_cb(_type : integer; const error_filename : zend_pchar;
                 else
                     error_type_str := 'Unknown error';
                end;
-
-                php_log_err(zend_pchar(
+              {$IFDEF P_CUT}
+               ShowMessage(zend_pchar(
                 {$IFDEF PHP_UNICE}Format{$ELSE}AnsiFormat{$ENDIF}
-                ('PHP4DELPHI %s:  %s in %s on line %d', [error_type_str, buffer, error_filename, error_lineno])), p);
+                ('PHP4DELPHI %s:  %s in %s on line %d', [error_type_str, buffer, error_filename, error_lineno])));
+              {$ELSE}
+                php_log_err(zend_pchar(
+               {$IFDEF PHP_UNICE}Format{$ELSE}AnsiFormat{$ENDIF}
+               ('PHP4DELPHI %s:  %s in %s on line %d', [error_type_str, buffer, error_filename, error_lineno])), p);
+              {$ENDIF}
              end;
  end;
    if PHPLoaded then
@@ -1197,7 +1203,7 @@ function TpsvCustomPHP.Execute(AFileName: zend_ustr): zend_ustr;
 
 procedure TpsvCustomPHP.PrepareResult;
 var
-  ht  : PHashTable;
+  ht  : {$IFDEF PHP7}Pzend_array{$ELSE}PHashTable{$ENDIF};
   data: ^ppzval;
   cnt : integer;
   variable : pzval;
@@ -1338,7 +1344,7 @@ procedure TpsvCustomPHP.ShutdownRequest;
 
 procedure TpsvCustomPHP.PrepareVariables;
 var
-  ht  : PHashTable;
+  ht  : {$IFDEF PHP7}Pzend_array{$ELSE}PHashTable{$ENDIF};
   data: ^ppzval;
   cnt : integer;
   {$IFDEF PHP5}
@@ -1366,7 +1372,11 @@ procedure TpsvCustomPHP.PrepareVariables;
           if zend_hash_find(ht, zend_pchar(FVariables[cnt].Name),
           strlen(zend_pchar(FVariables[cnt].Name)) + 1, data) = SUCCESS then
           begin
+          {$IFDEF PHP7}
+          if (data^^^.u1.v._type = IS_STRING) then
+          {$ELSE}
             if (data^^^._type = IS_STRING) then
+          {$ENDIF}
              begin
                efree(data^^^.value.str.val);
                ZVAL_STRING(data^^, zend_pchar(FVariables[cnt].Value), true);

From 2c9ba90f2a4570ebbaa690be5f6b10bcc754562d Mon Sep 17 00:00:00 2001
From: Andrew Zenin <kashaket@yandex.ua>
Date: Tue, 23 Jul 2019 17:34:59 +0300
Subject: [PATCH 08/35] First steps to php7 support

---
 Source/DelphiFunctions.pas |   2 +-
 Source/PHP.INC             |   6 +-
 Source/PHPAPI.pas          |   3 +-
 Source/PHPFunctions.pas    |   3 +-
 Source/PHPTypes.pas        |   2 +-
 Source/ZENDAPI.pas         | 129 ++++++++++++++++++++++++++++---------
 Source/hzend_types.pas     |  75 ++++++++++++++++++---
 Source/php4delphi.pas      |   3 +-
 8 files changed, 171 insertions(+), 52 deletions(-)

diff --git a/Source/DelphiFunctions.pas b/Source/DelphiFunctions.pas
index 03283df..e1fb504 100644
--- a/Source/DelphiFunctions.pas
+++ b/Source/DelphiFunctions.pas
@@ -692,7 +692,7 @@ procedure RegisterInternalClasses(p : pointer);
 
 begin
   {$IFDEF PHP7}
-    object_functions
+   !
   {$ELSE}
   object_functions[0].fname := 'delphi_classname';
   object_functions[0].handler := @delphi_object_classname;
diff --git a/Source/PHP.INC b/Source/PHP.INC
index 12e4bf3..6347b1e 100644
--- a/Source/PHP.INC
+++ b/Source/PHP.INC
@@ -62,9 +62,9 @@ backward compatibility between PHP versions.
   {$DEFINE ZEND_WIN32}
   {$DEFINE PHP_COMPILER_ID}
 {$ENDIF}
-{..$DEFINE soulengine_build}
-{..$DEFINE PHP7}
-{..$DEFINE P_CUT}
+{$DEFINE soulengine_build}
+{.$DEFINE PHP7}
+{.$DEFINE P_CUT}
  {$IFDEF PHP7}
   {$DEFINE COMPILER_VC14}
   {$DEFINE PHP560}
diff --git a/Source/PHPAPI.pas b/Source/PHPAPI.pas
index 1a05ab5..7d3a22e 100644
--- a/Source/PHPAPI.pas
+++ b/Source/PHPAPI.pas
@@ -29,8 +29,7 @@ interface
  Windows
  {$ENDIF},
 
- ZendTypes,
- {$IFDEF PHP7} hzend_types,{$ENDIF}
+ {$IFDEF PHP7} hzend_types, {$ELSE} ZendTypes, {$ENDIF}
   PHPTypes, zendAPI,
 
 
diff --git a/Source/PHPFunctions.pas b/Source/PHPFunctions.pas
index bf35afa..a913537 100644
--- a/Source/PHPFunctions.pas
+++ b/Source/PHPFunctions.pas
@@ -23,8 +23,7 @@ interface
    {$IFDEF PHP_UNICE}WideStrUtils, {$ENDIF}
    {$IFDEF VERSION6} Variants,
    {$ENDIF}
-   {$IFDEF PHP7} hzend_types, {$ENDIF}
-   ZendTypes, PHPTypes, ZendAPI, PHPAPI ;
+  {$IFDEF PHP7} hzend_types, {$ELSE} ZendTypes, {$ENDIF} PHPTypes, ZendAPI, PHPAPI ;
 
 type
   TParamType = (tpString, tpInteger, tpFloat, tpBoolean, tpArray, tpUnknown);
diff --git a/Source/PHPTypes.pas b/Source/PHPTypes.pas
index 6b80fd4..3d00f20 100644
--- a/Source/PHPTypes.pas
+++ b/Source/PHPTypes.pas
@@ -16,7 +16,7 @@
 interface
 
 uses
-  {$IFNDEF FPC} Windows{$ELSE} LCLType{$ENDIF}, {$IFDEF PHP7}hzend_types,{$ENDIF} ZENDTypes;
+  {$IFNDEF FPC} Windows{$ELSE} LCLType{$ENDIF}, {$IFDEF PHP7} hzend_types {$ELSE} ZendTypes {$ENDIF};
 
 {$IFDEF PHP4}
 const
diff --git a/Source/ZENDAPI.pas b/Source/ZENDAPI.pas
index 3702676..3e61ec3 100644
--- a/Source/ZENDAPI.pas
+++ b/Source/ZENDAPI.pas
@@ -21,8 +21,7 @@ interface
 
 uses
   {$IFNDEF FPC} Windows{$ELSE} LCLType,LCLIntf,dynlibs,libc{$ENDIF}, SysUtils,
-  {$IFDEF PHP7} hzend_types, {$ENDIF}
-  ZendTypes, Variants,
+  {$IFDEF PHP7} hzend_types, {$ElSE} ZendTypes, {$ENDIF} Variants,
   PHPTypes;
 type
 TArrayVariant = array of variant;
@@ -218,8 +217,9 @@ function zend_hash_add(ht : {$IFDEF PHP7}Pzend_array{$ELSE}PHashTable{$ENDIF}; a
 
 var
   zend_hash_graceful_destroy                      : procedure(ht: PHashTable); cdecl;
+  {$IFNDEF PHP7}
   zend_hash_graceful_reverse_destroy              : zend_hash_graceful_reverse_destroy_t;
-
+  {$ENDIF}
   zend_hash_apply                                 : procedure(ht: PHashTable; apply_func: pointer; TSRMLS_DC: Pointer); cdecl;
 
   zend_hash_apply_with_argument                   : procedure(ht: PHashTable;
@@ -332,8 +332,17 @@ procedure zend_hash_internal_pointer_reset(ht: {$IFDEF PHP7} Pzend_array {$ELSE}
 
   zend_register_constant                          : function(var c: zend_constant; TSRMLS_DC: Pointer): Integer; cdecl;
 
-  zend_register_auto_global : function(name: zend_pchar; name_len: uint; callback: Pointer; TSRMLS_DC: Pointer): Integer; cdecl;
-
+  zend_register_auto_global :
+  {$IFDEF PHP700}
+  function(name:Pzend_string; jit:zend_bool; auto_global_callback:Pointer):longint; cdecl;
+  {$ELSE}
+    {$IFDEF PHP5}
+    function(name: zend_pchar; name_len: uint; jit:boolean; callback: Pointer; TSRMLS_DC: Pointer): Integer; cdecl;
+     zend_activate_auto_globals: procedure(TSRMLS_C: Pointer); cdecl;
+    {$ELSE}
+    function(name: zend_pchar; name_len: uint; callback: Pointer; TSRMLS_DC: Pointer): Integer; cdecl;
+    {$ENDIF}
+  {$ENDIF}
 procedure REGISTER_MAIN_LONG_CONSTANT(name: zend_pchar; lval: longint; flags: integer; TSRMLS_DC: Pointer);
 procedure REGISTER_MAIN_DOUBLE_CONSTANT(name: zend_pchar; dval: double; flags: integer; TSRMLS_DC: Pointer);
 procedure REGISTER_MAIN_STRING_CONSTANT(name: zend_pchar; str: zend_pchar; flags: integer; TSRMLS_DC: Pointer);
@@ -551,17 +560,32 @@ procedure convert_to_string(op: pzval);
   {$ELSE}
   zend_indent                                     : procedure; cdecl;
   {$ENDIF}
-  ZendGetParameters                               : function: integer; cdecl;
-  zend_get_params_ex : function(param_count : Integer; Args : {$IFNDEF PHP700} ppzval {$ELSE} pzval{$ENDIF}) :integer; cdecl varargs;
+  ZendGetParameters                               :
+  {$IFDEF PHP7}
+    function(ht:longint; param_count:longint):longint; cdecl varargs;
+  {$ELSE}
+    function: integer; cdecl;
+  {$ENDIF}
+  zend_get_params_ex :
+  {$IFDEF PHP7}
+  function(param_count:longint):longint; cdecl varargs;
+  {$ELSE}
+  function(param_count : Integer; Args : ppzval) :integer; cdecl varargs;
+  {$ENDIF}
+  {$IFDEF PHP7}
+   ZvalGetArgs: function(Count: Integer; Args: ppzval): Integer;cdecl varargs;
+	_zend_get_parameters_array_ex:function(param_count:longint; argument_array:Pzval):longint; cdecl;
+  {$ELSE}
+  _zend_get_parameters_array_ex : function(param_count: integer; argument_array:
+  pppzval; TSRMLS_CC: pointer): integer; cdecl;
+  {$ENDIF}
 function zend_get_parameters_ex(number: integer; var Params: pzval_array): integer;
 function zend_get_parameters_my(number: integer; var Params: pzval_array; TSRMLS_DC: Pointer): integer;
-
+{$IFNDEF PHP7}
 function zend_get_parameters(ht: integer; param_count: integer; Params: array of
 ppzval): integer;
+{$ENDIF}
 
-var
-  _zend_get_parameters_array_ex : function(param_count: integer; argument_array:
-  pppzval; TSRMLS_CC: pointer): integer; cdecl;
 
 procedure dispose_pzval_array(Params: pzval_array);
 
@@ -869,10 +893,10 @@ function Z_STRVAL(z : Pzval) : zend_ustr;
 function Z_STRUVAL(z : PZval): UTF8String;
 function Z_STRWVAL(z : pzval) : String;
 function Z_STRLEN(z : Pzval) : longint;
-function Z_ARRVAL(z : Pzval ) : {$IFDEF PHP7}Pzend_array{$ELSE}PHashTable{$ENDIF};
-function Z_OBJ_HANDLE(z :Pzval) : zend_object_handle;
-function Z_OBJ_HT(z : Pzval) : {$IFDEF PHP7}hzend_types.P_zend_object_handlers{$ELSE}pzend_object_handlers{$ENDIF};
-function Z_OBJPROP(z : Pzval) : {$IFDEF PHP7}hzend_types.PHashTable{$ELSE}PHashTable{$ENDIF};
+function Z_ARRVAL(z : Pzval ) : PHashTable;
+function Z_OBJ_HANDLE(z :Pzval) : {$IFDEF PHP7} P_zend_object_handlers {$ELSE} zend_object_handle{$ENDIF};
+function Z_OBJ_HT(z : Pzval) : {$IFDEF PHP7}P_zend_object_handlers{$ELSE}pzend_object_handlers{$ENDIF};
+function Z_OBJPROP(z : Pzval) : PHashTable;
 function Z_VARREC(z: pzval): TVarRec;
 
  procedure zend_addref_p(z: pzval); cdecl;
@@ -1306,7 +1330,7 @@ function ZValArrayKeyDel(v: pzval; key: zend_ustr): Boolean; overload;
   {$IFDEF PHP7}
   begin
   pzs^.len := strlen(zend_pchar(key));
-  pzs^.val := zend_pchar(key);
+  pzs^.val := estrdup(zend_pchar(key));
   Result := zend_hash_del_key_or_index(v.value.arr, pzs) = SUCCESS
   end;
   {$ELSE}
@@ -1326,7 +1350,7 @@ function ZValArrayKeyDel(v: pzval; idx: Integer): Boolean; overload;
   {$IFDEF PHP7}
   begin
   pzs^.len := strlen(zend_pchar(inttostr(idx)));
-  pzs^.val := zend_pchar(inttostr(idx));
+  pzs^.val := estrdup(zend_pchar(inttostr(idx)));
   Result := zend_hash_del_key_or_index(v.value.arr, pzs) = SUCCESS
   end;
   {$ELSE}
@@ -2458,6 +2482,9 @@ function LoadZEND(const DllFilename: zend_ustr = PHPWin) : boolean;
   zend_register_constant := GetProcAddress(PHPLib, 'zend_register_constant');
 
   zend_register_auto_global := GetProcAddress(PHPLib, 'zend_register_auto_global');
+  {$IFDEF PHP5}
+  zend_activate_auto_globals := GetProcAddress(PHPLib, 'zend_activate_auto_globals');
+  {$ENDIF}
 
   // -- tsrm_shutdown
   tsrm_shutdown := GetProcAddress(PHPLib, 'tsrm_shutdown');
@@ -2725,6 +2752,8 @@ function LoadZEND(const DllFilename: zend_ustr = PHPWin) : boolean;
   {$IFDEF PHP7}
   // -- zend_parse_parameters_throw
   zend_parse_parameters_throw := GetProcAddress(PHPLib, 'zend_parse_parameters_throw');
+  ZvalGetArgs  := GetProcAddress(PHPLib, 'zend_get_parameters_ex');
+  _zend_get_parameters_array_ex := GetProcAddress(PHPLib, '_zend_get_parameters_array_ex');
   {$ELSE}
   // -- zend_indent
   zend_indent := GetProcAddress(PHPLib, 'zend_indent');
@@ -3026,34 +3055,64 @@ function zend_get_parameters_ex(number: integer; var Params: pzval_array): integ
 var
   i  : integer;
 begin
-  SetLength(Params, number);
+
   if number = 0 then
   begin
     Result := SUCCESS;
     Exit;
   end;
+  {$IFDEF PHP7}
+  Params.value.arr.nNumOfElements := number;
+  for i := 0 to number - 1 do
+    zend_hash_index_add_empty_element(Params.value.arr, i);
+  Result := ZvalGetArgs(number, @Params);
+  {$ELSE}
+   SetLength(Params, number);
   for i := 0 to number - 1 do
     New(Params[i]);
-
   Result := zend_get_parameters(number, number, Params);
+  {$ENDIF}
 end;
 
 function zend_get_parameters_my(number: integer; var Params: pzval_array; TSRMLS_DC: Pointer): integer;
 var
   i  : integer;
-  p: pppzval;
+
+  p:
+  {$IFDEF PHP7}
+  pzval
+  {$ELSE}
+  pppzval
+  {$ENDIF};
 begin
-  SetLength(Params, number);
   if number = 0 then
   begin
     Result := SUCCESS;
     Exit;
   end;
+  {$IFDEF PHP7}
+  Params.value.arr.nNumOfElements := number;
+  for i := 0 to number - 1 do
+    zend_hash_index_add_empty_element(Params.value.arr, i);
+
+  p := emalloc(number * sizeOf(zval));
+  Result := _zend_get_parameters_array_ex(number, p);
+
+  for i := 0 to number - 1 do
+  begin
+    _zend_hash_update_ind(Params.value.arr, i, p, '', 0);
+     if i <> number then
+         inc(integer(p), sizeof(zval));
+  end;
+
+  efree(p);
+    _zend_get_parameters_array_ex(number, p);
+  {$ELSE}
+  SetLength(Params, number);
   for i := 0 to number - 1 do
     New(Params[i]);
-  {$IFNDEF PHP700}
+
   p := emalloc(number * sizeOf(ppzval));
-  {$ENDIF}
   Result := _zend_get_parameters_array_ex(number, p, TSRMLS_DC);
 
   for i := 0 to number - 1 do
@@ -3064,8 +3123,9 @@ function zend_get_parameters_my(number: integer; var Params: pzval_array; TSRMLS
   end;
 
   efree(p);
+  {$ENDIF}
 end;
-
+{$IFNDEF PHP7}
 function zend_get_parameters(ht: integer; param_count: integer; Params: array of ppzval): integer; assembler; register;
 asm
   push  esi
@@ -3092,15 +3152,20 @@ function zend_get_parameters(ht: integer; param_count: integer; Params: array of
   loop   @toploop2
   pop     esi
 end;
-
+{$ENDIF}
 procedure dispose_pzval_array(Params: pzval_array);
 var
   i : integer;
 begin
+  {$IFDEF PHP7}
+  if Params.value.arr.nNumOfElements>0 then
+    for i := 0 to Params.value.arr.nNumOfElements-1 do
+      Freemem(zend_hash_index_findZval(Params,i));
+  {$ELSE}
   if Length(Params)>0 then
-
   for i := 0 to High(Params) do
     FreeMem(Params[i]);
+  {$ENDIF}
   Params := nil;
 end;
 
@@ -3302,6 +3367,8 @@ procedure CheckZendErrors;
   if @zend_html_puts = nil then raise EPHP4DelphiException.Create('zend_html_puts');
   {$IFDEF PHP7}
   if @zend_parse_parameters_throw = nil then EPHP4DelphiException.Create('zend_parse_parameters_throw');
+  if @ZvalGetArgs = nil then EPHP4DelphiException.Create('ZvalGetArgs');
+  if @_zend_get_parameters_array_ex = nil then EPHP4DelphiException.Create('_zend_get_parameters_array_ex');
   {$ELSE}
   if @zend_indent = nil then raise EPHP4DelphiException.Create('zend_indent');
   {$ENDIF}
@@ -3418,7 +3485,7 @@ function zend_unregister_functions(functions : {$IFDEF PHP7}P_zend_function_entr
       break;
       {$IFDEF PHP7}
       pzs^.len := strlen(ptr.fname);
-      pzs^.val := ptr.fname;
+      pzs^.val := estrdup(ptr.fname);
       zend_hash_del_key_or_index(function_table, pzs);
       {$ELSE}
       zend_hash_del_key_or_index(function_table, ptr.fname, strlen(ptr.fname) +1, 0, HASH_DEL_KEY);
@@ -3614,7 +3681,7 @@ function Z_BVAL(z : pzval) : boolean;
   end;
 
   if {$IFDEF PHP7}z.u1.v._type{$ELSE}z._type{$ENDIF} = IS_BOOL then
-     Result := zend_bool(z.value.lval)
+     Result := boolean(zend_bool(z.value.lval))
   else
     case {$IFDEF PHP7}z.u1.v._type{$ELSE}z._type{$ENDIF} of
        IS_DOUBLE: if Trunc(z.value.dval) = 0 then Result := false else Result := true;
@@ -3766,9 +3833,9 @@ function Z_ARRVAL(z : pzval ) : {$IFDEF PHP7}Pzend_array{$ELSE}PHashTable{$ENDIF
   Result := {$IFDEF PHP7} z.value.arr {$ELSE}z.value.ht{$ENDIF};
 end;
 
-function Z_OBJ_HANDLE(z :pzval) : zend_object_handle;
+function Z_OBJ_HANDLE(z :pzval) : {$IFDEF PHP7} P_zend_object_handlers {$ELSE} zend_object_handle{$ENDIF};
 begin
-  Result := z.value.obj.handle;
+  Result := {$IFDEF PHP7}z.value.obj.handlers{$ELSE}z.value.obj.handle{$ENDIF};
 end;
 
 function Z_OBJ_HT(z : pzval) : {$IFDEF PHP7}hzend_types.P_zend_object_handlers{$ELSE}pzend_object_handlers{$ENDIF};
@@ -3824,7 +3891,7 @@ function zend_hash_add_or_update(ht : {$IFDEF PHP7}Pzend_array{$ELSE}PHashTable{
 begin
   {$IFDEF PHP7}
     pz^.len := strlen(arKey);
-    pz^.val := arKey;
+    pz^.val := estrdup(arKey);
    if Assigned(_zend_hash_add_or_update) then
    Result := _zend_hash_add_or_update(ht, pz, pData, flag, '', 0).u2.fe_iter_idx
   {$ELSE}
diff --git a/Source/hzend_types.pas b/Source/hzend_types.pas
index b24c349..e079681 100644
--- a/Source/hzend_types.pas
+++ b/Source/hzend_types.pas
@@ -132,7 +132,28 @@ interface
  SAPI_DEFAULT_CHARSET	=	PHP_DEFAULT_CHARSET;
  SAPI_PHP_VERSION_HEADER	=	'X-Powered-By: PHP/" PHP_VERSION';
 
-
+   //zend_constants.h
+const
+  CONST_CS                                        = (1 shl 0) { Case Sensitive }
+  ;
+  CONST_PERSISTENT                                = (1 shl 1) { Persistent }
+  ;
+const
+  ZEND_INTERNAL_FUNCTION                          = 1;
+  ZEND_USER_FUNCTION                              = 2;
+  ZEND_OVERLOADED_FUNCTION                        = 3;
+  ZEND_EVAL_CODE                                  = 4;
+  ZEND_INTERNAL_CLASS                             = 1;
+  ZEND_USER_CLASS                                 = 2;
+  ZEND_EVAL                                       = (1 shl 0);
+  ZEND_INCLUDE                                    = (1 shl 1);
+  ZEND_INCLUDE_ONCE                               = (1 shl 2);
+  ZEND_REQUIRE                                    = (1 shl 3);
+  ZEND_REQUIRE_ONCE                               = (1 shl 4);
+  ZEND_ISSET                                      = (1 shl 0);
+  ZEND_ISEMPTY                                    = (1 shl 1);
+  ZEND_CT                                         = (1 shl 0);
+  ZEND_RT                                         = (1 shl 1);
 type
   pppointer = ^ppointer;
 
@@ -378,7 +399,7 @@ interface
   PBucket = ^Bucket;
   Pzend_refcounted_h = ^zend_refcounted_h;
   Pzend_auto_global = ^zend_auto_global;
-  Pzend_internal_function = ^zend_internal_function;
+  Pzend_internal_function = ^tzend_internal_function;
   P_zend_internal_function = ^_zend_internal_function;
   P_zend_call_kind = ^_zend_call_kind;
   P_zend_auto_global = ^_zend_auto_global;
@@ -592,8 +613,40 @@   _zend_fcall_info_cache = record
           end;
     end;
     zval = _zval_struct;
-
-
+  PZendConstant = ^TZendConstant;
+  zend_constant = record
+    value: zval;
+    flags: Integer;
+    name: zend_pchar;
+    name_len: uint;
+    module_number: Integer;
+  end;
+  TZendConstant = zend_constant;
+  Pzend_syntax_highlighter_ini = ^Tzend_syntax_highlighter_ini;
+  zend_syntax_highlighter_ini =
+    record
+    highlight_html    : zend_pchar;
+    highlight_comment : zend_pchar;
+    highlight_default : zend_pchar;
+    highlight_string  : zend_pchar;
+    highlight_keyword : zend_pchar;
+  end;
+    PStat = ^TStat;
+  TStat = record
+    st_dev: Word;
+    st_ino: Word;
+    st_mode: Word;
+    st_nlink: SmallInt;
+    st_uid: SmallInt;
+    st_gid: SmallInt;
+    st_rdev: Word;
+    st_size: Longint;
+    st_atime: Longint;
+    st_mtime: Longint;
+    st_ctime: Longint;
+  end;
+  Stat = TStat;
+  Tzend_syntax_highlighter_ini = zend_syntax_highlighter_ini;
   compare_func_t = function (_para1:pointer; _para2:pointer):longint;cdecl;
 
   swap_func_t = procedure (_para1:pointer; _para2:pointer);cdecl;
@@ -706,7 +759,7 @@   _zend_array = record
     end;
     HashTable = _zend_array ;
     	zend_array = _zend_array;
-
+    pzval_array = pzval;
   _zend_ast = record
       kind : zend_ast_kind;
       attr : zend_ast_attr;
@@ -949,6 +1002,7 @@   _zend_stream = record
     end;
   zend_stream = _zend_stream;
 
+  PZendFileHandle = ^_zend_file_handle;
   _zend_file_handle = record
       handle : record
           case longint of
@@ -991,7 +1045,7 @@   _zend_utility_values = record
   zend_utility_values = _zend_utility_values;
 
   zend_write_func_t = function (str:zend_pchar; str_length:size_t):longint;cdecl;
-
+  zend_write_t = zend_write_func_t;
 
   zend_error_handling_t = (EH_NORMAL = 0,EH_SUPPRESS,EH_THROW);
 
@@ -1216,7 +1270,7 @@   _zend_internal_function = record
       module : P_zend_module_entry;
       reserved : array[0..3] of pointer;
     end;
-  zend_internal_function = _zend_internal_function;
+  tzend_internal_function = _zend_internal_function;
 
 
 
@@ -1236,7 +1290,7 @@   _zend_function = record
             arg_info : Pzend_arg_info;
           end );
         2 : ( op_array : zend_op_array );
-        3 : ( internal_function : zend_internal_function );
+        3 : ( internal_function : tzend_internal_function );
       end;
 
   zend_function = _zend_function;
@@ -1884,6 +1938,7 @@   _zend_arena = record
       prev : P_zend_arena;
     end;
    zend_arena = _zend_arena;
+  Pzend_compiler_globals = ^_zend_compiler_globals;
   _zend_compiler_globals = record
       loop_var_stack : zend_stack;
       active_class_entry : P_zend_class_entry;
@@ -1933,7 +1988,7 @@   _zend_objects_store = record
     end;
   zend_objects_store = _zend_objects_store;
 
-
+  Pzend_executor_globals = ^_zend_executor_globals;
   _zend_executor_globals = record
       uninitialized_zval : zval;
       error_zval : zval;
@@ -2826,7 +2881,7 @@    Tsmart_str = record
 zend_hash_extend:procedure(ht:PHashTable; nSize:uint32_t; _packed:zend_bool); cdecl;
 _zend_hash_add_or_update:function(ht:PHashTable; key:Pzend_string; pData:Pzval; flag:uint32_t; __zend_filename:Pchar; __zend_lineno:uint):Pzval; cdecl;
 _zend_hash_update:function(ht:PHashTable; key:Pzend_string; pData:Pzval; __zend_filename:Pchar; __zend_lineno:uint):Pzval; cdecl;
-_zend_hash_update_ind:function(ht:PHashTable; key:Pzend_string; pData:Pzval; __zend_filename:Pchar; __zend_lineno:uint):Pzval; cdecl;
+_zend_hash_update_ind:function(ht:PHashTable; key:Cardinal; pData:Pzval; __zend_filename:Pchar; __zend_lineno:uint):Pzval; cdecl;
 _zend_hash_add:function(ht:PHashTable; key:Pzend_string; pData:Pzval; __zend_filename:Pchar; __zend_lineno:uint):Pzval; cdecl;
 _zend_hash_add_new:function(ht:PHashTable; key:Pzend_string; pData:Pzval; __zend_filename:Pchar; __zend_lineno:uint):Pzval; cdecl;
 _zend_hash_str_add_or_update:function(ht:PHashTable; key:Pchar; len:size_t; pData:Pzval; flag:uint32_t; __zend_filename:Pchar; __zend_lineno:uint):Pzval; cdecl;
diff --git a/Source/php4delphi.pas b/Source/php4delphi.pas
index 7df32d9..248b55f 100644
--- a/Source/php4delphi.pas
+++ b/Source/php4delphi.pas
@@ -38,8 +38,7 @@ interface
 uses
   Windows, Messages, SysUtils, System.Types, Classes, VCL.Graphics,
   PHPCommon, WinApi.WinSock,
-  {$IFDEF PHP7} hzend_types, {$ENDIF}
-  ZendTypes, PHPTypes, PHPAPI, ZENDAPI,
+  {$IFDEF PHP7} hzend_types, {$ELSE} ZendTypes, {$ENDIF} PHPTypes, PHPAPI, ZENDAPI,
   DelphiFunctions, phpFunctions, strUtils, varUtils,
   {$IFDEF PHP_UNICE}WideStrUtils, {$ENDIF}
   {$IFDEF soulengine_build} VCL.Dialogs, {$ENDIF}

From 4c7cc09c82c7dd27d0ef3f9affa9814182daef43 Mon Sep 17 00:00:00 2001
From: Andrew Zenin <kashaket@yandex.ua>
Date: Fri, 26 Jul 2019 19:37:25 +0300
Subject: [PATCH 09/35] Update ZENDAPI.pas

---
 Source/ZENDAPI.pas | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/Source/ZENDAPI.pas b/Source/ZENDAPI.pas
index 3e61ec3..7b6f3b6 100644
--- a/Source/ZENDAPI.pas
+++ b/Source/ZENDAPI.pas
@@ -251,8 +251,9 @@ function zend_hash_add(ht : {$IFDEF PHP7}Pzend_array{$ELSE}PHashTable{$ENDIF}; a
   zend_hash_find                                  : function(ht: {$IFDEF PHP7} Pzend_array {$ELSE} PHashTable{$ENDIF}; arKey: zend_pchar; nKeyLength: uint;
     pData: Pointer): Integer; cdecl;
 
-  zend_hash_quick_find                            : function(ht: {$IFDEF PHP7} Pzend_array {$ELSE} PHashTable{$ENDIF}; arKey: zend_pchar;
-    nKeyLength: uint; h: ulong; pData: Pointer): Integer; cdecl;
+  zend_hash_quick_find                            :
+   function(ht: {$IFDEF PHP7} Pzend_array {$ELSE} PHashTable{$ENDIF}; arKey: zend_pchar;
+    nKeyLength: uint; h: ulong; out pData: ppzval): Integer; cdecl;
 
   zend_hash_index_find                            : function(ht: {$IFDEF PHP7} Pzend_array {$ELSE} PHashTable{$ENDIF}; h: ulong; pData: Pointer): Integer; cdecl;
 
@@ -570,7 +571,7 @@ procedure convert_to_string(op: pzval);
   {$IFDEF PHP7}
   function(param_count:longint):longint; cdecl varargs;
   {$ELSE}
-  function(param_count : Integer; Args : ppzval) :integer; cdecl varargs;
+  function(param_count : Integer; Args : ppzval): integer; cdecl varargs;
   {$ENDIF}
   {$IFDEF PHP7}
    ZvalGetArgs: function(Count: Integer; Args: ppzval): Integer;cdecl varargs;
@@ -1152,7 +1153,7 @@ procedure ZvalVAL(z:pzval; v:Integer; const _type:Integer = IS_LONG);
   {$ELSE}
   z^._type
   {$ENDIF}  := _type;
-  z.value.lval := v;
+  z^.value.lval := v;
 End;
 
 procedure ZvalVAL(z:pzval);
@@ -2946,7 +2947,7 @@ function LoadZEND(const DllFilename: zend_ustr = PHPWin) : boolean;
   ZendGetParameters := GetProcAddress(PHPLib, 'zend_get_parameters');
 
   // - zend_get_parameters_ex (native call)
-  zend_get_params_ex := GetProcAddress(PHPLib, 'zend_get_params_ex');
+  zend_get_params_ex := GetProcAddress(PHPLib, 'zend_get_parameters_ex');
   {$IFDEF PHP5}
   zend_destroy_file_handle := GetProcAddress(PHPLib, 'zend_destroy_file_handle');
   {$ENDIF}

From 618d3b60fdf817552c196b721269f29dc513538e Mon Sep 17 00:00:00 2001
From: Andrew Zenin <kashaket@yandex.ua>
Date: Sat, 27 Jul 2019 02:25:45 +0300
Subject: [PATCH 10/35] Added custom embedded extensions support

---
 Source/PHPAPI.pas     |  8 ++++----
 Source/ZENDAPI.pas    | 33 ++++++++++++++++++++++++++++++++-
 Source/ZendTypes.pas  |  1 +
 Source/php4delphi.pas | 41 +++++++++++++++++++++++++++++++++++++----
 4 files changed, 74 insertions(+), 9 deletions(-)

diff --git a/Source/PHPAPI.pas b/Source/PHPAPI.pas
index 7d3a22e..f53ccc7 100644
--- a/Source/PHPAPI.pas
+++ b/Source/PHPAPI.pas
@@ -218,8 +218,8 @@ procedure variant2zval(value : variant; var z : pzval);
 
 php_raw_url_encode: function (s : zend_pchar; len : Integer; new_length : PInteger) : zend_pchar; cdecl;
 
-{$IFDEF PHP510}
-php_register_extensions: function (ptr : pointer; count: integer; TSRMLS_DC: pointer) : integer; cdecl;
+{$IFDEF PHP5}
+php_register_extensions: function (ptr : PPzend_module_entry; count: integer; TSRMLS_DC: pointer) : integer; cdecl;
 {$ELSE}
 php_startup_extensions: function (ptr: pointer; count : integer) : integer; cdecl;
 {$ENDIF}
@@ -802,7 +802,7 @@ function LoadPHP(const DllFileName: zend_ustr = PHPWin) : boolean;
 
   php_raw_url_encode                  := GetProcAddress(PHPLib, 'php_raw_url_encode');
 
-  {$IFDEF PHP510}
+  {$IFDEF PHP5}
   php_register_extensions              := GetProcAddress(PHPLib, 'php_register_extensions');
   {$ELSE}
   php_startup_extensions              := GetProcAddress(PHPLib, 'php_startup_extensions');
@@ -866,7 +866,7 @@ procedure CheckPHPErrors;
   if @php_url_encode = nil then raise EPHP4DelphiException.Create('php_url_encode');
   if @php_raw_url_encode = nil then raise EPHP4DelphiException.Create('php_raw_url_encode');
 
-  {$IFDEF PHP510}
+  {$IFDEF PHP5}
   if @php_register_extensions = nil then raise EPHP4DelphiException.Create('php_register_extensions');
   {$ELSE}
   if @php_startup_extensions = nil then raise EPHP4DelphiException.Create('php_startup_extensions');
diff --git a/Source/ZENDAPI.pas b/Source/ZENDAPI.pas
index 7b6f3b6..e7c4b51 100644
--- a/Source/ZENDAPI.pas
+++ b/Source/ZENDAPI.pas
@@ -729,6 +729,12 @@ procedure ZEND_PUTS(str: zend_pchar);
 var
   zend_register_internal_class     : function(class_entry: pzend_class_entry; TSRMLS_DC: pointer): Pzend_class_entry; cdecl;
   zend_register_internal_class_ex  : function(class_entry: pzend_class_entry; parent_ce: pzend_class_entry; parent_name: zend_pchar; TSRMLS_DC: pointer): Pzend_class_entry; cdecl;
+  zend_startup_module              : function(module_entry: Pzend_module_entry):integer; cdecl;
+  zend_startup_module_ex           : function(module_entry: Pzend_module_entry; TSRMLS_DC: pointer):integer; cdecl;
+  zend_register_module_ex          : function(module_entry: Pzend_module_entry; TSRMLS_DC: pointer): Pzend_module_entry;cdecl;
+  zend_register_internal_module    : function(module_entry: Pzend_module_entry; TSRMLS_DC: pointer): Pzend_module_entry;cdecl;
+  zend_startup_modules             : function(TSRMLS_DC:pointer):integer;
+  zend_collect_module_handlers     : function(TSRMLS_DC:pointer):integer;
   function ZvalInt(z:zval):Integer;
   function ZvalDouble(z:zval):Double;
   function ZvalBool(z:zval):Boolean;
@@ -2922,12 +2928,30 @@ function LoadZEND(const DllFilename: zend_ustr = PHPWin) : boolean;
   // -- _object_and_properties_init
   _object_and_properties_init := GetProcAddress(PHPLib, '_object_and_properties_init');
 
-    // -- zend_register_internal_class
+  // -- zend_register_internal_class
   zend_register_internal_class := GetProcAddress(PHPLib, 'zend_register_internal_class');
 
   // -- zend_register_internal_class_ex
   zend_register_internal_class_ex := GetProcAddress(PHPLib, 'zend_register_internal_class_ex');
 
+  // -- zend_startup_module
+  zend_startup_module  := GetProcAddress(PHPLib, 'zend_startup_module');
+
+  // -- zend_startup_module_ex
+  zend_startup_module_ex  := GetProcAddress(PHPLib, 'zend_startup_module_ex');
+
+  // -- zend_register_module_ex
+  zend_register_module_ex := GetProcAddress(PHPLib, 'zend_register_module_ex');
+
+  // --  zend_register_internal_module
+  zend_register_internal_module := GetProcAddress(PHPLib, 'zend_register_internal_module');
+
+  // -- zend_startup_modules
+  zend_startup_modules := GetProcAddress(PHPLib, 'zend_startup_modules');
+
+  // -- zend_collect_module_handlers
+  zend_collect_module_handlers := GetProcAddress(PHPLib, 'zend_collect_module_handlers');
+
   // -- get_zend_version
   get_zend_version := GetProcAddress(PHPLib, 'get_zend_version');
 
@@ -3431,6 +3455,13 @@ procedure CheckZendErrors;
   if @_object_and_properties_init = nil then raise EPHP4DelphiException.Create('_object_and_properties_init');
   if @zend_register_internal_class = nil then raise EPHP4DelphiException.Create('zend_register_internal_class');
   if @zend_register_internal_class_ex = nil then raise EPHP4DelphiException.Create('zend_register_internal_class_ex');
+  if @zend_startup_module = nil then raise EPHP4DelphiException.Create('zend_startup_module');
+  if @zend_startup_module_ex = nil then raise EPHP4DelphiException.Create('zend_startup_module_ex');
+  if @zend_register_module_ex = nil then raise EPHP4DelphiException.Create('zend_register_module_ex');
+  if @zend_register_internal_module = nil then raise EPHP4DelphiException.Create('zend_register_internal_module');
+  if @zend_startup_modules = nil then raise EPHP4DelphiException.Create('zend_startup_modules');
+  if @zend_collect_module_handlers = nil then raise EPHP4DelphiException.Create('zend_collect_module_handlers');
+
   if @get_zend_version = nil then raise EPHP4DelphiException.Create('get_zend_version');
   if @zend_make_printable_zval = nil then raise EPHP4DelphiException.Create('zend_make_printable_zval');
   if @zend_print_zval = nil then raise EPHP4DelphiException.Create('zend_print_zval');
diff --git a/Source/ZendTypes.pas b/Source/ZendTypes.pas
index 627b682..b48329a 100644
--- a/Source/ZendTypes.pas
+++ b/Source/ZendTypes.pas
@@ -1204,6 +1204,7 @@   _zend_function_entry = record
   end;
   {$ENDIF}
   Pzend_module_entry = ^Tzend_module_entry;
+  PPzend_module_entry = ^Pzend_module_entry;
   p_zend_module_entry = ^_zend_module_entry;
   _zend_module_entry = record
     size                  : word;
diff --git a/Source/php4delphi.pas b/Source/php4delphi.pas
index 248b55f..8979854 100644
--- a/Source/php4delphi.pas
+++ b/Source/php4delphi.pas
@@ -194,11 +194,12 @@   TCustomPHPLibrary = class(TPHPComponent)
     property Locked : boolean read FLocked write FLocked;
   end;
   { TPHPEngine }
-
+  TPHPEngineInitEvent =  procedure(Sender:TObject;TSRMLS_DC:Pointer) of object;
   TPHPEngine = class(TPHPComponent, IUnknown, IPHPEngine)
   private
     FINIPath : AnsiString;
     FOnEngineStartup  : TNotifyEvent;
+    FAddMods          : TArray<Pzend_module_entry>;
     FOnEngineShutdown : TNotifyEvent;
     FEngineActive     : boolean;
     FHandleErrors     : boolean;
@@ -245,6 +246,7 @@   TPHPEngine = class(TPHPComponent, IUnknown, IPHPEngine)
     constructor Create(AOwner : TComponent); override;
     destructor Destroy; override;
     procedure AddFunction(FN: zend_ustr; Func: Pointer);
+    procedure AddModule(Module_entry: Pzend_module_entry);
     procedure  StartupEngine; virtual;
     procedure  ShutdownEngine; virtual;
     procedure  LockEngine; virtual;
@@ -1285,7 +1287,6 @@ procedure TpsvCustomPHP.StartupRequest;
      FOnReadPost(Self, FPostStream);
 
     zend_alter_ini_entry('max_execution_time', 19, zend_pchar(TimeStr), Length(TimeStr), ZEND_INI_SYSTEM, ZEND_INI_STAGE_RUNTIME);
-
     php_request_startup(TSRMLS_D);
     if Assigned(FOnRequestStartup) then
       FOnRequestStartup(Self);
@@ -1340,7 +1341,6 @@ procedure TpsvCustomPHP.ShutdownRequest;
 
 end;
 
-
 procedure TpsvCustomPHP.PrepareVariables;
 var
   ht  : {$IFDEF PHP7}Pzend_array{$ELSE}PHashTable{$ENDIF};
@@ -1904,6 +1904,7 @@ procedure TPHPEngine.RefreshLibrary;
 procedure TPHPEngine.StartupEngine;
 var
  i : integer;
+  x: Pzend_module_entry;
 begin
   if PHPEngine <> Self then
    begin
@@ -1943,8 +1944,14 @@ procedure TPHPEngine.StartupEngine;
 
       php_module_startup(@delphi_sapi_module, @FLibraryModule, 1);
 
-
       TSRMLS_D := ts_resource_ex(0, nil);
+      if Length(FAddMods) > 0 then
+      for x in FAddMods do
+      begin
+        zend_register_module_ex(x, TSRMLS_D);
+        zend_startup_module_ex(x, TSRMLS_D);
+      end;
+
 
       PrepareIniEntry;
       RegisterConstants;
@@ -2059,8 +2066,18 @@ procedure TPHPEngine.UnlockLibraries;
 end;
 
 procedure TPHPEngine.RemoveRequest;
+var
+  x: Pzend_module_entry;
+  xp: function(_type : integer; module_number : integer; TSRMLS_DC : pointer):integer;cdecl;
 begin
   InterlockedDecrement(FRequestCount);
+  if Length(FAddMods) > 0 then
+    for x in FAddMods do
+    begin
+      xp := x^.request_shutdown_func;
+       if(Assigned(xp)) then
+         xp(x^._type, x^.module_number, TSRMLS_D);
+    end;
 end;
 
 procedure TPHPEngine.AddFunction(FN: zend_ustr; Func: Pointer);
@@ -2069,9 +2086,25 @@ procedure TPHPEngine.AddFunction(FN: zend_ustr; Func: Pointer);
     MyFuncs.AddObject(FN, TObject(Func));
 end;
 
+procedure TPHPEngine.AddModule(Module_entry: Pzend_module_entry);
+begin
+  SetLength(FAddMods, Length(FAddMods)+1);
+  FAddMods[High(FAddMods)] := Module_entry;
+end;
+
 procedure TPHPEngine.AddRequest;
+var
+  x: Pzend_module_entry;
+  xp: function(_type : integer; module_number : integer; TSRMLS_DC : pointer):integer;cdecl;
 begin
   InterlockedIncrement(FRequestCount);
+    if Length(FAddMods) > 0 then
+    for x in FAddMods do
+    begin
+      xp := x^.request_startup_func;
+       if(Assigned(xp)) then
+          xp(x^._type, x^.module_number, TSRMLS_D);
+    end;
 end;
 
 initialization

From b85018e7031c60864475a7f9fc5f40f7df5a0413 Mon Sep 17 00:00:00 2001
From: Andrew Zenin <kashaket@yandex.ua>
Date: Sun, 4 Aug 2019 19:50:41 +0300
Subject: [PATCH 11/35] Update ZENDAPI.pas

---
 Source/ZENDAPI.pas | 34 +++++++++++++++++++++++++++++++---
 1 file changed, 31 insertions(+), 3 deletions(-)

diff --git a/Source/ZENDAPI.pas b/Source/ZENDAPI.pas
index e7c4b51..9e2aeca 100644
--- a/Source/ZENDAPI.pas
+++ b/Source/ZENDAPI.pas
@@ -876,7 +876,7 @@ procedure CheckZendErrors;
  zend_ini_deactivate : function(TSRMLS_D : pointer) : integer; cdecl;
 
 function GetGlobalResource(resource_name: AnsiString) : pointer;
-
+function GetGlobalResourceDC(resource_name: AnsiString;TSRMLS_DC:pointer) : pointer;
 function GetCompilerGlobals : Pzend_compiler_globals;
 function GetExecutorGlobals : pzend_executor_globals;
 function GetAllocGlobals : pointer;
@@ -1595,10 +1595,13 @@ function ZendToVariant(const Value: pppzval): Variant; overload;
   S: String;
 begin
  case {$IFDEF PHP7} Value^^^.u1.v._type {$ELSE}Value^^^._type{$ENDIF} of
+ 0: Result := Null;
  1: Result := Value^^^.value.lval;
  2: Result := Value^^^.value.dval;
- 6: begin S := Value^^^.value.str.val; Result := S; end;
- 4,5: Result := Null;
+ 3: Result := boolean(Value^^^.value.lval);
+ 8: begin S := Value^^^.value.str.val; Result := S; end;
+ 6: begin S := Value^^^.value.str.val; Result := S; end
+ else Result := Null;
  end;
 end;
 
@@ -3631,6 +3634,31 @@ function GetGlobalResource(resource_name: AnsiString) : pointer;
   end;
 end;
 
+function GetGlobalResourceDC(resource_name: AnsiString;TSRMLS_DC:pointer) : pointer;
+var
+ global_id : pointer;
+ global_value : integer;
+ global_ptr   : pointer;
+begin
+  Result := nil;
+  try
+    global_id := GetProcAddress(PHPLib, zend_pchar(resource_name));
+    if Assigned(global_id) then
+     begin
+       global_value := integer(global_id^);
+       asm
+         mov ecx, global_value
+         mov edx, dword ptr TSRMLS_DC
+         mov eax, dword ptr [edx]
+         mov ecx, dword ptr [eax+ecx*4-4]
+         mov global_ptr, ecx
+       end;
+       Result := global_ptr;
+     end;
+  except
+    Result := nil;
+  end;
+end;
 
 function GetCompilerGlobals : Pzend_compiler_globals;
 begin

From fcd7e70f83ae5fbc5c83f10817ca5a9f4683e6da Mon Sep 17 00:00:00 2001
From: Andrew Zenin <kashaket@yandex.ua>
Date: Sun, 4 Aug 2019 23:53:01 +0300
Subject: [PATCH 12/35] zval routines

---
 Source/DelphiFunctions.pas |   4 +-
 Source/PHPAPI.pas          |  77 ----------
 Source/PHPFunctions.pas    |  20 +--
 Source/ZENDAPI.pas         | 293 +++++++++++++++++++++++++------------
 Source/php4delphi.pas      |   6 +-
 5 files changed, 217 insertions(+), 183 deletions(-)

diff --git a/Source/DelphiFunctions.pas b/Source/DelphiFunctions.pas
index e1fb504..78a0a2a 100644
--- a/Source/DelphiFunctions.pas
+++ b/Source/DelphiFunctions.pas
@@ -198,7 +198,7 @@ procedure delphi_date(ht : integer; return_value : pzval; this_ptr : pzval;
       return_value_used : integer; TSRMLS_DC : pointer); cdecl;
 {$ENDIF}
 begin
-  ZVAL_DOUBLE(return_value, Date);
+  ZVALVAL(return_value, Date);
 end;
 
 //proto string delphi_extract_file_dir(string source)
@@ -658,7 +658,7 @@ procedure delphi_is_uc(ht : integer; return_value : pzval; this_ptr : pzval;
       return_value_used : integer; TSRMLS_DC : pointer);
 {$ENDIF}
 begin
-    {$IFDEF PHP_UNICE}ZVAL_TRUE{$ELSE}ZVAL_FALSE{$ENDIF}(return_value);
+    ZVALVAL(return_value, {$IFDEF PHP_UNICE}TRUE{$ELSE}FALSE{$ENDIF});
 end;
 
 {$IFDEF PHP510}
diff --git a/Source/PHPAPI.pas b/Source/PHPAPI.pas
index f53ccc7..1f0cf58 100644
--- a/Source/PHPAPI.pas
+++ b/Source/PHPAPI.pas
@@ -199,11 +199,6 @@ function GetSAPIGlobals(TSRMLS_DC : pointer) : Psapi_globals_struct; overload;
 php_ini_double: function(name : zend_pchar; name_length : uint; orig : Integer) : Double; cdecl;
 
 php_ini_string: function(name : zend_pchar; name_length : uint; orig : Integer) : zend_pchar; cdecl;
-
-function  zval2variant(value : zval) : variant;
-procedure variant2zval(value : variant; var z : pzval);
-
-
 var
 
 php_url_free: procedure (theurl : pphp_url); cdecl;
@@ -426,19 +421,6 @@ function GetSAPIGlobals(TSRMLS_DC : pointer) : Psapi_globals_struct;
    end;
 end;
 
-function zval2variant(value : zval) : variant;
-begin
-  case {$IFDEF PHP7}Value.u1.v._type{$ELSE}Value._type{$ENDIF} of
-   IS_NULL    : Result := NULL;
-   IS_LONG    : Result := Value.value.lval;
-   IS_DOUBLE  : Result := Value.value.dval;
-   IS_STRING  : Result := zend_ustr(Value.Value.str.val);
-   IS_BOOL    : Result := Boolean(Value.Value.lval);
-    else
-      Result := NULL;
-  end;
-end;
-
 function GetStringOf(const V: TVarData): string;
   begin
     case V.VType of
@@ -485,65 +467,6 @@ function GetStringOf(const V: TVarData): string;
     end;
 end;
 
-
-procedure variant2zval(value : variant;var z : pzval);
-var
- W : WideString;
- S: String;
-begin
-  if VarIsEmpty(value) then
-   begin
-     ZVAL_NULL(z);
-     Exit;
-   end;
-    //   MessageBoxA(0, zend_pchar(zend_ustr( TVarData(Value).VType.ToString)), '', 0 ) ;
-   case TVarData(Value).VType of
-     varString    : //Peter Enz
-         begin
-           if Assigned ( TVarData(Value).VString ) then
-             begin
-               ZVAL_STRING(z, TVarData(Value).VString , true);
-             end
-               else
-                 begin
-                   ZVAL_STRING(z, '', true);
-                 end;
-         end;
-
-     varUString    : //Peter Enz
-         begin
-            S := string(TVarData(Value).VUString);
-
-             ZVAL_STRING(z, zend_pchar(zend_ustr(S)), true);
-         end;
-
-     varOleStr    : //Peter Enz
-         begin
-           if Assigned ( TVarData(Value).VOleStr ) then
-             begin
-               W := WideString(Pointer(TVarData(Value).VOleStr));
-               ZVAL_STRINGW(z, PWideChar(W),  true);
-             end
-               else
-                 begin
-                   ZVAL_STRING(z, '', true);
-                 end;
-         end;
-     varSmallInt : ZVAL_LONG(z, Integer(TVarData(Value).VSmallint));
-     varInteger  : ZVAL_LONG(z, TVarData(Value).VInteger);
-     varBoolean  : ZVAL_BOOL(z, TVarData(Value).VBoolean);
-     varSingle   : ZVAL_DOUBLE(z, TVarData(Value).VSingle);
-     varDouble   : ZVAL_DOUBLE(z, TVarData(Value).VDouble);
-     varError    : ZVAL_LONG(z, Integer(TVarData(Value).VError));
-     varByte     : ZVAL_LONG(z, Integer(TVarData(Value).VByte));
-     varDate     : ZVAL_DOUBLE(z, TVarData(Value).VDate);
-     //varArray    : ZVAL_ARRAY(z,  Value);
-     else
-       ZVAL_NULL(Z);
-   end;
-end;
-
-
 function GetPHPGlobals(TSRMLS_DC : pointer) : Pphp_Core_Globals;
 var
  core_globals_value : integer;
diff --git a/Source/PHPFunctions.pas b/Source/PHPFunctions.pas
index a913537..48b47de 100644
--- a/Source/PHPFunctions.pas
+++ b/Source/PHPFunctions.pas
@@ -657,7 +657,7 @@ function TZendVariable.GetAsVariant: variant;
     Exit;
    end;
 
-  result := zval2variant(FValue^);
+  result := ZendToVariant(FValue);
 end;
 
 function TZendVariable.GetDataType: integer;
@@ -709,7 +709,7 @@ procedure TZendVariable.SetAsBoolean(const Value: boolean);
    begin
     Exit;
    end;
-  ZVAL_BOOL(FValue, Value);
+  ZVALVAL(FValue, Value);
 end;
 
 procedure TZendVariable.SetAsDate(const Value: TDateTime);
@@ -718,7 +718,7 @@ procedure TZendVariable.SetAsDate(const Value: TDateTime);
    begin
     Exit;
    end;
-  ZVAL_DOUBLE(FValue, Value);
+  ZVALVAL(FValue, Value);
 end;
 
 procedure TZendVariable.SetAsDateTime(const Value: TDateTime);
@@ -727,7 +727,7 @@ procedure TZendVariable.SetAsDateTime(const Value: TDateTime);
    begin
     Exit;
    end;
-  ZVAL_DOUBLE(FValue, Value);
+  ZVALVAL(FValue, Value);
 end;
 
 procedure TZendVariable.SetAsFloat(const Value: double);
@@ -736,7 +736,7 @@ procedure TZendVariable.SetAsFloat(const Value: double);
    begin
     Exit;
    end;
-  ZVAL_DOUBLE(FValue, Value);
+  ZVALVAL(FValue, Value);
 end;
 
 procedure TZendVariable.SetAsInteger(const Value: integer);
@@ -745,7 +745,7 @@ procedure TZendVariable.SetAsInteger(const Value: integer);
    begin
     Exit;
    end;
-  ZVAL_LONG(FValue, Value);
+  ZVALVAL(FValue, Value);
 end;
 
 procedure TZendVariable.SetAsString(const Value: zend_ustr);
@@ -754,7 +754,7 @@ procedure TZendVariable.SetAsString(const Value: zend_ustr);
    begin
     Exit;
    end;
-  ZVAL_STRINGL(FValue, zend_pchar(Value), Length(Value), true);
+  ZVALVAL(FValue, zend_pchar(Value), Length(Value));
 end;
 
 procedure TZendVariable.SetAsTime(const Value: TDateTime);
@@ -763,7 +763,7 @@ procedure TZendVariable.SetAsTime(const Value: TDateTime);
    begin
     Exit;
    end;
-  ZVAL_DOUBLE(FValue, Value);
+  ZVALVAL(FValue, Value);
 end;
 
 procedure TZendVariable.SetAsVariant(const Value: variant);
@@ -772,7 +772,7 @@ procedure TZendVariable.SetAsVariant(const Value: variant);
    begin
     Exit;
    end;
-  variant2zval(Value, FValue);
+  VariantToZend(Value, FValue);
 end;
 
 
@@ -782,7 +782,7 @@ procedure TZendVariable.UnAssign;
    begin
     Exit;
    end;
-  ZVAL_NULL(FValue);
+  ZVALVAL(FValue);
 end;
 
 
diff --git a/Source/ZENDAPI.pas b/Source/ZENDAPI.pas
index 9e2aeca..634f004 100644
--- a/Source/ZENDAPI.pas
+++ b/Source/ZENDAPI.pas
@@ -747,6 +747,8 @@ procedure ZEND_PUTS(str: zend_pchar);
   procedure ZvalVAL(z:pzval; v:Integer; const _type:Integer = IS_LONG) overload;
   procedure ZvalVAL(z:pzval) overload;
   procedure ZvalVAL(z:pzval; v:Double) overload;
+  procedure ZvalVAL(z:pzval; v:SmallInt) overload;
+  procedure ZvalVAL(z:pzval; v:Extended) overload;
   procedure ZvalVAL(z: pzval; s: zend_ustr; len: Integer = 0); overload;
   procedure ZvalString(z:pzval) overload;
   procedure ZvalString(z:pzval; s:zend_pchar; len:Integer = 0) overload;
@@ -776,13 +778,7 @@ function ZValArrayKeyFind(v: pzval; idx: Integer; out pData: ppzval)
  function GetArgPZval(Args: TVarRec; const _type: Integer = IS_LONG;
   Make: Boolean = false): pzval;
 procedure ZVAL_RESOURCE(value: pzval; l: longint);
-procedure ZVAL_BOOL(z: pzval; b: boolean);
-procedure ZVAL_NULL(z: pzval);
-procedure ZVAL_LONG(z: pzval; l: longint);
-procedure ZVAL_DOUBLE(z: pzval; d: double);
 procedure ZVAL_EMPTY_STRING(z: pzval);
-procedure ZVAL_TRUE(z: pzval);
-procedure ZVAL_FALSE(z: pzval);
 function add_next_index_variant(arg: pzval; value: variant): integer;
 procedure ZVAL_ARRAY(z: pzval; arr:  TWSDate); overload;
 procedure ZVAL_ARRAY(z: pzval; arr:  TASDate); overload;
@@ -803,10 +799,13 @@ procedure ArrayToHash(Keys,AR: Array of Variant; var HT: pzval); overload;
 function ToStrA(V: Variant): zend_ustr;
 function ToStr(V: Variant): String;
 function toWChar(s: zend_pchar): PWideChar;
+function ZendToVariant(const Value: pzval): Variant;
 {$IFNDEF PHP7}
-function ZendToVariant(const Value: pppzval): Variant; overload;
+overload;
 function ZendToVariant(const Value: ppzval): Variant; overload;
+function ZendToVariant(const Value: pppzval): Variant; overload;
 {$ENDIF}
+procedure VariantToZend(const Value: Variant; z: pzval);
 procedure ZVAL_STRING(z: pzval; s: zend_pchar; duplicate: boolean);
 procedure ZVAL_STRINGU(z: pzval; s: PUtf8Char; duplicate: boolean);
 procedure ZVAL_STRINGW(z: pzval; s: PWideChar; duplicate: boolean);
@@ -1022,16 +1021,6 @@ procedure ZVAL_RESOURCE(value: pzval; l: longint);
   value^.value.lval := l;
 end;
 
-procedure ZVAL_BOOL(z: pzval; b: boolean);
-begin
-  {$IFDEF PHP7}
-  z^.u1.v._type
-  {$ELSE}
-  z^._type
-  {$ENDIF} := IS_BOOL;
-  z^.value.lval := integer(b);
-end;
-
 procedure ZVAL_NULL(z: pzval);
 begin
   {$IFDEF PHP7}
@@ -1041,25 +1030,6 @@ procedure ZVAL_NULL(z: pzval);
   {$ENDIF}  := IS_NULL;
 end;
 
-procedure ZVAL_LONG(z: pzval; l: longint);
-begin
-  {$IFDEF PHP7}
-  z^.u1.v._type
-  {$ELSE}
-  z^._type
-  {$ENDIF}  := IS_LONG;
-  z^.value.lval := l;
-end;
-
-procedure ZVAL_DOUBLE(z: pzval; d: double);
-begin
-  {$IFDEF PHP7}
-  z^.u1.v._type
-  {$ELSE}
-  z^._type
-  {$ENDIF}  := IS_DOUBLE;
-  z^.value.dval := d;
-end;
 procedure ZvalString(z:pzval);
 begin
   z^.value.str.len := 0;
@@ -1180,6 +1150,27 @@ procedure ZvalVAL(z:pzval; v:Double);
   {$ENDIF} := IS_LONG;
   z.value.dval := v;
 End;
+
+procedure ZvalVAL(z:pzval; v:SmallInt);
+begin
+  {$IFDEF PHP7}
+  z^.u1.v._type
+  {$ELSE}
+  z^._type
+  {$ENDIF}  := IS_LONG;
+  z^.value.lval := v;
+end;
+
+procedure ZvalVAL(z:pzval; v:Extended);
+Begin
+  {$IFDEF PHP7}
+  z^.u1.v._type
+  {$ELSE}
+  z^._type
+  {$ENDIF} := IS_LONG;
+  z.value.dval := v;
+End;
+
 procedure ZvalVAL(z: pzval; s: zend_ustr; len: Integer = 0);
 var
   lens: Integer;
@@ -1554,17 +1545,6 @@ procedure ZVAL_EMPTY_STRING(z: pzval);
   {$IFDEF PHP7} z^.u1.v._type {$ELSE} z^._type {$ENDIF} := IS_STRING;
 end;
 
-procedure ZVAL_TRUE(z: pzval);
-begin
-  {$IFDEF PHP7} z^.u1.v._type {$ELSE} z^._type {$ENDIF} := IS_BOOL;
-  z^.value.lval := 1;
-end;
-
-procedure ZVAL_FALSE(z: pzval);
-begin
-  {$IFDEF PHP7} z^.u1.v._type {$ELSE} z^._type {$ENDIF} := IS_BOOL;
-  z^.value.lval := 0;
-end;
 function ToStrA(V: Variant): zend_ustr;
 begin
   Result := V;
@@ -1589,33 +1569,164 @@ function toWChar(s: zend_pchar): PWideChar;
   ss := ss2;
   Result := PWideChar(ss);
 end;
+function HashToVarArray(const Value:{$IFDEF PHP7}Pzend_array{$ELSE}PHashTable{$ENDIF}): Variant;
+  Var
+  Len,I: Integer;
+  tmp : pppzval;
+begin
+ len := zend_hash_num_elements(Value);
+ Result := VarArrayCreate([0, len - 1], varVariant);
+ for i:=0 to len-1 do
+  begin
+    new(tmp);
 
-function ZendToVariant(const Value: pppzval): Variant; overload;
+    zend_hash_index_find(Value,i,tmp);
+
+    VarArrayPut(Result, ZendToVariant(tmp), [i]);
+    freemem(tmp);
+  end;
+end;
+procedure VarArrayToHash(var HT: pzval;Value: Variant);
+  Var
+  I,Len: Integer;
+  z: pzval;
+begin
+  _array_init(ht,nil,1);
+  len := TVarData(Value).VArray^.Bounds[0].ElementCount;
+    for i:= 0 to len - 1 do
+    begin
+      z := MAKE_STD_ZVAL;
+      VariantToZend(VarArrayGet(Value, [i]),z);
+      add_index_zval(HT, i, z);
+    end;
+end;
+
+function ZendToVariant(const Value: pzval): Variant; overload;
   Var
   S: String;
 begin
- case {$IFDEF PHP7} Value^^^.u1.v._type {$ELSE}Value^^^._type{$ENDIF} of
+ case {$IFDEF PHP7} Value^.u1.v._type {$ELSE}Value^._type{$ENDIF} of
  0: Result := Null;
- 1: Result := Value^^^.value.lval;
- 2: Result := Value^^^.value.dval;
- 3: Result := boolean(Value^^^.value.lval);
- 8: begin S := Value^^^.value.str.val; Result := S; end;
- 6: begin S := Value^^^.value.str.val; Result := S; end
+ 1: Result := Value^.value.lval;
+ 2: Result := Value^.value.dval;
+ 3: Result := boolean(Value^.value.lval);
+ 4: Result := HashToVarArray(Value^.value.ht);
+ //5: Result := object //HERE;
+ 7: Result := Value^.value.lval;
+ 6: begin S := Value^.value.str.val; Result := S; end;
+ 8: begin S := Value^.value.str.val; Result := S; end;
+ 9: Result := HashToVarArray(Value^.value.ht)
  else Result := Null;
  end;
 end;
 
+procedure VariantToZend(const Value:Variant;z:pzval);
+var
+ W : WideString;
+ S: String;
+begin
+  if VarIsEmpty(value) then
+   begin
+     ZVALVAL(z);
+     Exit;
+   end;
+  case TVarData(Value).VType of
+  varString    : //Peter Enz
+         begin
+           if Assigned ( TVarData(Value).VString ) then
+             begin
+               ZVAL_STRING(z, TVarData(Value).VString , true);
+             end
+               else
+                 begin
+                   ZVAL_STRING(z, '', true);
+                 end;
+         end;
+
+  varUString    : //Peter Enz
+         begin
+            S := string(TVarData(Value).VUString);
+
+             ZVAL_STRING(z, zend_pchar(zend_ustr(S)), true);
+         end;
+
+     varOleStr    : //Peter Enz
+         begin
+           if Assigned ( TVarData(Value).VOleStr ) then
+             begin
+               W := WideString(Pointer(TVarData(Value).VOleStr));
+               ZVAL_STRINGW(z, PWideChar(W),  true);
+             end
+               else
+                 begin
+                   ZVAL_STRING(z, '', true);
+                 end;
+         end;
+
+     varWord     : ZVALVAL(z, TVarData(Value).VWord);
+  //HERE;
+  //    varVariant  :
+  //    varUnknown  :
+  //<=== ������� ������ ����� VarIs{TYPE}()
+
+    //varDispatch : integer(TVarData(Value).VDispatch
+     //<==��������� �� ���������� �������... �� ����� �� �����
+     //������� �� ����� � ����� Dispatch (�����, ������)... ����� �
+     //�� ����� � ������ ����.��
+    //varAny : integer(TVarData(Value).VAny
+     //<==��������� �� �����*(�����)
+     //
+
+     //varRecord : integer(TVarData(Value).VRecord)
+     //<==������... � �� ��� ��� �� ���������� ��� � ���� ����� RTTI ��������
+     //varObject : integer(TVarData(Value).VObject)
+     //<==������...
+     varStrArg    : //Peter Enz
+         begin
+           if Assigned ( TVarData(Value).VString ) then
+             begin
+               ZVAL_STRING(z, TVarData(Value).VString , true);
+             end
+               else
+                 begin
+                   ZVAL_STRING(z, '', true);
+                 end;
+         end;
+
+     varUStrArg    : //Peter Enz
+         begin
+            S := string(TVarData(Value).VUString);
+
+             ZVAL_STRING(z, zend_pchar(zend_ustr(S)), true);
+         end;
+     varInt64    : ZVALVAL(z, TVarData(Value).VInt64);
+     varUInt64   : ZVALVAL(z, TVarData(Value).VUInt64);
+     varShortInt : ZVALVAL(z, Integer(TVarData(Value).VShortInt));
+     varSmallInt : ZVALVAL(z, Integer(TVarData(Value).VSmallint));
+     varInteger  : ZVALVAL(z, TVarData(Value).VInteger);
+     varBoolean  : ZVALVAL(z, TVarData(Value).VBoolean);
+     varSingle   : ZVALVAL(z, TVarData(Value).VSingle);
+     varDouble   : ZVALVAL(z, TVarData(Value).VDouble);
+     varCurrency : ZVALVAL(z, TVarData(Value).VCurrency);
+     //!>
+     varError    : ZVALVAL(z, Integer(TVarData(Value).VError));
+
+     varByte     : ZVALVAL(z, Integer(TVarData(Value).VByte));
+     varDate     : ZVALVAL(z, TVarData(Value).VDate);
+     varArray    : VarArrayToHash(z, Value);
+     else
+       ZVALVAL(Z);
+  end;
+end;
+
 function ZendToVariant(const Value: ppzval): Variant; overload;
-  Var
-  S: String;
 begin
-Result := Null;
- case {$IFDEF PHP7} Value^^.u1.v._type {$ELSE}Value^^._type{$ENDIF} of
- 1: Result := Value^^.value.lval;
- 2: Result := Value^^.value.dval;
- 6: begin S := Value^^.value.str.val; Result := S; end;
- 4,5: Result := Null;
- end;
+Result := ZendToVariant(Value^);
+end;
+
+function ZendToVariant(const Value: pppzval): Variant; overload;
+begin
+Result := ZendToVariant(Value^^);
 end;
 
 procedure HashToArray(HT: {$IFDEF PHP7}Pzend_array{$ELSE}PHashTable{$ENDIF}; var AR: TArrayVariant); overload;
@@ -1725,14 +1836,14 @@ function add_next_index_variant(arg: pzval; value: variant): integer;
                    ZVAL_STRING(iz, '', true);
                  end;
          end;
-     varSmallInt : ZVAL_LONG(iz, TVarData(Value).VSmallint);
-     varInteger  : ZVAL_LONG(iz, TVarData(Value).VInteger);
-     varBoolean  : ZVAL_BOOL(iz, TVarData(Value).VBoolean);
-     varSingle   : ZVAL_DOUBLE(iz, TVarData(Value).VSingle);
-     varDouble   : ZVAL_DOUBLE(iz, TVarData(Value).VDouble);
-     varError    : ZVAL_LONG(iz, TVarData(Value).VError);
-     varByte     : ZVAL_LONG(iz, TVarData(Value).VByte);
-     varDate     : ZVAL_DOUBLE(iz, TVarData(Value).VDate);
+     varSmallInt : ZVALVAL(iz, TVarData(Value).VSmallint);
+     varInteger  : ZVALVAL(iz, TVarData(Value).VInteger);
+     varBoolean  : ZVALVAL(iz, TVarData(Value).VBoolean);
+     varSingle   : ZVALVAL(iz, TVarData(Value).VSingle);
+     varDouble   : ZVALVAL(iz, TVarData(Value).VDouble);
+     varError    : ZVALVAL(iz, TVarData(Value).VError);
+     varByte     : ZVALVAL(iz, TVarData(Value).VByte);
+     varDate     : ZVALVAL(iz, TVarData(Value).VDate);
      else
        ZVAL_NULL(iz);
    end;
@@ -1747,7 +1858,7 @@ procedure ZVAL_ARRAY(z: pzval; arr:  TWSDate); overload;
 begin
  if _array_init(z, nil, 0) = FAILURE then //������ ������ ������� ������
   begin
-    ZVAL_FALSE(z);
+    ZVALVAL(z,False);
     Exit;
   end;
 
@@ -1774,7 +1885,7 @@ procedure ZVAL_ARRAY(z: pzval; arr:  TASDate); overload;
 begin
  if _array_init(z, nil, 0) = FAILURE then //������ ������ ������� ������
   begin
-    ZVAL_FALSE(z);
+    ZVALVAL(z,False);
     Exit;
   end;
 
@@ -1801,7 +1912,7 @@ procedure ZVAL_ARRAY(z: pzval; arr: array of string); overload;
 begin
  if _array_init(z, nil, 0) = FAILURE then //������ ������ ������� ������
   begin
-    ZVAL_FALSE(z);
+    ZVALVAL(z,False);
     Exit;
   end;
 
@@ -1828,7 +1939,7 @@ procedure ZVAL_ARRAY(z: pzval; arr:  array of zend_ustr); overload;
 begin
  if _array_init(z, nil, 0) = FAILURE then //������ ������ ������� ������
   begin
-    ZVAL_FALSE(z);
+    ZVALVAL(z,False);
     Exit;
   end;
 
@@ -1855,7 +1966,7 @@ procedure ZVAL_ARRAY(z: pzval; arr:  array of variant); overload;
 begin
  if _array_init(z, nil, 0) = FAILURE then //������ ������ ������� ������
   begin
-    ZVAL_FALSE(z);
+    ZVALVAL(z,False);
     Exit;
   end;
 
@@ -1881,7 +1992,7 @@ procedure ZVAL_ARRAY(z: pzval; arr: System.TArray<System.integer>); overload;
 begin
  if _array_init(z, nil, 0) = FAILURE then //������ ������ ������� ������
   begin
-    ZVAL_FALSE(z);
+    ZVALVAL(z,False);
     Exit;
   end;
 
@@ -1909,13 +2020,13 @@ procedure ZVAL_ARRAY(z: pzval; arr: Variant); overload;
 begin
  if _array_init(z, nil, 0) = FAILURE then //������ ������ ������� ������
   begin
-    ZVAL_FALSE(z);
+    ZVALVAL(z,False);
     Exit;
   end;
 
   if arr.PVarArray.DimCount = 0 then
   begin
-    ZVAL_FALSE(z);
+    ZVALVAL(z,False);
     Exit;
   end;
 
@@ -1977,7 +2088,7 @@ procedure ZVAL_ARRAYAC(z: pzval; keynames: Array of ansichar; keyvals: Array of
 begin
  if _array_init(z, nil, 0) = FAILURE then
   begin
-    ZVAL_FALSE(z);
+    ZVALVAL(z,False);
     Exit;
   end;
 
@@ -1998,7 +2109,7 @@ procedure ZVAL_ARRAYAC(z: pzval; keynames: Array of ansichar; keyvals: Array of
    end
    else
    begin
-      ZVAL_FALSE(z);
+      ZVALVAL(z,False);
    end;
 end;
 procedure ZVAL_ARRAYWC(z: pzval; keynames: Array of PWideChar; keyvals: Array of PWideChar);
@@ -2007,7 +2118,7 @@ procedure ZVAL_ARRAYWC(z: pzval; keynames: Array of PWideChar; keyvals: Array of
 begin
  if _array_init(z, nil, 0) = FAILURE then
   begin
-    ZVAL_FALSE(z);
+    ZVALVAL(z,False);
     Exit;
   end;
 
@@ -2031,7 +2142,7 @@ procedure ZVAL_ARRAYWC(z: pzval; keynames: Array of PWideChar; keyvals: Array of
    end
    else
    begin
-      ZVAL_FALSE(z);
+      ZVALVAL(z,False);
     Exit;
    end;
 
@@ -2042,7 +2153,7 @@ procedure ZVAL_ARRAYWS(z: pzval; keynames:  TWSDate; keyvals:  TWSDate); overloa
 begin
  if _array_init(z, nil, 0) = FAILURE then //������ ������ ������� ������
   begin
-    ZVAL_FALSE(z);
+    ZVALVAL(z,False);
     Exit;
   end;
    //z^.refcount := Length(keynames); //������� ���������� ������������ ��������
@@ -2071,7 +2182,7 @@ procedure ZVAL_ARRAYWS(z: pzval; keynames:  TWSDate; keyvals:  TWSDate); overloa
    end
    else
    begin
-      ZVAL_FALSE(z);
+      ZVALVAL(z,False);
     Exit;
    end;
 
@@ -2082,7 +2193,7 @@ procedure ZVAL_ARRAYWS(z: pzval; keynames:  array of string; keyvals:  array of
 begin
  if _array_init(z, nil, 0) = FAILURE then
   begin
-    ZVAL_FALSE(z);
+    ZVALVAL(z,False);
     Exit;
   end;
 
@@ -2107,7 +2218,7 @@ procedure ZVAL_ARRAYWS(z: pzval; keynames:  array of string; keyvals:  array of
    end
    else
    begin
-      ZVAL_FALSE(z);
+      ZVALVAL(z,False);
     Exit;
    end;
 
@@ -2118,7 +2229,7 @@ procedure ZVAL_ARRAYAS(z: pzval; keynames: TASDate; keyvals: TASDate); overload;
 begin
  if _array_init(z, nil, 0) = FAILURE then
   begin
-    ZVAL_FALSE(z);
+    ZVALVAL(z,False);
     Exit;
   end;
 
@@ -2142,7 +2253,7 @@ procedure ZVAL_ARRAYAS(z: pzval; keynames: TASDate; keyvals: TASDate); overload;
    end
    else
    begin
-      ZVAL_FALSE(z);
+      ZVALVAL(z,False);
     Exit;
    end;
 
@@ -2153,7 +2264,7 @@ procedure ZVAL_ARRAYAS(z: pzval; keynames: Array of AnsiString; keyvals: Array o
 begin
  if _array_init(z, nil, 0) = FAILURE then
   begin
-    ZVAL_FALSE(z);
+    ZVALVAL(z,False);
     Exit;
   end;
 
@@ -2177,7 +2288,7 @@ procedure ZVAL_ARRAYAS(z: pzval; keynames: Array of AnsiString; keyvals: Array o
    end
    else
    begin
-      ZVAL_FALSE(z);
+      ZVALVAL(z,False);
     Exit;
    end;
 
diff --git a/Source/php4delphi.pas b/Source/php4delphi.pas
index 8979854..4fe98e7 100644
--- a/Source/php4delphi.pas
+++ b/Source/php4delphi.pas
@@ -957,7 +957,7 @@ procedure DispatchRequest(ht : integer; return_value : pzval; this_ptr : pzval;
   {$IFNDEF PHP510}
   return_value_ptr := nil;
   {$ENDIF}
-  ZVAL_NULL(return_value);
+  ZVALVAL(return_value);
   gl := GetSAPIGlobals;
   if gl = nil then
    Exit;
@@ -969,7 +969,7 @@ procedure DispatchRequest(ht : integer; return_value : pzval; this_ptr : pzval;
        if lib <> nil then
        Lib.HandleRequest(ht, return_value, return_value_ptr, this_ptr, return_value_used, TSRMLS_DC);
      except
-      ZVAL_NULL(return_value);
+      ZVALVAL(return_value);
      end;
    end;
 end;
@@ -1570,7 +1570,7 @@ procedure TPHPEngine.HandleRequest(ht: integer; return_value: pzval;
            FZendVar.AsZendVariable := return_value;
            AFunction.OnExecute(Self, FParameters, ReturnValue, FZendVar, TSRMLS_DC);
            if FZendVar.ISNull then   {perform variant conversion}
-             variant2zval(ReturnValue, return_value);
+             VariantToZend(ReturnValue, return_value);
           finally
             FZendVar.Free;
           end;

From e74fff97458ef94beed579cf8fed0acce63ed2d1 Mon Sep 17 00:00:00 2001
From: Andrew Zenin <kashaket@yandex.ua>
Date: Mon, 5 Aug 2019 00:23:52 +0300
Subject: [PATCH 13/35] Update ZENDAPI.pas

---
 Source/ZENDAPI.pas | 57 ++++++++++++++++++++++++++++++++++++++--------
 1 file changed, 47 insertions(+), 10 deletions(-)

diff --git a/Source/ZENDAPI.pas b/Source/ZENDAPI.pas
index 634f004..397f38e 100644
--- a/Source/ZENDAPI.pas
+++ b/Source/ZENDAPI.pas
@@ -725,6 +725,9 @@ procedure dispose_pzval_array(Params: pzval_array);
 
 procedure ZEND_PUTS(str: zend_pchar);
 
+type
+  TObjectAConvertMethod = procedure(v:variant;z:pzval);
+  TObjectBConvertMethod = function(a: pzval):Variant;
 
 var
   zend_register_internal_class     : function(class_entry: pzend_class_entry; TSRMLS_DC: pointer): Pzend_class_entry; cdecl;
@@ -799,13 +802,14 @@ procedure ArrayToHash(Keys,AR: Array of Variant; var HT: pzval); overload;
 function ToStrA(V: Variant): zend_ustr;
 function ToStr(V: Variant): String;
 function toWChar(s: zend_pchar): PWideChar;
-function ZendToVariant(const Value: pzval): Variant;
+function ZendToVariant(const Value: pzval;cobj: TObjectBConvertMethod=nil): Variant;
 {$IFNDEF PHP7}
 overload;
-function ZendToVariant(const Value: ppzval): Variant; overload;
-function ZendToVariant(const Value: pppzval): Variant; overload;
+function ZendToVariant(const Value: ppzval;cobj: TObjectBConvertMethod=nil): Variant; overload;
+function ZendToVariant(const Value: pppzval;cobj: TObjectBConvertMethod=nil): Variant; overload;
 {$ENDIF}
-procedure VariantToZend(const Value: Variant; z: pzval);
+procedure VariantToZend(const Value: Variant; z: pzval;
+cobj: TObjectAConvertMethod=nil);
 procedure ZVAL_STRING(z: pzval; s: zend_pchar; duplicate: boolean);
 procedure ZVAL_STRINGU(z: pzval; s: PUtf8Char; duplicate: boolean);
 procedure ZVAL_STRINGW(z: pzval; s: PWideChar; duplicate: boolean);
@@ -1601,7 +1605,8 @@ procedure VarArrayToHash(var HT: pzval;Value: Variant);
     end;
 end;
 
-function ZendToVariant(const Value: pzval): Variant; overload;
+function ZendToVariant(const Value: pzval;
+cobj: TObjectBConvertMethod=nil): Variant; overload;
   Var
   S: String;
 begin
@@ -1611,7 +1616,11 @@ function ZendToVariant(const Value: pzval): Variant; overload;
  2: Result := Value^.value.dval;
  3: Result := boolean(Value^.value.lval);
  4: Result := HashToVarArray(Value^.value.ht);
- //5: Result := object //HERE;
+ 5:
+  if Assigned(cobj) then
+    Result := cobj(Value)
+  else
+    Result := Null;
  7: Result := Value^.value.lval;
  6: begin S := Value^.value.str.val; Result := S; end;
  8: begin S := Value^.value.str.val; Result := S; end;
@@ -1620,7 +1629,8 @@ function ZendToVariant(const Value: pzval): Variant; overload;
  end;
 end;
 
-procedure VariantToZend(const Value:Variant;z:pzval);
+procedure VariantToZend(const Value:Variant;z:pzval;
+cobj: TObjectAConvertMethod=nil);
 var
  W : WideString;
  S: String;
@@ -1673,14 +1683,41 @@ procedure VariantToZend(const Value:Variant;z:pzval);
      //<==��������� �� ���������� �������... �� ����� �� �����
      //������� �� ����� � ����� Dispatch (�����, ������)... ����� �
      //�� ����� � ������ ����.��
+    varDispatch    :
+     begin
+       if Assigned(cobj) then
+        cobj(Value, z)
+       else
+        ZVALVAL(z);
+     end;
     //varAny : integer(TVarData(Value).VAny
      //<==��������� �� �����*(�����)
      //
-
+     varAny    :
+     begin
+       if Assigned(cobj) then
+        cobj(Value, z)
+       else
+        ZVALVAL(z);
+     end;
      //varRecord : integer(TVarData(Value).VRecord)
      //<==������... � �� ��� ��� �� ���������� ��� � ���� ����� RTTI ��������
+     varRecord    :
+     begin
+       if Assigned(cobj) then
+        cobj(Value, z)
+       else
+        ZVALVAL(z);
+     end;
      //varObject : integer(TVarData(Value).VObject)
      //<==������...
+     varObject    :
+     begin
+       if Assigned(cobj) then
+        cobj(Value, z)
+       else
+        ZVALVAL(z, integer(TObject(TVarData(Value).VPointer^)));
+     end;
      varStrArg    : //Peter Enz
          begin
            if Assigned ( TVarData(Value).VString ) then
@@ -1719,12 +1756,12 @@ procedure VariantToZend(const Value:Variant;z:pzval);
   end;
 end;
 
-function ZendToVariant(const Value: ppzval): Variant; overload;
+function ZendToVariant(const Value: ppzval;cobj: TObjectBConvertMethod=nil): Variant; overload;
 begin
 Result := ZendToVariant(Value^);
 end;
 
-function ZendToVariant(const Value: pppzval): Variant; overload;
+function ZendToVariant(const Value: pppzval;cobj: TObjectBConvertMethod=nil): Variant; overload;
 begin
 Result := ZendToVariant(Value^^);
 end;

From 0514dbb02ff15ace4268ee1e5d7f8829306f27cc Mon Sep 17 00:00:00 2001
From: Andrew Zenin <kashaket@yandex.ua>
Date: Mon, 5 Aug 2019 10:42:13 +0300
Subject: [PATCH 14/35] Update ZENDAPI.pas

---
 Source/ZENDAPI.pas | 151 ++++++++++-----------------------------------
 1 file changed, 34 insertions(+), 117 deletions(-)

diff --git a/Source/ZENDAPI.pas b/Source/ZENDAPI.pas
index 397f38e..15af527 100644
--- a/Source/ZENDAPI.pas
+++ b/Source/ZENDAPI.pas
@@ -782,7 +782,11 @@ function ZValArrayKeyFind(v: pzval; idx: Integer; out pData: ppzval)
   Make: Boolean = false): pzval;
 procedure ZVAL_RESOURCE(value: pzval; l: longint);
 procedure ZVAL_EMPTY_STRING(z: pzval);
+
 function add_next_index_variant(arg: pzval; value: variant): integer;
+function add_index_variant(arg: pzval; index:integer; value: variant): integer;
+function add_assoc_variant(arg: pzval; key: zend_pchar; key_len: uint; value: variant): integer;
+
 procedure ZVAL_ARRAY(z: pzval; arr:  TWSDate); overload;
 procedure ZVAL_ARRAY(z: pzval; arr:  TASDate); overload;
 procedure ZVAL_ARRAY(z: pzval; arr:  array of string); overload;
@@ -1593,18 +1597,14 @@ function HashToVarArray(const Value:{$IFDEF PHP7}Pzend_array{$ELSE}PHashTable{$E
 procedure VarArrayToHash(var HT: pzval;Value: Variant);
   Var
   I,Len: Integer;
-  z: pzval;
 begin
   _array_init(ht,nil,1);
   len := TVarData(Value).VArray^.Bounds[0].ElementCount;
     for i:= 0 to len - 1 do
     begin
-      z := MAKE_STD_ZVAL;
-      VariantToZend(VarArrayGet(Value, [i]),z);
-      add_index_zval(HT, i, z);
+      add_index_variant(HT, i, VarArrayGet(Value, [i]));
     end;
 end;
-
 function ZendToVariant(const Value: pzval;
 cobj: TObjectBConvertMethod=nil): Variant; overload;
   Var
@@ -1793,45 +1793,24 @@ procedure ArrayToHash(AR: Array of Variant; var HT: pzval); overload;
   len := Length(AR);
   for i:=0 to len-1 do
    begin
-     case VarType(AR[i]) of
-     varInteger, varSmallint, varLongWord, 17: add_index_long(ht,i,AR[i]);
-     varDouble,varSingle: add_index_double(ht,i,AR[i]);
-     varBoolean: add_index_bool(ht,i,AR[I]);
-     varEmpty: add_index_null(ht,i);
-     varString: add_index_string(ht,i,zend_pchar(ToStr(AR[I])),1);
-     258: add_index_string(ht,i,zend_pchar(zend_ustr(ToStr(AR[I]))),1);
-     end;
+    add_index_variant(ht,i,AR[i]);
    end;
 end;
 
 procedure ArrayToHash(Keys,AR: Array of Variant; var HT: pzval); overload;
   Var
   I,Len: Integer;
-    v: Variant;
-    key: zend_pchar;
-    s: zend_pchar;
 begin
   _array_init(ht,nil,1);
   len := Length(AR);
   for i:=0 to len-1 do
    begin
-     v := AR[I];
-     key := zend_pchar(ToStrA(keys[i]));
-     s := zend_pchar(ToStrA(v));
-     case VarType(AR[i]) of
-     varInteger, varSmallint, varLongWord, 17: add_assoc_long_ex(ht,ToPChar(Keys[i]),strlen(ToPChar(Keys[i]))+1,AR[i]);
-     varDouble,varSingle: add_assoc_double_ex(ht,ToPChar(Keys[i]),strlen(ToPChar(Keys[i]))+1,AR[i]);
-     varBoolean: add_assoc_bool_ex(ht,ToPChar(Keys[i]),strlen(ToPChar(Keys[i]))+1,AR[I]);
-     varEmpty: add_assoc_null_ex(ht,ToPChar(Keys[i]),strlen(ToPChar(Keys[i]))+1);
-     varString,258: add_assoc_string_ex(ht,key,strlen(key)+1,s,1);
-     end;
+    add_assoc_variant(ht, ToPChar(Keys[i]),strlen(ToPChar(Keys[i]))+1,AR[i]);
    end;
 end;
 
 function add_next_index_variant(arg: pzval; value: variant): integer;
 var iz: pzval;
-    W: WideString;
-    S: String;
 begin
   iz := MAKE_STD_ZVAL;
   if VarIsEmpty(value) then
@@ -1840,54 +1819,37 @@ function add_next_index_variant(arg: pzval; value: variant): integer;
      Result := add_next_index_zval(arg, iz);
      Exit;
    end;
-    //   MessageBoxA(0, zend_pchar(AnsiString( TVarData(Value).VType.ToString)), '', 0 ) ;
-   case TVarData(Value).VType of
-     varString    : //Peter Enz
-         begin
-           if Assigned ( TVarData(Value).VString ) then
-             begin
-               ZVAL_STRING(iz, TVarData(Value).VString , true);
-             end
-               else
-                 begin
-                   ZVAL_STRING(iz, '', true);
-                 end;
-         end;
-
-     varUString    : //Peter Enz
-         begin
-            S := string(TVarData(Value).VUString);
-
-             ZVAL_STRING(iz, zend_pchar(zend_ustr(S)), true);
-         end;
+   VariantToZend(Value,iz);
+   Result := add_next_index_zval(arg, iz);
+end;
 
-     varOleStr    : //Peter Enz
-         begin
-           if Assigned ( TVarData(Value).VOleStr ) then
-             begin
-               W := WideString(Pointer(TVarData(Value).VOleStr));
-               ZVAL_STRINGW(iz, PWideChar(W),  true);
-             end
-               else
-                 begin
-                   ZVAL_STRING(iz, '', true);
-                 end;
-         end;
-     varSmallInt : ZVALVAL(iz, TVarData(Value).VSmallint);
-     varInteger  : ZVALVAL(iz, TVarData(Value).VInteger);
-     varBoolean  : ZVALVAL(iz, TVarData(Value).VBoolean);
-     varSingle   : ZVALVAL(iz, TVarData(Value).VSingle);
-     varDouble   : ZVALVAL(iz, TVarData(Value).VDouble);
-     varError    : ZVALVAL(iz, TVarData(Value).VError);
-     varByte     : ZVALVAL(iz, TVarData(Value).VByte);
-     varDate     : ZVALVAL(iz, TVarData(Value).VDate);
-     else
-       ZVAL_NULL(iz);
+function add_index_variant(arg: pzval; index:integer; value: variant): integer;
+var iz: pzval;
+begin
+  iz := MAKE_STD_ZVAL;
+  if VarIsEmpty(value) then
+   begin
+     ZVAL_NULL(iz);
+     Result := add_index_zval(arg, index, iz);
+     Exit;
    end;
-
-    Result := add_next_index_zval(arg, iz);
+   VariantToZend(Value,iz);
+   Result := add_index_zval(arg, index, iz);
 end;
 
+function add_assoc_variant(arg: pzval; key: zend_pchar; key_len: uint; value: variant): integer;
+var iz: pzval;
+begin
+  iz := MAKE_STD_ZVAL;
+  if VarIsEmpty(value) then
+   begin
+     ZVAL_NULL(iz);
+     Result := add_assoc_zval_ex(arg, key, key_len, iz);
+     Exit;
+   end;
+   VariantToZend(Value,iz);
+   Result := add_assoc_zval_ex(arg, key, key_len, iz);
+end;
 
 procedure ZVAL_ARRAY(z: pzval; arr:  TWSDate); overload;
 var
@@ -2069,51 +2031,6 @@ procedure ZVAL_ARRAY(z: pzval; arr: Variant); overload;
 
    for i := 0 to arr.DimCount-1 do
     begin
-    {V := TVarData(  arr[i] );
-    case V.VType of
-      varEmpty, varNull:
-        add_next_index_null(z);
-      varSmallInt:
-        add_next_index_string(z, zend_pchar(zend_ustr(IntToStr(V.VSmallInt))), 1);
-      varInteger:
-        add_next_index_string(z, zend_pchar(zend_ustr(IntToStr(V.VInteger))), 1);
-      varSingle:
-        add_next_index_string(z, zend_pchar(zend_ustr(V.VSingle.ToString())), 1);
-      varDouble:
-        add_next_index_double(z, V.VDouble);
-      varCurrency:
-        add_next_index_string(z, zend_pchar(zend_ustr(CurrToStr(V.VCurrency))), 1);
-      varDate:
-        add_next_index_string(z, zend_pchar(zend_ustr(DateTimeToStr(V.VDate))), 1);
-      varOleStr:
-        add_next_index_string(z, zend_pchar(zend_ustr(V.VOleStr)), 1);
-      varBoolean:
-        add_next_index_bool(z, V.VBoolean.ToInteger());
-      varByte:
-        add_next_index_string(z, zend_pchar(zend_ustr(IntToStr(V.VByte))), 1);
-      varWord:
-        add_next_index_string(z, zend_pchar(zend_ustr(IntToStr(V.VWord))), 1);
-      varShortInt:
-        add_next_index_string(z, zend_pchar(zend_ustr(IntToStr(V.VShortInt))), 1);
-      varLongWord:
-        add_next_index_long(z, V.VLongWord);
-      varInt64:
-        add_next_index_string(z, zend_pchar(zend_ustr(IntToStr(V.VInt64))), 1);
-      varString:
-        add_next_index_string(z, zend_pchar(zend_ustr(V.VString)), 1);
-      {$IFDEF SUPPORTS_UNICODE_STRING}{
-      varUString:
-        add_next_index_string(z, zend_pchar(zend_ustr(V.VUString)), 1);
-      {$ENDIF SUPPORTS_UNICODE_STRING}
-      {varArray,
-      varDispatch,
-      varError,
-      varUnknown,
-      varAny,
-      varByRef:}{
-      varObject:
-      add_next_index_long(z, Integer(
-    end;                               }
        add_next_index_variant(z, arr[i]);
     end;
     Exit;

From 83db7ac22559d4b46526f01d1f82c6f1a6d0888c Mon Sep 17 00:00:00 2001
From: Andrew Zenin <kashaket@yandex.ua>
Date: Mon, 5 Aug 2019 13:54:34 +0300
Subject: [PATCH 15/35] Fixed critical bug

---
 Source/PHPFunctions.pas | 16 ++++------------
 Source/ZENDAPI.pas      |  2 +-
 Source/php4delphi.pas   | 31 +++++++++++++++++++------------
 3 files changed, 24 insertions(+), 25 deletions(-)

diff --git a/Source/PHPFunctions.pas b/Source/PHPFunctions.pas
index 48b47de..8875c7f 100644
--- a/Source/PHPFunctions.pas
+++ b/Source/PHPFunctions.pas
@@ -663,10 +663,7 @@ function TZendVariable.GetAsVariant: variant;
 function TZendVariable.GetDataType: integer;
 begin
   if not Assigned(FValue) then
-   begin
-    Result := IS_NULL;
-    Exit;
-   end;
+    Exit(IS_NULL);
 
   Result := {$IFDEF PHP7}FValue^.u1.v._type{$ELSE} FValue^._type{$ENDIF};
 end;
@@ -674,20 +671,15 @@ function TZendVariable.GetDataType: integer;
 function TZendVariable.GetIsNull: boolean;
 begin
   if not Assigned(FValue) then
-   begin
-    Result := true;
-    Exit;
-   end;
+    Exit(True);
+
   Result := {$IFDEF PHP7}FValue^.u1.v._type{$ELSE} FValue^._type{$ENDIF} = IS_NULL;
 end;
 
 function TZendVariable.GetTypeName: string;
 begin
   if not Assigned(FValue) then
-   begin
-    Result := 'null';
-    Exit;
-   end;
+    Exit('null');
 
   case {$IFDEF PHP7}FValue^.u1.v._type{$ELSE} FValue^._type{$ENDIF} of
 		IS_NULL:    result :=  'null';
diff --git a/Source/ZENDAPI.pas b/Source/ZENDAPI.pas
index 15af527..accf608 100644
--- a/Source/ZENDAPI.pas
+++ b/Source/ZENDAPI.pas
@@ -1635,7 +1635,7 @@ procedure VariantToZend(const Value:Variant;z:pzval;
  W : WideString;
  S: String;
 begin
-  if VarIsEmpty(value) then
+  if VarIsEmpty(value) or VarIsNull(Value) then
    begin
      ZVALVAL(z);
      Exit;
diff --git a/Source/php4delphi.pas b/Source/php4delphi.pas
index 4fe98e7..35a7d96 100644
--- a/Source/php4delphi.pas
+++ b/Source/php4delphi.pas
@@ -1503,7 +1503,16 @@ function TPHPEngine.GetConstantCount: integer;
 begin
   Result := FConstants.Count;
 end;
-
+{
+procedure log(i:String);
+var f:TextFile;
+begin
+  AssignFile(f, 'log.txt');
+  Append(f);
+  Write(f, #10 + #13 + i);
+  CloseFile(f);
+end;
+}
 procedure TPHPEngine.HandleRequest(ht: integer; return_value: pzval;
   return_value_ptr: ppzval; this_ptr: pzval; return_value_used: integer;
   TSRMLS_DC: pointer);
@@ -1519,7 +1528,6 @@ procedure TPHPEngine.HandleRequest(ht: integer; return_value: pzval;
   ReturnValue : variant;
 begin
  FParameters := TFunctionParams.Create(nil, TFunctionParam);
- try
 
   if ht > 0 then
    begin
@@ -1564,23 +1572,22 @@ procedure TPHPEngine.HandleRequest(ht: integer; return_value: pzval;
                    FParameters[j].ZendValue := (Params[j]^);
                  end;
              end; { if ht > 0}
-
+          //log(FActiveFunctionName);
           FZendVar := TZendVariable.Create;
-          try
            FZendVar.AsZendVariable := return_value;
            AFunction.OnExecute(Self, FParameters, ReturnValue, FZendVar, TSRMLS_DC);
-           if FZendVar.ISNull then   {perform variant conversion}
-             VariantToZend(ReturnValue, return_value);
-          finally
-            FZendVar.Free;
-          end;
+           if Assigned(FZendVar) then
+           begin
+             if FZendVar.ISNull then   {perform variant conversion}
+               VariantToZend(ReturnValue, return_value);
+              FZendVar.Free;
+           end
+           else
+              VariantToZend(ReturnValue, return_value);
       end; {if assigned AFunction.OnExecute}
     end;
-
-  finally
     FParameters.Free;
     dispose_pzval_array(Params);
-  end;
 end;
 
 procedure TPHPEngine.PrepareIniEntry;

From 8c1d55525016c8d23424695dd164906be029742c Mon Sep 17 00:00:00 2001
From: Lev Zenin <ZeLev@pm.me>
Date: Wed, 12 Feb 2020 00:44:22 +0200
Subject: [PATCH 16/35] Update

Unified ZVAL functions and some routines
Removed PHP4 from support list as it's gone a long time ago already
Fixed some AVs and uncorrect functions
Added pointer checking
Removed legacy code
---
 .gitignore                               |    7 +-
 Source/Clear.bat                         |    9 +-
 Source/DelphiFunctions.pas               |  655 +----------
 Source/Demos/psvPHP/console/phpcon.dpr   |   49 +-
 Source/Demos/psvPHP/console/phpcon.dproj |  559 ++++++++++
 Source/PHP.INC                           |   24 +-
 Source/PHPAPI.pas                        |  442 +++-----
 Source/PHPCommon.pas                     |   12 +-
 Source/PHPFunctions.pas                  |    4 +-
 Source/PHPTypes.pas                      |    7 +-
 Source/ZENDAPI.pas                       | 1272 +++++++++-------------
 Source/ZendTypes.pas                     |  110 +-
 Source/php4AppUnit.pas                   |   46 +-
 Source/php4delphi.pas                    |  215 ++--
 Source/phpClass.pas                      |  255 +----
 Source/phpModules.pas                    |   10 +-
 16 files changed, 1399 insertions(+), 2277 deletions(-)
 create mode 100644 Source/Demos/psvPHP/console/phpcon.dproj

diff --git a/.gitignore b/.gitignore
index 06ae224..294f54a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,4 +1,9 @@
 __history/
 
 __recovery/
-*.dcu
\ No newline at end of file
+*.dcu
+*.local
+*.exe
+*.identcache
+*.stat
+*.res
diff --git a/Source/Clear.bat b/Source/Clear.bat
index 235952d..a1358fa 100644
--- a/Source/Clear.bat
+++ b/Source/Clear.bat
@@ -1 +1,8 @@
-del *.dcu
+del /f php4delphi.dcu
+del /f phpFunctions.dcu
+del /f DelphiFunctions.dcu
+del /f PHPCommon.dcu
+del /f PHPAPI.dcu
+del /f ZENDAPI.dcu
+del /f PHPTypes.dcu
+del /f ZendTypes.dcu
diff --git a/Source/DelphiFunctions.pas b/Source/DelphiFunctions.pas
index 78a0a2a..3be090d 100644
--- a/Source/DelphiFunctions.pas
+++ b/Source/DelphiFunctions.pas
@@ -6,6 +6,7 @@
 { Serhiy Perevoznyk                                     }
 { serge_perevoznyk@hotmail.com                          }
 { http://users.telenet.be/ws36637                       }
+{ http://users.chello.be/ws36637                        }
 {*******************************************************}
 {$I PHP.INC}
 
@@ -16,9 +17,9 @@
 interface
 uses
   SysUtils, Classes,
-  Controls,
-  {$IFDEF PHP7} hzend_types, {$ELSE} ZendTypes, {$ENDIF} ZendAPI, PHPTypes, PHPAPI, Dialogs, typinfo,
-  Forms, stdctrls;
+  VCL.Controls,
+  {$IFDEF PHP7} hzend_types, {$ELSE} ZendTypes, {$ENDIF} ZendAPI, PHPTypes, PHPAPI, VCL.Dialogs, typinfo,
+  VCL.Forms, VCL.stdctrls;
 
 {$ifdef fpc}
    {$mode delphi}
@@ -28,134 +29,27 @@ interface
 
  author_class_entry   : Tzend_class_entry;
  delphi_object_entry  : TZend_class_entry;
-
- object_functions    : {$IFDEF PHP7}HashTable{$ELSE}array[0..2] of zend_function_entry{$ENDIF};
- author_functions    : {$IFDEF PHP7}HashTable{$ELSE}array[0..2] of zend_function_entry{$ENDIF};
-
  DelphiObject : pzend_class_entry;
  ce           : pzend_class_entry;
- {$IFDEF PHP7}
-  DelphiObjectHandlers : _zend_object_handlers;
- {$ELSE}
-   {$IFDEF PHP5}
-   DelphiObjectHandlers : zend_object_handlers;
-   {$ENDIF}
- {$ENDIF}
+ DelphiObjectHandlers : _zend_object_handlers;
 
 
 procedure RegisterInternalClasses(p : pointer);
 
-
-//proto string delphi_get_system_directory(void)
-{$IFDEF PHP510}
-procedure delphi_get_system_directory(ht : integer; return_value : pzval; return_value_ptr : ppzval; this_ptr : pzval;
-      return_value_used : integer; TSRMLS_DC : pointer); cdecl;
-{$ELSE}
-procedure delphi_get_system_directory(ht : integer; return_value : pzval; this_ptr : pzval;
-      return_value_used : integer; TSRMLS_DC : pointer); cdecl;
-{$ENDIF}
-
 //proto string delphi_str_date(void)
-{$IFDEF PHP510}
 procedure delphi_str_date(ht : integer; return_value : pzval; return_value_ptr : ppzval; this_ptr : pzval;
       return_value_used : integer; TSRMLS_DC : pointer); cdecl;
-{$ELSE}
-procedure delphi_str_date(ht : integer; return_value : pzval; this_ptr : pzval;
-      return_value_used : integer; TSRMLS_DC : pointer); cdecl;
-{$ENDIF}
 
 //proto float delphi_date(void)
-{$IFDEF PHP510}
 procedure delphi_date(ht : integer; return_value : pzval; return_value_ptr : ppzval; this_ptr : pzval;
       return_value_used : integer; TSRMLS_DC : pointer); cdecl;
-{$ELSE}
-procedure delphi_date(ht : integer; return_value : pzval; this_ptr : pzval;
-      return_value_used : integer; TSRMLS_DC : pointer); cdecl;
-{$ENDIF}
-
-//proto string delphi_extract_file_dir(string source)
-{$IFDEF PHP510}
-procedure delphi_extract_file_dir(ht : integer; return_value : pzval; return_value_ptr : ppzval; this_ptr : pzval;
-      return_value_used : integer; TSRMLS_DC : pointer); cdecl;
-{$ELSE}
-procedure delphi_extract_file_dir(ht : integer; return_value : pzval; this_ptr : pzval;
-      return_value_used : integer; TSRMLS_DC : pointer); cdecl;
-{$ENDIF}
-
-//proto string delphi_extract_file_drive(string source)
-{$IFDEF PHP510}
-procedure delphi_extract_file_drive(ht : integer; return_value : pzval; return_value_ptr : ppzval; this_ptr : pzval;
-      return_value_used : integer; TSRMLS_DC : pointer); cdecl;
-{$ELSE}
-procedure delphi_extract_file_drive(ht : integer; return_value : pzval; this_ptr : pzval;
-      return_value_used : integer; TSRMLS_DC : pointer); cdecl;
-{$ENDIF}
-
-//proto string delphi_extract_file_name(string source)
-{$IFDEF PHP510}
-procedure delphi_extract_file_name(ht : integer; return_value : pzval; return_value_ptr : ppzval; this_ptr : pzval;
-      return_value_used : integer; TSRMLS_DC : pointer); cdecl;
-{$ELSE}
-procedure delphi_extract_file_name(ht : integer; return_value : pzval; this_ptr : pzval;
-      return_value_used : integer; TSRMLS_DC : pointer); cdecl;
-{$ENDIF}
-
-//proto string delphi_extract_file_ext(string source)
-{$IFDEF PHP510}
-procedure delphi_extract_file_ext(ht : integer; return_value : pzval; return_value_ptr : ppzval; this_ptr : pzval;
-      return_value_used : integer; TSRMLS_DC : pointer); cdecl;
-{$ELSE}
-procedure delphi_extract_file_ext(ht : integer; return_value : pzval; this_ptr : pzval;
-      return_value_used : integer; TSRMLS_DC : pointer); cdecl;
-{$ENDIF}
-
-//proto void delphi_show_message(string message)
-{$IFDEF PHP510}
-procedure delphi_show_message(ht : integer; return_value : pzval; return_value_ptr : ppzval; this_ptr : pzval;
-      return_value_used : integer; TSRMLS_DC : pointer); cdecl;
-{$ELSE}
-procedure delphi_show_message(ht : integer; return_value : pzval; this_ptr : pzval;
-      return_value_used : integer; TSRMLS_DC : pointer); cdecl;
-{$ENDIF}
 
 //proto string delphi_input_box(string caption, string prompt, string default)
-{$IFDEF PHP510}
 procedure delphi_input_box(ht : integer; return_value : pzval; return_value_ptr : ppzval;
         this_ptr : pzval;  return_value_used : integer; TSRMLS_DC : pointer); cdecl;
-{$ELSE}
-procedure delphi_input_box(ht : integer; return_value : pzval; this_ptr : pzval;
-      return_value_used : integer; TSRMLS_DC : pointer); cdecl;
-{$ENDIF}
 
-{$IFDEF PHP510}
-procedure register_delphi_object(ht : integer; return_value : pzval; return_value_ptr : ppzval; this_ptr : pzval;
-      return_value_used : integer; TSRMLS_DC : pointer); cdecl;
-{$ELSE}
-procedure register_delphi_object(ht : integer; return_value : pzval; this_ptr : pzval;
-      return_value_used : integer; TSRMLS_DC : pointer); cdecl;
-{$ENDIF}
-
-{$IFDEF PHP5}
 procedure delphi_get_author(ht : integer; return_value : pzval; return_value_ptr : ppzval; this_ptr : pzval;
       return_value_used : integer; TSRMLS_DC : pointer); cdecl;
-{$ELSE}
-procedure delphi_get_author(ht : integer; return_value : pzval; this_ptr : pzval;
-      return_value_used : integer; TSRMLS_DC : pointer); cdecl;
-{$ENDIF}
-{$IFDEF PHP5}
-procedure delphi_is_uc(ht : integer; return_value : pzval; return_value_ptr : ppzval; this_ptr : pzval;
-      return_value_used : integer; TSRMLS_DC : pointer); cdecl;
-{$ELSE}
-procedure delphi_is_uc(ht : integer; return_value : pzval; this_ptr : pzval;
-      return_value_used : integer; TSRMLS_DC : pointer); cdecl;
-{$ENDIF}
-{$IFDEF PHP510}
-procedure register_delphi_component(ht : integer; return_value : pzval; return_value_ptr : ppzval; this_ptr : pzval;
-      return_value_used : integer; TSRMLS_DC : pointer); cdecl;
-{$ELSE}
-procedure register_delphi_component(ht : integer; return_value : pzval; this_ptr : pzval;
-      return_value_used : integer; TSRMLS_DC : pointer); cdecl;
-{$ENDIF}
 
 const
   SimpleProps = [tkInteger, tkChar, tkEnumeration, tkFloat,
@@ -163,114 +57,22 @@ procedure register_delphi_component(ht : integer; return_value : pzval; this_ptr
 
 implementation
 
-
-
-//proto string delphi_get_system_directory(void)
-{$IFDEF PHP510}
-procedure delphi_get_system_directory(ht : integer; return_value : pzval; return_value_ptr : ppzval; this_ptr : pzval;
-      return_value_used : integer; TSRMLS_DC : pointer); cdecl;
-{$ELSE}
-procedure delphi_get_system_directory(ht : integer; return_value : pzval; this_ptr : pzval;
-      return_value_used : integer; TSRMLS_DC : pointer); cdecl;
-{$ENDIF}
-begin
-
-end;
-
 //proto string delphi_str_date(void)
-{$IFDEF PHP510}
 procedure delphi_str_date(ht : integer; return_value : pzval; return_value_ptr : ppzval; this_ptr : pzval;
       return_value_used : integer; TSRMLS_DC : pointer); cdecl;
-{$ELSE}
-procedure delphi_str_date(ht : integer; return_value : pzval; this_ptr : pzval;
-      return_value_used : integer; TSRMLS_DC : pointer); cdecl;
-{$ENDIF}
 begin
   ZVAL_STRING(return_value, zend_pchar(DateToStr(Date)), true);
 end;
 
 //proto float delphi_date(void)
-{$IFDEF PHP510}
 procedure delphi_date(ht : integer; return_value : pzval; return_value_ptr : ppzval; this_ptr : pzval;
       return_value_used : integer; TSRMLS_DC : pointer); cdecl;
-{$ELSE}
-procedure delphi_date(ht : integer; return_value : pzval; this_ptr : pzval;
-      return_value_used : integer; TSRMLS_DC : pointer); cdecl;
-{$ENDIF}
 begin
   ZVALVAL(return_value, Date);
 end;
-
-//proto string delphi_extract_file_dir(string source)
-{$IFDEF PHP510}
-procedure delphi_extract_file_dir(ht : integer; return_value : pzval; return_value_ptr : ppzval; this_ptr : pzval;
-      return_value_used : integer; TSRMLS_DC : pointer); cdecl;
-{$ELSE}
-procedure delphi_extract_file_dir(ht : integer; return_value : pzval; this_ptr : pzval;
-      return_value_used : integer; TSRMLS_DC : pointer); cdecl;
-{$ENDIF}
-begin
-
-end;
-
-//proto string delphi_extract_file_drive(string source)
-{$IFDEF PHP510}
-procedure delphi_extract_file_drive(ht : integer; return_value : pzval; return_value_ptr : ppzval; this_ptr : pzval;
-      return_value_used : integer; TSRMLS_DC : pointer); cdecl;
-{$ELSE}
-procedure delphi_extract_file_drive(ht : integer; return_value : pzval; this_ptr : pzval;
-      return_value_used : integer; TSRMLS_DC : pointer); cdecl;
-{$ENDIF}
-begin
-
-end;
-
-//proto string delphi_extract_file_name(string source)
-{$IFDEF PHP510}
-procedure delphi_extract_file_name(ht : integer; return_value : pzval; return_value_ptr : ppzval; this_ptr : pzval;
-      return_value_used : integer; TSRMLS_DC : pointer); cdecl;
-{$ELSE}
-procedure delphi_extract_file_name(ht : integer; return_value : pzval; this_ptr : pzval;
-      return_value_used : integer; TSRMLS_DC : pointer); cdecl;
-{$ENDIF}
-begin
-
-end;
-
-//proto string delphi_extract_file_ext(string source)
-{$IFDEF PHP510}
-procedure delphi_extract_file_ext(ht : integer; return_value : pzval; return_value_ptr : ppzval; this_ptr : pzval;
-      return_value_used : integer; TSRMLS_DC : pointer); cdecl;
-{$ELSE}
-procedure delphi_extract_file_ext(ht : integer; return_value : pzval; this_ptr : pzval;
-      return_value_used : integer; TSRMLS_DC : pointer); cdecl;
-{$ENDIF}
-begin
-
-end;
-
-//proto void delphi_show_message(string message)
-{$IFDEF PHP510}
-procedure delphi_show_message(ht : integer; return_value : pzval; return_value_ptr : ppzval; this_ptr : pzval;
-      return_value_used : integer; TSRMLS_DC : pointer); cdecl;
-{$ELSE}
-procedure delphi_show_message(ht : integer; return_value : pzval; this_ptr : pzval;
-      return_value_used : integer; TSRMLS_DC : pointer); cdecl;
-{$ENDIF}
-
-begin
-
-end;
-
-
 //proto string delphi_input_box(string caption, string prompt, string default)
-{$IFDEF PHP510}
 procedure delphi_input_box(ht : integer; return_value : pzval; return_value_ptr : ppzval;
         this_ptr : pzval;  return_value_used : integer; TSRMLS_DC : pointer); cdecl;
-{$ELSE}
-procedure delphi_input_box(ht : integer; return_value : pzval; this_ptr : pzval;
-      return_value_used : integer; TSRMLS_DC : pointer); cdecl;
-{$ENDIF}
 var p: pzval_array;
 begin
 if ht <> 3 then
@@ -279,343 +81,15 @@ procedure delphi_input_box(ht : integer; return_value : pzval; this_ptr : pzval;
   exit;
 end;
    zend_get_parameters_my(ht, p, TSRMLS_DC);
+   {$IFNDEF PHP7}
    ZVAL_STRINGW(return_value, PWideChar(InputBox( Z_STRVAL(p[0]^), Z_STRVAL(p[1]^), Z_STRVAL(p[2]^)  )), true);
+   {$ENDIF}
    dispose_pzval_array(p);
 end;
 
-//proto void delphi_send_message(void)
-{$IFDEF PHP510}
-procedure delphi_send_email(ht : integer; return_value : pzval; return_value_ptr : ppzval; this_ptr : pzval;
-      return_value_used : integer; TSRMLS_DC : pointer); cdecl;
-{$ELSE}
-procedure delphi_send_email(ht : integer; return_value : pzval; this_ptr : pzval;
-      return_value_used : integer; TSRMLS_DC : pointer); cdecl;
-{$ENDIF}
-begin
-  //ShellExecute(0, 'open', 'mailto:serge_perevoznyk@hotmail.com', nil, nil, SW_SHOWNORMAL);
-end;
-
-//proto void delphi_visit_homepage(void)
-{$IFDEF PHP510}
-procedure delphi_visit_homepage(ht : integer; return_value : pzval; return_value_ptr : ppzval; this_ptr : pzval;
-      return_value_used : integer; TSRMLS_DC : pointer); cdecl;
-{$ELSE}
-procedure delphi_visit_homepage(ht : integer; return_value : pzval; this_ptr : pzval;
-      return_value_used : integer; TSRMLS_DC : pointer); cdecl;
-{$ENDIF}
-begin
-  //ShellExecute(0, 'open', 'http://users.chello.be/ws36637', nil, nil, SW_SHOW);
-end;
-
-
 //Delphi objects support
-
-{$IFDEF PHP510}
-procedure delphi_object_classname(ht : integer; return_value : pzval; return_value_ptr : ppzval; this_ptr : pzval;
-      return_value_used : integer; TSRMLS_DC : pointer); cdecl;
-{$ELSE}
-procedure delphi_object_classname(ht : integer; return_value : pzval; this_ptr : pzval;
-      return_value_used : integer; TSRMLS_DC : pointer); cdecl;
-{$ENDIF}
-begin
-
-end;
-
-{$IFDEF PHP510}
-procedure delphi_object_classnameis(ht : integer; return_value : pzval; return_value_ptr : ppzval; this_ptr : pzval;
-      return_value_used : integer; TSRMLS_DC : pointer); cdecl;
-{$ELSE}
-procedure delphi_object_classnameis(ht : integer; return_value : pzval; this_ptr : pzval;
-      return_value_used : integer; TSRMLS_DC : pointer); cdecl;
-{$ENDIF}
-begin
-end;
-
-
-
-{$IFDEF PHP4}
-function delphi_set_property_handler(property_reference : Pzend_property_reference; value : pzval) : integer; cdecl;
-var
- this_ptr : pzval;
- OBJ : TObject;
- data: ^ppzval;
- element : pzend_list_element;
- prop  : pzend_overloaded_element;
- p : pointer;
- propname : zend_ustr;
-// --> hupu, 2006.06.01
-// pt : TTypeKind;
-{$IFDEF VERSION7}
- Scripter : TPHPScriptableObject;
-{$ELSE}
- pt : TypInfo.TTypeKind;
-{$ENDIF}
-// <-- hupu, 2006.06.01
-begin
-  element :=  property_reference^.elements_list^.head;
-  p := @element^.data;
-  prop := pzend_overloaded_element(p);
-  propname := prop^.element.value.str.val;
-
-  this_ptr := property_reference^._object;
-  new(data);
-  zend_hash_find(this_ptr^.value.obj.properties, 'instance', strlen('instance') + 1, data);
-  Obj := TObject(data^^^.value.lval);
-  freemem(data);
-
-// --> hupu, 2006.06.01
-{$IFDEF VERSION7}
-  Scripter := TPHPScriptableObject(Obj);
-  if SameText('Parent', propname) then
-   begin
-     TWinControl(Scripter.InstanceObj).Parent :=
-     TWinControl(value^.value.lval);
-   end
-     else
-       Scripter.SetPropertyByID(Scripter.NameToDispID(propname),
-        [zval2variant(value^)] );
-{$ELSE}
-// <-- hupu, 2006.06.01
-
-  pt := PropType(Obj, propname);
-  if ( pt in SimpleProps) then
-   SetPropValue(OBJ, propname, zval2variant(value^))
-     else
-       if pt = tkClass then
-         begin
-           Obj := GetObjectProp(Obj, propname);
-            while element <> nil do
-             begin
-               element := element^.prev;
-               p := @element^.data;
-               prop := pzend_overloaded_element(p);
-               propname := prop^.element.value.str.val;
-               pt := PropType(Obj, propname);
-               if ( pt in SimpleProps) then
-                begin
-                  SetPropValue(OBJ, propname, zval2variant(value^));
-                  break;
-                end
-                 else
-                   if pt = tkClass then
-                    Obj := GetObjectProp(Obj, propname);
-             end;
-         end;
-
-// --> hupu, 2006.06.01
-{$ENDIF}
-// <-- hupu, 2006.06.01
-  Result := SUCCESS;
-end;
-
-
-
-procedure delphi_get_property_handler(val : pzval; property_reference : PZend_property_reference); cdecl;
-var
- this_ptr : pzval;
- OBJ : TObject;
- data: ^ppzval;
- element : pzend_list_element;
- prop  : pzend_overloaded_element;
- p : pointer;
- propname : zend_ustr;
-// --> hupu, 2006.06.01
-// pt : TTypeKind;
-{$IFDEF VERSION7}
- Scripter : TPHPScriptableObject;
-{$ELSE}
- pt : TypInfo.TTypeKind;
-{$ENDIF}
-// <-- hupu, 2006.06.01
-begin
-  element :=  property_reference^.elements_list^.head;
-  p := @element^.data;
-  prop := pzend_overloaded_element(p);
-  propname := prop^.element.value.str.val;
-  this_ptr := property_reference^._object;
-  new(data);
-  zend_hash_find(this_ptr^.value.obj.properties, 'instance', strlen('instance') + 1, data);
-  Obj := TObject(data^^^.value.lval);
-  freemem(data);
-
-// --> hupu, 2006.06.01
-{$IFDEF VERSION7}
-Scripter := TPHPScriptableObject(Obj);
-if SameText('Parent', propname) then
-begin
-TWinControl(Scripter.InstanceObj).Parent :=
-TWinControl(val^.value.lval);
-end
-else
-
-Scripter.SetPropertyByID(Scripter.NameToDispID(propname),
-[zval2variant(val^)] );
-{$ELSE}
-// <-- hupu, 2006.06.01
-  pt := PropType(Obj, propname);
-  if ( pt in SimpleProps) then
-   variant2zval(GetPropValue(OBJ, propname), val)
-     else
-       if pt = tkClass then
-         begin
-           Obj := GetObjectProp(Obj, propname);
-            while element <> nil do
-             begin
-               element := element^.prev;
-               p := @element^.data;
-               prop := pzend_overloaded_element(p);
-               propname := prop^.element.value.str.val;
-               pt := PropType(Obj, propname);
-               if ( pt in SimpleProps) then
-                begin
-                  variant2zval(GetPropValue(OBJ, propname), val);
-                  break;
-                end
-                 else
-                   if pt = tkClass then
-                    Obj := GetObjectProp(Obj, propname);
-             end;
-         end;
-// --> hupu, 2006.06.01
-{$ENDIF}
-// <-- hupu, 2006.06.01
-end;
-
-
-{$IFDEF PHP4}
-procedure _delphi_get_property_wrapper; assembler;
-asm
-  push        ebp
-  mov         ebp,esp
-  sub         esp,50h
-  push        ebx
-  push        esi
-  push        edi
-  lea         edi,[ebp-50h]
-  mov         ecx,14h
-  mov         eax,0CCCCCCCCh
-  rep         stosd
-  mov         eax,dword ptr [ebp+0Ch]
-  push        eax
-  lea         ecx,[ebp-10h]
-  push        ecx
-  call        delphi_get_property_handler
-  add         esp,8
-  mov         edx,dword ptr [ebp+8]
-  mov         eax,dword ptr [ebp-10h]
-  mov         dword ptr [edx],eax
-  mov         ecx,dword ptr [ebp-0Ch]
-  mov         dword ptr [edx+4],ecx
-  mov         eax,dword ptr [ebp-8]
-  mov         dword ptr [edx+8],eax
-  mov         ecx,dword ptr [ebp-4]
-  mov         dword ptr [edx+0Ch],ecx
-  mov         eax,dword ptr [ebp+8]
-
-  pop         edi
-  pop         esi
-  pop         ebx
-  add         esp,50h
-  cmp         ebp,esp
-  mov         esp,ebp
-  pop         ebp
-  ret
-end;
-{$ENDIF}
-
-procedure delphi_call_function(ht : integer; return_value : pzval; this_ptr : pzval;
-      return_value_used : integer; TSRMLS_DC : pointer; property_reference : Pzend_property_reference ); cdecl;
-var
- OBJ : TObject;
- data: ^ppzval;
- element : pzend_list_element;
- prop  : pzend_overloaded_element;
- p : pointer;
- MethodName : zend_ustr;
- Params : pzval_array;
- M, D : integer;
-begin
-  element :=  property_reference^.elements_list^.head;
-  p := @element^.data;
-  prop := pzend_overloaded_element(p);
-  MethodName := prop^.element.value.str.val;
-  this_ptr := property_reference^._object;
-  new(data);
-  zend_hash_find(this_ptr^.value.obj.properties, 'instance', strlen('instance') + 1, data);
-  Obj := TObject(data^^^.value.lval);
-  freemem(data);
-  if ( Obj.InheritsFrom(TCustomEdit) ) then
-   begin
-     if SameText(MethodName, 'Clear') then
-      TCustomEdit(Obj).Clear;
-     if SameText(MethodName, 'ClearSelection') then
-      TCustomEdit(Obj).ClearSelection;
-     if SameText(MethodName, 'CopyToClipboard') then
-      TCustomEdit(Obj).CopyToClipboard;
-     if SameText(MethodName, 'ControlCount') then
-      ZVAL_LONG(return_value, TCustomEdit(Obj).ControlCount);
-     if SameText(MethodName, 'ScaleBy') then
-        begin
-          if ht > 0 then
-           begin
-             if ( not (zend_get_parameters_ex(ht, Params) = SUCCESS )) then
-               begin
-                 zend_wrong_param_count(TSRMLS_DC);
-                 Exit;
-               end;
-            end;
-          M := Params[0]^.value.lval;
-          D := Params[1]^.value.lval;
-          TCustomEdit(Obj).ScaleBy(M, D);
-          dispose_pzval_array(Params);
-        end;
-   end;
-end;
-{$ENDIF}
-
-
-
-{$IFDEF PHP5}
-
-// Read object property value  (getter)
-function delphi_get_property_handler(_object : pzval; member : pzval; _type : integer; TSRMLS_DC : pointer) : pzval; cdecl;
-begin
-
-end;
-
-// Write object property value (setter)
-procedure delphi_set_property_handler(_object : pzval; member : pzval; value : pzval; TSRMLS_DC : pointer); cdecl;
-begin
-
-end;
-
-{$IFDEF PHP510}
-function delphi_call_method(method : zend_pchar; ht : integer; return_value : pzval; return_value_ptr : ppzval; this_ptr : pzval;
-      return_value_used : integer; TSRMLS_DC : pointer) : integer; cdecl;
-{$ELSE}
-function delphi_call_method(method : zend_pchar; ht : integer; return_value : pzval; this_ptr : pzval;
-      return_value_used : integer; TSRMLS_DC : pointer) : integer; cdecl;
-{$ENDIF}
-begin
-
-end;
-
-function delphi_get_method(_object : pzval; method_name : zend_pchar; method_len : integer; TSRMLS_DC : pointer) : {$IFDEF PHP7}P_zend_function{$ELSE}PzendFunction{$ENDIF}; cdecl;
-
-begin
-
-end;
-
-
-{$ENDIF}
-
-{$IFDEF PHP5}
 procedure delphi_get_author(ht : integer; return_value : pzval; return_value_ptr : ppzval; this_ptr : pzval;
       return_value_used : integer; TSRMLS_DC : pointer); cdecl;
-{$ELSE}
-procedure delphi_get_author(ht : integer; return_value : pzval; this_ptr : pzval;
-      return_value_used : integer; TSRMLS_DC : pointer); cdecl;
-{$ENDIF}
 var
  properties : array[0..3] of zend_pchar;
 begin
@@ -623,68 +97,13 @@ procedure delphi_get_author(ht : integer; return_value : pzval; this_ptr : pzval
   properties[1] := 'last';
   properties[2] := 'height';
   properties[3] := 'email';
-  {$IFDEF PHP4}
-  _object_init_ex(return_value, ce,  nil, 0, TSRMLS_DC );
-  {$ELSE}
   object_init(return_value, ce,  TSRMLS_DC );
-  {$ENDIF}
-
-  {$IFDEF PHP4}
-  add_property_string_ex(return_value, properties[0], strlen(properties[0]) + 1, 'Serhiy', 1);
-  add_property_string_ex(return_value, properties[1], strlen(properties[1]) + 1, 'Perevoznyk', 1);
-  {$ELSE}
   add_property_string_ex(return_value, properties[0], strlen(properties[0]) + 1, 'Serhiy', 1, TSRMLS_DC);
   add_property_string_ex(return_value, properties[1], strlen(properties[1]) + 1, 'Perevoznyk', 1, TSRMLS_DC);
-  {$ENDIF}
-
-  {$IFDEF PHP5}
   add_property_long_ex(return_value, properties[2], strlen(properties[2]) + 1, 185, TSRMLS_DC);
-  {$ELSE}
-  add_property_long_ex(return_value, properties[2], strlen(properties[2]) + 1, 185);
-  {$ENDIF}
-
-  {$IFDEF PHP4}
-  add_property_string_ex(return_value, properties[3], strlen(properties[3]) + 1, 'serge_perevoznyk@hotmail.com', 1);
-  {$ELSE}
   add_property_string_ex(return_value, properties[3], strlen(properties[3]) + 1, 'serge_perevoznyk@hotmail.com', 1, TSRMLS_DC);
-  {$ENDIF}
 end;
 
-{$IFDEF PHP5}
-procedure delphi_is_uc(ht : integer; return_value : pzval; return_value_ptr : ppzval; this_ptr : pzval;
-      return_value_used : integer; TSRMLS_DC : pointer); cdecl;
-{$ELSE}
-procedure delphi_is_uc(ht : integer; return_value : pzval; this_ptr : pzval;
-      return_value_used : integer; TSRMLS_DC : pointer);
-{$ENDIF}
-begin
-    ZVALVAL(return_value, {$IFDEF PHP_UNICE}TRUE{$ELSE}FALSE{$ENDIF});
-end;
-
-{$IFDEF PHP510}
-procedure register_delphi_object(ht : integer; return_value : pzval; return_value_ptr : ppzval; this_ptr : pzval;
-      return_value_used : integer; TSRMLS_DC : pointer); cdecl;
-{$ELSE}
-procedure register_delphi_object(ht : integer; return_value : pzval; this_ptr : pzval;
-      return_value_used : integer; TSRMLS_DC : pointer); cdecl;
-{$ENDIF}
-
-begin
-
-end;
-
-{$IFDEF PHP510}
-procedure register_delphi_component(ht : integer; return_value : pzval; return_value_ptr : ppzval; this_ptr : pzval;
-      return_value_used : integer; TSRMLS_DC : pointer); cdecl;
-{$ELSE}
-procedure register_delphi_component(ht : integer; return_value : pzval; this_ptr : pzval;
-      return_value_used : integer; TSRMLS_DC : pointer); cdecl;
-{$ENDIF}
-
-begin
-
-
-end;
 
 
 
@@ -694,66 +113,12 @@ procedure RegisterInternalClasses(p : pointer);
   {$IFDEF PHP7}
    !
   {$ELSE}
-  object_functions[0].fname := 'delphi_classname';
-  object_functions[0].handler := @delphi_object_classname;
-
-  object_functions[1].fname := 'delphi_classnameis';
-  object_functions[1].handler := @delphi_object_classnameis;
-
-  object_functions[2].fname := nil;
-  object_functions[2].handler := nil;
-
-  INIT_CLASS_ENTRY(delphi_object_entry, 'delphi_class' , @object_functions);
-  {$ENDIF}
-  {$IFDEF PHP4}
-  Delphi_Object_Entry.handle_property_get :=  @_delphi_get_property_wrapper;
-  Delphi_Object_Entry.handle_property_set := @delphi_set_property_handler;
-  Delphi_Object_Entry.handle_function_call :=  @delphi_call_function;
-  {$ELSE}
-  Move(zend_get_std_object_handlers()^, DelphiObjectHandlers, sizeof({$IFDEF PHP7}_zend_object_handlers{$ELSE}zend_object_handlers{$ENDIF}));
-  DelphiObjectHandlers.read_property := @delphi_get_property_handler;
-  DelphiObjecthandlers.write_property := @delphi_set_property_handler;
-  DelphiObjectHandlers.call_method := @delphi_call_method;
-  DelphiObjectHandlers.get_method := @delphi_get_method;
-  {$ENDIF}
+  Move(zend_get_std_object_handlers()^, DelphiObjectHandlers, sizeof(_zend_object_handlers));
 
   DelphiObject := zend_register_internal_class(@delphi_object_entry, p);
 
-  author_functions[0].fname := 'send_email';
-  author_functions[0].handler := @delphi_send_email;
-
-  author_functions[1].fname := 'visit_homepage';
-  author_functions[1].handler := @delphi_visit_homepage;
-
-  author_functions[2].fname := nil;
-  author_functions[2].handler := nil;
-  INIT_CLASS_ENTRY(author_class_entry, 'php4delphi_author', @author_functions);
+  INIT_CLASS_ENTRY(author_class_entry, 'php4delphi_author', nil);
   ce := zend_register_internal_class(@author_class_entry, p);
-
-end;
-
-{$IFDEF VERSION7}
-
-{
-Delphi scripting support
-The Original Code is: JvOle2Auto.PAS, released on 2002-07-04.
-The Initial Developers of the Original Code are: Fedor Koshevnikov, Igor Pavluk and Serge Korolev
-Copyright (c) 1997, 1998 Fedor Koshevnikov, Igor Pavluk and Serge Korolev
-Copyright (c) 2001,2002 SGB Software
-All Rights Reserved.
-}
-
-
-function WashVariant(const Value: Variant): OleVariant;
-begin
-  if TVarData(Value).VType = (varString or varByRef) then
-    Result := PString(TVarData(VAlue).VString)^ + ''
-  else
-    Result := Value;
+  {$ENDIF}
 end;
-
-
-
-{$ENDIF}
-
 end.
diff --git a/Source/Demos/psvPHP/console/phpcon.dpr b/Source/Demos/psvPHP/console/phpcon.dpr
index 1aa6530..5ac140b 100644
--- a/Source/Demos/psvPHP/console/phpcon.dpr
+++ b/Source/Demos/psvPHP/console/phpcon.dpr
@@ -1,4 +1,4 @@
-{$APPTYPE CONSOLE}
+﻿{$APPTYPE CONSOLE}
 
 {*******************************************************}
 {                     PHP4Delphi                        }
@@ -13,22 +13,55 @@
 
 program phpcon;
 
-uses SysUtils, php4delphi;
-
+uses
+  SysUtils,
+  VCL.Dialogs,
+  php4delphi,
+  zendAPI,
+  ZENDTypes;
 var
  php    : TpsvPHP;
  Engine : TPHPEngine;
+
+procedure gui_message(ht: integer; return_value: pzval;
+  return_value_ptr: pzval; this_ptr: pzval; return_value_used: integer;
+  TSRMLS_DC: pointer); cdecl;
+var
+  Text: pzval;
+begin
+  if zend_parse_method_parameters(1, TSRMLS_DC, this_ptr, 'z', @Text) = 0 then
+  begin
+    ShowMessage(Z_STRVAL(Text));
+  end;
+end;
+    procedure grc(ht: integer; return_value: pzval;
+  return_value_ptr: pzval; this_ptr: pzval; return_value_used: integer;
+  TSRMLS_DC: pointer); cdecl;
+var
+  p: pzval;
 begin
- if ParamCount <> 1 then
+  if zend_parse_method_parameters(1, TSRMLS_DC, this_ptr, 'z', @p) = 0 then
   begin
-    writeln(Format('Usage: %s <filename.php>', [ParamStr(0)]));
-    Halt(1);
+      p^.value.lval := 0;
   end;
+end;
+begin
  Engine := TPHPEngine.Create(nil);
+ Engine.AddFunction('gui_message', @gui_message);
+  Engine.AddFunction('g_r_c', @grc);
+ Engine.HandleErrors := True;
  Engine.StartupEngine;
  php := TpsvPHP.Create(nil);
- php.FileName := ParamStr(1);
- write(php.Execute);
+ if ParamCount = 1 then
+ begin
+  php.FileName := ParamStr(1);
+  write(php.Execute);
+ end
+ else
+ begin
+  writeLn(Format('Usage: %s <filename.php>', [ParamStr(0)]));
+  writeLn(php.RunCode('<?php gui_message("i, Leo, will be alive, this reality does not matters");?>'));
+ end;
  php.Free;
  Engine.ShutdownEngine;
  Engine.Free;
diff --git a/Source/Demos/psvPHP/console/phpcon.dproj b/Source/Demos/psvPHP/console/phpcon.dproj
new file mode 100644
index 0000000..fdd2dd5
--- /dev/null
+++ b/Source/Demos/psvPHP/console/phpcon.dproj
@@ -0,0 +1,559 @@
+﻿<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+    <PropertyGroup>
+        <ProjectGuid>{BDB76098-EDD6-4A5A-AF30-D7A6B0BCF914}</ProjectGuid>
+        <MainSource>phpcon.dpr</MainSource>
+        <Base>True</Base>
+        <Config Condition="'$(Config)'==''">Debug</Config>
+        <TargetedPlatforms>3</TargetedPlatforms>
+        <AppType>Console</AppType>
+        <FrameworkType>None</FrameworkType>
+        <ProjectVersion>18.2</ProjectVersion>
+        <Platform Condition="'$(Platform)'==''">Win64</Platform>
+    </PropertyGroup>
+    <PropertyGroup Condition="'$(Config)'=='Base' or '$(Base)'!=''">
+        <Base>true</Base>
+    </PropertyGroup>
+    <PropertyGroup Condition="('$(Platform)'=='Android' and '$(Base)'=='true') or '$(Base_Android)'!=''">
+        <Base_Android>true</Base_Android>
+        <CfgParent>Base</CfgParent>
+        <Base>true</Base>
+    </PropertyGroup>
+    <PropertyGroup Condition="('$(Platform)'=='Win32' and '$(Base)'=='true') or '$(Base_Win32)'!=''">
+        <Base_Win32>true</Base_Win32>
+        <CfgParent>Base</CfgParent>
+        <Base>true</Base>
+    </PropertyGroup>
+    <PropertyGroup Condition="('$(Platform)'=='Win64' and '$(Base)'=='true') or '$(Base_Win64)'!=''">
+        <Base_Win64>true</Base_Win64>
+        <CfgParent>Base</CfgParent>
+        <Base>true</Base>
+    </PropertyGroup>
+    <PropertyGroup Condition="'$(Config)'=='Release' or '$(Cfg_1)'!=''">
+        <Cfg_1>true</Cfg_1>
+        <CfgParent>Base</CfgParent>
+        <Base>true</Base>
+    </PropertyGroup>
+    <PropertyGroup Condition="('$(Platform)'=='Win32' and '$(Cfg_1)'=='true') or '$(Cfg_1_Win32)'!=''">
+        <Cfg_1_Win32>true</Cfg_1_Win32>
+        <CfgParent>Cfg_1</CfgParent>
+        <Cfg_1>true</Cfg_1>
+        <Base>true</Base>
+    </PropertyGroup>
+    <PropertyGroup Condition="'$(Config)'=='Debug' or '$(Cfg_2)'!=''">
+        <Cfg_2>true</Cfg_2>
+        <CfgParent>Base</CfgParent>
+        <Base>true</Base>
+    </PropertyGroup>
+    <PropertyGroup Condition="('$(Platform)'=='Win64' and '$(Cfg_2)'=='true') or '$(Cfg_2_Win64)'!=''">
+        <Cfg_2_Win64>true</Cfg_2_Win64>
+        <CfgParent>Cfg_2</CfgParent>
+        <Cfg_2>true</Cfg_2>
+        <Base>true</Base>
+    </PropertyGroup>
+    <PropertyGroup Condition="'$(Base)'!=''">
+        <DCC_UnitSearchPath>..\..\..\;$(DCC_UnitSearchPath)</DCC_UnitSearchPath>
+        <DCC_ExeOutput>C:\elsewere</DCC_ExeOutput>
+        <DCC_F>false</DCC_F>
+        <VerInfo_Locale>1058</VerInfo_Locale>
+        <DCC_E>false</DCC_E>
+        <DCC_ImageBase>00400000</DCC_ImageBase>
+        <DCC_Namespace>System;Xml;Data;Datasnap;Web;Soap;$(DCC_Namespace)</DCC_Namespace>
+        <Icon_MainIcon>$(BDS)\bin\delphi_PROJECTICON.ico</Icon_MainIcon>
+        <SanitizedProjectName>phpcon</SanitizedProjectName>
+        <VerInfo_Keys>CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments=;CFBundleName=</VerInfo_Keys>
+        <DCC_S>false</DCC_S>
+        <DCC_N>false</DCC_N>
+        <DCC_K>false</DCC_K>
+        <Icns_MainIcns>$(BDS)\bin\delphi_PROJECTICNS.icns</Icns_MainIcns>
+    </PropertyGroup>
+    <PropertyGroup Condition="'$(Base_Android)'!=''">
+        <EnabledSysJars>android-support-v4.dex.jar;cloud-messaging.dex.jar;fmx.dex.jar;google-analytics-v2.dex.jar;google-play-billing.dex.jar;google-play-licensing.dex.jar;google-play-services.dex.jar</EnabledSysJars>
+        <AUP_READ_CALENDAR>true</AUP_READ_CALENDAR>
+        <Android_SplashImage426>$(BDS)\bin\Artwork\Android\FM_SplashImage_426x320.png</Android_SplashImage426>
+        <AUP_READ_EXTERNAL_STORAGE>true</AUP_READ_EXTERNAL_STORAGE>
+        <Android_SplashImage470>$(BDS)\bin\Artwork\Android\FM_SplashImage_470x320.png</Android_SplashImage470>
+        <AUP_CAMERA>true</AUP_CAMERA>
+        <Android_LauncherIcon96>$(BDS)\bin\Artwork\Android\FM_LauncherIcon_96x96.png</Android_LauncherIcon96>
+        <Android_LauncherIcon36>$(BDS)\bin\Artwork\Android\FM_LauncherIcon_36x36.png</Android_LauncherIcon36>
+        <AUP_ACCESS_FINE_LOCATION>true</AUP_ACCESS_FINE_LOCATION>
+        <AUP_ACCESS_COARSE_LOCATION>true</AUP_ACCESS_COARSE_LOCATION>
+        <Android_LauncherIcon72>$(BDS)\bin\Artwork\Android\FM_LauncherIcon_72x72.png</Android_LauncherIcon72>
+        <AUP_CALL_PHONE>true</AUP_CALL_PHONE>
+        <AUP_INTERNET>true</AUP_INTERNET>
+        <VerInfo_Keys>package=com.embarcadero.$(MSBuildProjectName);label=$(MSBuildProjectName);versionCode=1;versionName=1.0.0;persistent=False;restoreAnyVersion=False;installLocation=auto;largeHeap=False;theme=TitleBar;hardwareAccelerated=true;apiKey=</VerInfo_Keys>
+        <BT_BuildType>Debug</BT_BuildType>
+        <AUP_READ_PHONE_STATE>true</AUP_READ_PHONE_STATE>
+        <AUP_WRITE_EXTERNAL_STORAGE>true</AUP_WRITE_EXTERNAL_STORAGE>
+        <Android_SplashImage640>$(BDS)\bin\Artwork\Android\FM_SplashImage_640x480.png</Android_SplashImage640>
+        <Android_SplashImage960>$(BDS)\bin\Artwork\Android\FM_SplashImage_960x720.png</Android_SplashImage960>
+        <Android_LauncherIcon48>$(BDS)\bin\Artwork\Android\FM_LauncherIcon_48x48.png</Android_LauncherIcon48>
+        <Android_LauncherIcon144>$(BDS)\bin\Artwork\Android\FM_LauncherIcon_144x144.png</Android_LauncherIcon144>
+        <AUP_WRITE_CALENDAR>true</AUP_WRITE_CALENDAR>
+    </PropertyGroup>
+    <PropertyGroup Condition="'$(Base_Win32)'!=''">
+        <DCC_ExeOutput>C:\elsewere\x32</DCC_ExeOutput>
+        <Manifest_File>(None)</Manifest_File>
+        <VerInfo_Locale>1033</VerInfo_Locale>
+        <DCC_Namespace>Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace)</DCC_Namespace>
+        <BT_BuildType>Debug</BT_BuildType>
+        <VerInfo_Keys>CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments=;ProgramID=com.embarcadero.$(MSBuildProjectName)</VerInfo_Keys>
+    </PropertyGroup>
+    <PropertyGroup Condition="'$(Base_Win64)'!=''">
+        <VerInfo_Locale>1033</VerInfo_Locale>
+        <DCC_ExeOutput>C:\elsewere\x64</DCC_ExeOutput>
+        <DCC_Namespace>Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;$(DCC_Namespace)</DCC_Namespace>
+        <Manifest_File>(None)</Manifest_File>
+        <BT_BuildType>Debug</BT_BuildType>
+        <VerInfo_Keys>CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments=</VerInfo_Keys>
+    </PropertyGroup>
+    <PropertyGroup Condition="'$(Cfg_1)'!=''">
+        <DCC_DebugInformation>0</DCC_DebugInformation>
+        <DCC_LocalDebugSymbols>false</DCC_LocalDebugSymbols>
+        <DCC_SymbolReferenceInfo>0</DCC_SymbolReferenceInfo>
+        <DCC_Define>RELEASE;$(DCC_Define)</DCC_Define>
+    </PropertyGroup>
+    <PropertyGroup Condition="'$(Cfg_1_Win32)'!=''">
+        <VerInfo_Locale>1033</VerInfo_Locale>
+        <VerInfo_Keys>CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments=;ProgramID=com.embarcadero.$(MSBuildProjectName)</VerInfo_Keys>
+    </PropertyGroup>
+    <PropertyGroup Condition="'$(Cfg_2)'!=''">
+        <DCC_GenerateStackFrames>true</DCC_GenerateStackFrames>
+        <DCC_Define>DEBUG;$(DCC_Define)</DCC_Define>
+        <DCC_Optimize>false</DCC_Optimize>
+    </PropertyGroup>
+    <PropertyGroup Condition="'$(Cfg_2_Win64)'!=''">
+        <VerInfo_Locale>1033</VerInfo_Locale>
+        <VerInfo_Keys>CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments=</VerInfo_Keys>
+    </PropertyGroup>
+    <ItemGroup>
+        <DelphiCompile Include="$(MainSource)">
+            <MainSource>MainSource</MainSource>
+        </DelphiCompile>
+        <BuildConfiguration Include="Debug">
+            <Key>Cfg_2</Key>
+            <CfgParent>Base</CfgParent>
+        </BuildConfiguration>
+        <BuildConfiguration Include="Base">
+            <Key>Base</Key>
+        </BuildConfiguration>
+        <BuildConfiguration Include="Release">
+            <Key>Cfg_1</Key>
+            <CfgParent>Base</CfgParent>
+        </BuildConfiguration>
+    </ItemGroup>
+    <ProjectExtensions>
+        <Borland.Personality>Delphi.Personality.12</Borland.Personality>
+        <Borland.ProjectType/>
+        <BorlandProject>
+            <Delphi.Personality>
+                <Source>
+                    <Source Name="MainSource">phpcon.dpr</Source>
+                </Source>
+                <Excluded_Packages>
+                    <Excluded_Packages Name="C:\Program Files (x86)\FastReports\LibD24\dclfrx24.bpl">File C:\Program Files (x86)\FastReports\LibD24\dclfrx24.bpl not found</Excluded_Packages>
+                    <Excluded_Packages Name="C:\Program Files (x86)\FastReports\LibD24\dclfrxDB24.bpl">File C:\Program Files (x86)\FastReports\LibD24\dclfrxDB24.bpl not found</Excluded_Packages>
+                    <Excluded_Packages Name="C:\Program Files (x86)\FastReports\LibD24\dclfrxe24.bpl">File C:\Program Files (x86)\FastReports\LibD24\dclfrxe24.bpl not found</Excluded_Packages>
+                    <Excluded_Packages Name="C:\Program Files (x86)\FastReports\LibD24\dclfrxtee24.bpl">File C:\Program Files (x86)\FastReports\LibD24\dclfrxtee24.bpl not found</Excluded_Packages>
+                    <Excluded_Packages Name="$(BDSBIN)\bcboffice2k240.bpl">Embarcadero C++Builder Office 2000 Servers Package</Excluded_Packages>
+                    <Excluded_Packages Name="$(BDSBIN)\dcloffice2k240.bpl">Microsoft Office 2000 Sample Automation Server Wrapper Components</Excluded_Packages>
+                    <Excluded_Packages Name="$(BDSBIN)\dclofficexp240.bpl">Microsoft Office XP Sample Automation Server Wrapper Components</Excluded_Packages>
+                    <Excluded_Packages Name="C:\Users\Lev\Documents\Embarcadero\Studio\18.0\Projects\Bpl\BCEditor.Delphi.Designtime.bpl">BCEditor Components</Excluded_Packages>
+                </Excluded_Packages>
+            </Delphi.Personality>
+            <Platforms>
+                <Platform value="Android">False</Platform>
+                <Platform value="Win32">True</Platform>
+                <Platform value="Win64">True</Platform>
+            </Platforms>
+            <Deployment Version="3">
+                <DeployFile LocalName="$(BDS)\Redist\osx32\libcgunwind.1.0.dylib" Class="DependencyModule">
+                    <Platform Name="OSX32">
+                        <Overwrite>true</Overwrite>
+                    </Platform>
+                </DeployFile>
+                <DeployFile LocalName="$(BDS)\Redist\iossimulator\libcgunwind.1.0.dylib" Class="DependencyModule">
+                    <Platform Name="iOSSimulator">
+                        <Overwrite>true</Overwrite>
+                    </Platform>
+                </DeployFile>
+                <DeployFile LocalName="$(BDS)\Redist\iossimulator\libPCRE.dylib" Class="DependencyModule">
+                    <Platform Name="iOSSimulator">
+                        <Overwrite>true</Overwrite>
+                    </Platform>
+                </DeployFile>
+                <DeployFile LocalName="$(BDS)\Redist\osx32\libcgsqlite3.dylib" Class="DependencyModule">
+                    <Platform Name="OSX32">
+                        <Overwrite>true</Overwrite>
+                    </Platform>
+                </DeployFile>
+                <DeployFile LocalName="C:\elsewere\phpcon.exe" Configuration="Debug" Class="ProjectOutput">
+                    <Platform Name="Win32">
+                        <RemoteName>phpcon.exe</RemoteName>
+                        <Overwrite>true</Overwrite>
+                    </Platform>
+                </DeployFile>
+                <DeployClass Name="DependencyModule">
+                    <Platform Name="Win32">
+                        <Operation>0</Operation>
+                        <Extensions>.dll;.bpl</Extensions>
+                    </Platform>
+                    <Platform Name="OSX32">
+                        <Operation>1</Operation>
+                        <Extensions>.dylib</Extensions>
+                    </Platform>
+                </DeployClass>
+                <DeployClass Name="ProjectOSXResource">
+                    <Platform Name="OSX32">
+                        <RemoteDir>Contents\Resources</RemoteDir>
+                        <Operation>1</Operation>
+                    </Platform>
+                </DeployClass>
+                <DeployClass Name="AndroidClassesDexFile">
+                    <Platform Name="Android">
+                        <RemoteDir>classes</RemoteDir>
+                        <Operation>1</Operation>
+                    </Platform>
+                </DeployClass>
+                <DeployClass Name="AdditionalDebugSymbols">
+                    <Platform Name="Win32">
+                        <RemoteDir>Contents\MacOS</RemoteDir>
+                        <Operation>0</Operation>
+                    </Platform>
+                    <Platform Name="OSX32">
+                        <Operation>1</Operation>
+                    </Platform>
+                </DeployClass>
+                <DeployClass Name="iPad_Launch768">
+                    <Platform Name="iOSSimulator">
+                        <Operation>1</Operation>
+                    </Platform>
+                    <Platform Name="iOSDevice64">
+                        <Operation>1</Operation>
+                    </Platform>
+                    <Platform Name="iOSDevice32">
+                        <Operation>1</Operation>
+                    </Platform>
+                </DeployClass>
+                <DeployClass Name="Android_LauncherIcon144">
+                    <Platform Name="Android">
+                        <RemoteDir>res\drawable-xxhdpi</RemoteDir>
+                        <Operation>1</Operation>
+                    </Platform>
+                </DeployClass>
+                <DeployClass Name="AndroidLibnativeMipsFile">
+                    <Platform Name="Android">
+                        <RemoteDir>library\lib\mips</RemoteDir>
+                        <Operation>1</Operation>
+                    </Platform>
+                </DeployClass>
+                <DeployClass Required="true" Name="ProjectOutput">
+                    <Platform Name="iOSDevice64">
+                        <Operation>1</Operation>
+                    </Platform>
+                    <Platform Name="iOSDevice32">
+                        <Operation>1</Operation>
+                    </Platform>
+                    <Platform Name="Win32">
+                        <Operation>0</Operation>
+                    </Platform>
+                    <Platform Name="Linux64">
+                        <Operation>1</Operation>
+                    </Platform>
+                    <Platform Name="OSX32">
+                        <Operation>1</Operation>
+                    </Platform>
+                    <Platform Name="Android">
+                        <RemoteDir>library\lib\armeabi-v7a</RemoteDir>
+                        <Operation>1</Operation>
+                    </Platform>
+                    <Platform Name="iOSSimulator">
+                        <Operation>1</Operation>
+                    </Platform>
+                </DeployClass>
+                <DeployClass Name="DependencyFramework">
+                    <Platform Name="Win32">
+                        <Operation>0</Operation>
+                    </Platform>
+                    <Platform Name="OSX32">
+                        <Operation>1</Operation>
+                        <Extensions>.framework</Extensions>
+                    </Platform>
+                </DeployClass>
+                <DeployClass Name="ProjectUWPManifest">
+                    <Platform Name="Win32">
+                        <Operation>1</Operation>
+                    </Platform>
+                    <Platform Name="Win64">
+                        <Operation>1</Operation>
+                    </Platform>
+                </DeployClass>
+                <DeployClass Name="iPhone_Launch640">
+                    <Platform Name="iOSSimulator">
+                        <Operation>1</Operation>
+                    </Platform>
+                    <Platform Name="iOSDevice64">
+                        <Operation>1</Operation>
+                    </Platform>
+                    <Platform Name="iOSDevice32">
+                        <Operation>1</Operation>
+                    </Platform>
+                </DeployClass>
+                <DeployClass Name="iPad_Launch1024">
+                    <Platform Name="iOSSimulator">
+                        <Operation>1</Operation>
+                    </Platform>
+                    <Platform Name="iOSDevice64">
+                        <Operation>1</Operation>
+                    </Platform>
+                    <Platform Name="iOSDevice32">
+                        <Operation>1</Operation>
+                    </Platform>
+                </DeployClass>
+                <DeployClass Name="ProjectiOSDeviceDebug">
+                    <Platform Name="iOSDevice64">
+                        <RemoteDir>..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF</RemoteDir>
+                        <Operation>1</Operation>
+                    </Platform>
+                    <Platform Name="iOSDevice32">
+                        <RemoteDir>..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF</RemoteDir>
+                        <Operation>1</Operation>
+                    </Platform>
+                </DeployClass>
+                <DeployClass Name="iPhone_Launch320">
+                    <Platform Name="iOSSimulator">
+                        <Operation>1</Operation>
+                    </Platform>
+                    <Platform Name="iOSDevice64">
+                        <Operation>1</Operation>
+                    </Platform>
+                    <Platform Name="iOSDevice32">
+                        <Operation>1</Operation>
+                    </Platform>
+                </DeployClass>
+                <DeployClass Name="ProjectiOSInfoPList"/>
+                <DeployClass Name="AndroidLibnativeArmeabiFile">
+                    <Platform Name="Android">
+                        <RemoteDir>library\lib\armeabi</RemoteDir>
+                        <Operation>1</Operation>
+                    </Platform>
+                </DeployClass>
+                <DeployClass Name="DebugSymbols">
+                    <Platform Name="Win32">
+                        <Operation>0</Operation>
+                    </Platform>
+                    <Platform Name="iOSSimulator">
+                        <Operation>1</Operation>
+                    </Platform>
+                    <Platform Name="OSX32">
+                        <Operation>1</Operation>
+                    </Platform>
+                </DeployClass>
+                <DeployClass Name="iPad_Launch1536">
+                    <Platform Name="iOSSimulator">
+                        <Operation>1</Operation>
+                    </Platform>
+                    <Platform Name="iOSDevice64">
+                        <Operation>1</Operation>
+                    </Platform>
+                    <Platform Name="iOSDevice32">
+                        <Operation>1</Operation>
+                    </Platform>
+                </DeployClass>
+                <DeployClass Name="Android_SplashImage470">
+                    <Platform Name="Android">
+                        <RemoteDir>res\drawable-normal</RemoteDir>
+                        <Operation>1</Operation>
+                    </Platform>
+                </DeployClass>
+                <DeployClass Name="Android_LauncherIcon96">
+                    <Platform Name="Android">
+                        <RemoteDir>res\drawable-xhdpi</RemoteDir>
+                        <Operation>1</Operation>
+                    </Platform>
+                </DeployClass>
+                <DeployClass Name="Android_SplashImage640">
+                    <Platform Name="Android">
+                        <RemoteDir>res\drawable-large</RemoteDir>
+                        <Operation>1</Operation>
+                    </Platform>
+                </DeployClass>
+                <DeployClass Name="iPhone_Launch640x1136">
+                    <Platform Name="iOSSimulator">
+                        <Operation>1</Operation>
+                    </Platform>
+                    <Platform Name="iOSDevice64">
+                        <Operation>1</Operation>
+                    </Platform>
+                    <Platform Name="iOSDevice32">
+                        <Operation>1</Operation>
+                    </Platform>
+                </DeployClass>
+                <DeployClass Name="UWP_DelphiLogo44">
+                    <Platform Name="Win32">
+                        <RemoteDir>Assets</RemoteDir>
+                        <Operation>1</Operation>
+                    </Platform>
+                    <Platform Name="Win64">
+                        <RemoteDir>Assets</RemoteDir>
+                        <Operation>1</Operation>
+                    </Platform>
+                </DeployClass>
+                <DeployClass Name="ProjectiOSEntitlements"/>
+                <DeployClass Name="Android_LauncherIcon72">
+                    <Platform Name="Android">
+                        <RemoteDir>res\drawable-hdpi</RemoteDir>
+                        <Operation>1</Operation>
+                    </Platform>
+                </DeployClass>
+                <DeployClass Name="AndroidGDBServer">
+                    <Platform Name="Android">
+                        <RemoteDir>library\lib\armeabi-v7a</RemoteDir>
+                        <Operation>1</Operation>
+                    </Platform>
+                </DeployClass>
+                <DeployClass Name="ProjectOSXInfoPList"/>
+                <DeployClass Name="ProjectOSXEntitlements"/>
+                <DeployClass Name="UWP_DelphiLogo150">
+                    <Platform Name="Win32">
+                        <RemoteDir>Assets</RemoteDir>
+                        <Operation>1</Operation>
+                    </Platform>
+                    <Platform Name="Win64">
+                        <RemoteDir>Assets</RemoteDir>
+                        <Operation>1</Operation>
+                    </Platform>
+                </DeployClass>
+                <DeployClass Name="iPad_Launch2048">
+                    <Platform Name="iOSSimulator">
+                        <Operation>1</Operation>
+                    </Platform>
+                    <Platform Name="iOSDevice64">
+                        <Operation>1</Operation>
+                    </Platform>
+                    <Platform Name="iOSDevice32">
+                        <Operation>1</Operation>
+                    </Platform>
+                </DeployClass>
+                <DeployClass Name="AndroidSplashStyles">
+                    <Platform Name="Android">
+                        <RemoteDir>res\values</RemoteDir>
+                        <Operation>1</Operation>
+                    </Platform>
+                </DeployClass>
+                <DeployClass Name="Android_SplashImage426">
+                    <Platform Name="Android">
+                        <RemoteDir>res\drawable-small</RemoteDir>
+                        <Operation>1</Operation>
+                    </Platform>
+                </DeployClass>
+                <DeployClass Name="AndroidSplashImageDef">
+                    <Platform Name="Android">
+                        <RemoteDir>res\drawable</RemoteDir>
+                        <Operation>1</Operation>
+                    </Platform>
+                </DeployClass>
+                <DeployClass Name="ProjectiOSResource">
+                    <Platform Name="iOSSimulator">
+                        <Operation>1</Operation>
+                    </Platform>
+                    <Platform Name="iOSDevice64">
+                        <Operation>1</Operation>
+                    </Platform>
+                    <Platform Name="iOSDevice32">
+                        <Operation>1</Operation>
+                    </Platform>
+                </DeployClass>
+                <DeployClass Name="ProjectAndroidManifest">
+                    <Platform Name="Android">
+                        <Operation>1</Operation>
+                    </Platform>
+                </DeployClass>
+                <DeployClass Name="Android_DefaultAppIcon">
+                    <Platform Name="Android">
+                        <RemoteDir>res\drawable</RemoteDir>
+                        <Operation>1</Operation>
+                    </Platform>
+                </DeployClass>
+                <DeployClass Name="File">
+                    <Platform Name="Win32">
+                        <Operation>0</Operation>
+                    </Platform>
+                    <Platform Name="iOSDevice64">
+                        <Operation>0</Operation>
+                    </Platform>
+                    <Platform Name="OSX32">
+                        <Operation>0</Operation>
+                    </Platform>
+                    <Platform Name="iOSDevice32">
+                        <Operation>0</Operation>
+                    </Platform>
+                    <Platform Name="Android">
+                        <Operation>0</Operation>
+                    </Platform>
+                    <Platform Name="iOSSimulator">
+                        <Operation>0</Operation>
+                    </Platform>
+                </DeployClass>
+                <DeployClass Name="AndroidServiceOutput">
+                    <Platform Name="Android">
+                        <RemoteDir>library\lib\armeabi-v7a</RemoteDir>
+                        <Operation>1</Operation>
+                    </Platform>
+                </DeployClass>
+                <DeployClass Required="true" Name="DependencyPackage">
+                    <Platform Name="Win32">
+                        <Operation>0</Operation>
+                        <Extensions>.bpl</Extensions>
+                    </Platform>
+                    <Platform Name="iOSDevice64">
+                        <Operation>1</Operation>
+                        <Extensions>.dylib</Extensions>
+                    </Platform>
+                    <Platform Name="OSX32">
+                        <Operation>1</Operation>
+                        <Extensions>.dylib</Extensions>
+                    </Platform>
+                    <Platform Name="iOSDevice32">
+                        <Operation>1</Operation>
+                        <Extensions>.dylib</Extensions>
+                    </Platform>
+                    <Platform Name="iOSSimulator">
+                        <Operation>1</Operation>
+                        <Extensions>.dylib</Extensions>
+                    </Platform>
+                </DeployClass>
+                <DeployClass Name="Android_LauncherIcon48">
+                    <Platform Name="Android">
+                        <RemoteDir>res\drawable-mdpi</RemoteDir>
+                        <Operation>1</Operation>
+                    </Platform>
+                </DeployClass>
+                <DeployClass Name="Android_SplashImage960">
+                    <Platform Name="Android">
+                        <RemoteDir>res\drawable-xlarge</RemoteDir>
+                        <Operation>1</Operation>
+                    </Platform>
+                </DeployClass>
+                <DeployClass Name="Android_LauncherIcon36">
+                    <Platform Name="Android">
+                        <RemoteDir>res\drawable-ldpi</RemoteDir>
+                        <Operation>1</Operation>
+                    </Platform>
+                </DeployClass>
+                <DeployClass Name="ProjectiOSDeviceResourceRules"/>
+                <ProjectRoot Platform="iOSDevice64" Name="$(PROJECTNAME).app"/>
+                <ProjectRoot Platform="Win64" Name="$(PROJECTNAME)"/>
+                <ProjectRoot Platform="iOSDevice32" Name="$(PROJECTNAME).app"/>
+                <ProjectRoot Platform="Linux64" Name="$(PROJECTNAME)"/>
+                <ProjectRoot Platform="Win32" Name="$(PROJECTNAME)"/>
+                <ProjectRoot Platform="OSX32" Name="$(PROJECTNAME)"/>
+                <ProjectRoot Platform="Android" Name="$(PROJECTNAME)"/>
+                <ProjectRoot Platform="iOSSimulator" Name="$(PROJECTNAME).app"/>
+            </Deployment>
+        </BorlandProject>
+        <ProjectFileVersion>12</ProjectFileVersion>
+    </ProjectExtensions>
+    <Import Project="$(BDS)\Bin\CodeGear.Delphi.Targets" Condition="Exists('$(BDS)\Bin\CodeGear.Delphi.Targets')"/>
+    <Import Project="$(APPDATA)\Embarcadero\$(BDSAPPDATABASEDIR)\$(PRODUCTVERSION)\UserTools.proj" Condition="Exists('$(APPDATA)\Embarcadero\$(BDSAPPDATABASEDIR)\$(PRODUCTVERSION)\UserTools.proj')"/>
+    <Import Project="$(MSBuildProjectName).deployproj" Condition="Exists('$(MSBuildProjectName).deployproj')"/>
+</Project>
diff --git a/Source/PHP.INC b/Source/PHP.INC
index 6347b1e..2662f6d 100644
--- a/Source/PHP.INC
+++ b/Source/PHP.INC
@@ -12,8 +12,7 @@
 { $Id: PHP.INC,v 7.4 10/2009 delphi32 Exp $ }
 
 {IMPORTANT:
-If you are using PHP version 4.2.x...4.3.0 please change $DEFINE PHP433 to $DEFINE PHP430
-If you are using PHP version 5.0 please change $DEFINE PHP433 to $DEFINE PHP5 or remove it
+If you are using PHP version 5.0 please add $DEFINE PHP5
 If you are using PHP version 5.0.4 please add $DEFINE PHP504
 If you are using PHP version 5.1.0 or higher please add $DEFINE PHP510
 If you are using PHP version 5.1.1 or higher please add $DEFINE PHP511
@@ -36,15 +35,6 @@ Sorry for such complicated configuration, but PHP team does not keep
 backward compatibility between PHP versions.
 }
 
-
-{.$DEFINE PHP4}
-{.$DEFINE PHP430}
-{.$DEFINE PHP433}
-{.$DEFINE PHP435}
-{.$DEFINE PHP446}
-
-{If you are using PHP 4 please comment $DEFINE PHP5}
-
 {PHP5 must be defined if you are using PHP5}
 {$DEFINE PHP5}
 
@@ -62,9 +52,9 @@ backward compatibility between PHP versions.
   {$DEFINE ZEND_WIN32}
   {$DEFINE PHP_COMPILER_ID}
 {$ENDIF}
-{$DEFINE soulengine_build}
+{s$DEFINE soulengine_build}
 {.$DEFINE PHP7}
-{.$DEFINE P_CUT}
+{.$DEFINE CUTTED_PHP7dll}
  {$IFDEF PHP7}
   {$DEFINE COMPILER_VC14}
   {$DEFINE PHP560}
@@ -86,20 +76,12 @@ backward compatibility between PHP versions.
 //problems
 
 {$IFDEF PHP_COMPILER_ID}
- {.$DEFINE COMPILER_VC6}
  {$DEFINE COMPILER_VC9}
 	{$IFNDEF PHP7}
 		{$IFDEF PHP550} {$DEFINE COMPILER_VC11} {$ENDIF}
 	{$ENDIF}
 {$ENDIF}
 
-{$IFDEF PHP5}
-  {$UNDEF PHP4}
-  {$UNDEF PHP430}
-  {$UNDEF PHP433}
-  {$UNDEF PHP435}
-  {$UNDEF PHP446}
-{$ENDIF}
 {$WARN UNIT_DEPRECATED OFF}
 
 {.$DEFINE QUIET_LOAD} //Do not show error while loading php4ts.dll or php5ts.dll (depends from php version)
diff --git a/Source/PHPAPI.pas b/Source/PHPAPI.pas
index 1f0cf58..d1a6baf 100644
--- a/Source/PHPAPI.pas
+++ b/Source/PHPAPI.pas
@@ -22,7 +22,7 @@ interface
 
 uses
  {Windows} SysUtils,
-
+  VCL.Dialogs,
  {$IFDEF FPC}
   dynlibs
  {$ELSE}
@@ -66,7 +66,7 @@ interface
 
  sapi_add_header_ex: function(header_line : zend_pchar; header_line_len : uint; duplicated : zend_bool; replace : zend_bool; TSRMLS_DC : pointer) : integer; cdecl;
 
- php_execute_script : function (primary_file: pointer; TSRMLS_D : pointer) : Integer; cdecl;
+ php_execute_script : function (primary_file: PZendFileHandle; TSRMLS_D : pointer) : {$IFDEF CPUX64} Int64 {$ELSE} Integer{$ENDIF}; cdecl;
 
  php_handle_aborted_connection:  procedure; cdecl;
 
@@ -120,8 +120,10 @@ interface
   php_get_output_start_filename: function  (TSRMLS_D : pointer) : zend_pchar; cdecl;
   php_get_output_start_lineno: function (TSRMLS_D : pointer) : integer; cdecl;
   php_ob_handler_used: function (handler_name : zend_pchar; TSRMLS_DC : pointer) : integer; cdecl;
+  {$IF not Defined(PHP540) and not Defined(PHP550) and not Defined(PHP560)}
   php_ob_init_conflict: function (handler_new : zend_pchar; handler_set : zend_pchar; TSRMLS_DC : pointer) : integer; cdecl;
   {$ENDIF}
+  {$ENDIF}
 
 //php_output.h
 
@@ -175,7 +177,7 @@ function GetSAPIGlobals(TSRMLS_DC : pointer) : Psapi_globals_struct; overload;
 
 
 
-{$IFNDEF P_CUT}
+{$IFNDEF CUTTED_PHP7dll}
 php_log_err: procedure (err_msg : zend_pchar; TSRMLS_DC : pointer); cdecl;
 {$ENDIF}
 php_html_puts: procedure (str : zend_pchar; str_len : integer; TSRMLS_DC : pointer); cdecl;
@@ -213,12 +215,7 @@ function GetSAPIGlobals(TSRMLS_DC : pointer) : Psapi_globals_struct; overload;
 
 php_raw_url_encode: function (s : zend_pchar; len : Integer; new_length : PInteger) : zend_pchar; cdecl;
 
-{$IFDEF PHP5}
 php_register_extensions: function (ptr : PPzend_module_entry; count: integer; TSRMLS_DC: pointer) : integer; cdecl;
-{$ELSE}
-php_startup_extensions: function (ptr: pointer; count : integer) : integer; cdecl;
-{$ENDIF}
-
 php_error_docref0: procedure (const docref : zend_pchar; TSRMLS_DC : pointer; _type : integer; const Msg : zend_pchar); cdecl;
 php_error_docref: procedure (const docref : zend_pchar; TSRMLS_DC : pointer; _type : integer; const Msg : zend_pchar); cdecl;
 
@@ -235,7 +232,7 @@ function GetEnvVariables : pzval;
 function GetFilesVariables : pzval;
 
 function GetPHPGlobals(TSRMLS_DC : pointer) : Pphp_Core_Globals;
-function PG(TSRMLS_DC : pointer) : Pphp_Core_Globals;
+//function PG(TSRMLS_DC : pointer) : Pphp_Core_Globals;
 
 
 procedure PHP_FUNCTION(var AFunction : zend_function_entry; AName : zend_pchar; AHandler : pointer);
@@ -246,15 +243,12 @@ procedure UnloadPHP;
 
 function PHPLoaded : boolean;
 
-{$IFNDEF QUIET_LOAD}
-procedure CheckPHPErrors;
-{$ENDIF}
-
 function FloatToValue(Value: Extended): zend_ustr;
 function ValueToFloat(Value : zend_ustr) : extended;
 
 
 var
+//Info.h
 php_print_info: procedure (flag : Integer; TSRMLS_DC : pointer); cdecl;
 
 
@@ -275,12 +269,14 @@ function ValueToFloat(Value : zend_ustr) : extended;
 php_info_print_table_row : procedure (n2 : integer; c1, c2 : zend_pchar); cdecl;
 
 php_info_print_table_end: procedure (); cdecl;
-
+{$IF Defined(PHP540) or Defined(PHP550) or Defined(PHP560)}
+php_write: function (const str : zend_pchar; str_length: uint; TSRMLS_DC : pointer) : integer; cdecl;
+{$ELSE}
 php_body_write: function (const str : zend_pchar; str_length: uint; TSRMLS_DC : pointer) : integer; cdecl;
 php_header_write: function (const str : zend_pchar; str_length: uint; TSRMLS_DC : pointer) : integer; cdecl;
+{$ENDIF}
 
-
-php_header: function() : integer; cdecl;
+php_header: function(TSRMLS_D: pointer) : integer; cdecl;
 php_setcookie: function (name : zend_pchar; name_len : integer; value : zend_pchar; value_len: integer;
     expires : longint; path : zend_pchar; path_len : integer; domain : zend_pchar; domain_len : integer;
     secure : integer; TSRMLS_DC : pointer) : integer; cdecl;
@@ -310,49 +306,21 @@ function PHPLoaded : boolean;
 procedure UnloadPHP;
 var
  H : THandle;
+ vt: Integer;
 begin
-  H := InterlockedExchange(integer(PHPLib), 0);
+  vt := integer(PHPLib);
+  H := InterlockedExchange(vt, 0);
   if H > 0 then
   begin
     FreeLibrary(H);
   end;
 end;
 
-{$IFDEF PHP4}
-function GetSymbolsTable : PHashTable;
-var
- executor_globals : pointer;
- executor_globals_value : integer;
- executor_hash : PHashTable;
- tsrmls_dc : pointer;
-begin
-  if not PHPLoaded then
-   begin
-     Result := nil;
-     Exit;
-   end;
-
-  executor_globals := GetProcAddress(PHPLib, 'executor_globals_id');
-  executor_globals_value := integer(executor_globals^);
-  tsrmls_dc := tsrmls_fetch;
-  asm
-    mov ecx, executor_globals_value
-    mov edx, dword ptr tsrmls_dc
-    mov eax, dword ptr [edx]
-    mov ecx, dword ptr [eax+ecx*4-4]
-    add ecx, 0DCh
-    mov executor_hash, ecx
-  end;
-  Result := executor_hash;
-end;
-{$ELSE}
 function GetSymbolsTable : PHashTable;
 begin
   Result := @GetExecutorGlobals.symbol_table;
 end;
 
-{$ENDIF}
-
 function GetTrackHash(Name : zend_ustr) : {$IFDEF PHP7}Pzend_array{$ELSE}PHashTable{$ENDIF};
 var
  data : ^ppzval;
@@ -360,11 +328,7 @@ function GetTrackHash(Name : zend_ustr) : {$IFDEF PHP7}Pzend_array{$ELSE}PHashTa
  ret  : integer;
 begin
  Result := nil;
-  {$IFDEF PHP4}
    arr := GetSymbolsTable;
-  {$ELSE}
-   arr := @GetExecutorGlobals.symbol_table;
-  {$ENDIF}
  if Assigned(Arr) then
   begin
     new(data);
@@ -378,47 +342,19 @@ function GetTrackHash(Name : zend_ustr) : {$IFDEF PHP7}Pzend_array{$ELSE}PHashTa
 
 
 function GetSAPIGlobals : Psapi_globals_struct;
-var
- sapi_globals_value : integer;
- sapi_globals : Psapi_globals_struct;
- tsrmls_dc : pointer;
 begin
   Result := nil;
   if Assigned(sapi_globals_id) then
-   begin
-     tsrmls_dc := tsrmls_fetch;
-     sapi_globals_value := integer(sapi_globals_id^);
-     asm
-       mov ecx, sapi_globals_value
-       mov edx, dword ptr tsrmls_dc
-       mov eax, dword ptr [edx]
-       mov ecx, dword ptr [eax+ecx*4-4]
-       mov sapi_globals, ecx
-     end;
-     Result := sapi_globals;
-   end;
+     Result := __asm_fetchval(integer(sapi_globals_id^), tsrmls_fetch);
 end;
 function GetSAPIGlobals(TSRMLS_DC : pointer) : Psapi_globals_struct;
 var
  sapi_global_id : pointer;
- sapi_globals_value : integer;
- sapi_globals : Psapi_globals_struct;
-
 begin
   Result := nil;
   sapi_global_id := GetProcAddress(PHPLib, 'sapi_globals_id');
   if Assigned(sapi_global_id) then
-   begin
-     sapi_globals_value := integer(sapi_global_id^);
-     asm
-       mov ecx, sapi_globals_value
-       mov edx, dword ptr tsrmls_dc
-       mov eax, dword ptr [edx]
-       mov ecx, dword ptr [eax+ecx*4-4]
-       mov sapi_globals, ecx
-     end;
-     Result := sapi_globals;
-   end;
+     Result := __asm_fetchval(integer(sapi_globals_id^), TSRMLS_DC);
 end;
 
 function GetStringOf(const V: TVarData): string;
@@ -468,52 +404,21 @@ function GetStringOf(const V: TVarData): string;
 end;
 
 function GetPHPGlobals(TSRMLS_DC : pointer) : Pphp_Core_Globals;
-var
- core_globals_value : integer;
- core_globals : Pphp_core_globals;
 begin
   Result := nil;
   if Assigned(core_globals_id) then
-   begin
-     core_globals_value := integer(core_globals_id^);
-     asm
-       mov ecx, core_globals_value
-       mov edx, dword ptr tsrmls_dc
-       mov eax, dword ptr [edx]
-       mov ecx, dword ptr [eax+ecx*4-4]
-       mov core_globals, ecx
-     end;
-     Result := core_globals;
-   end;
+     Result := Pphp_Core_Globals(__asm_fetchval(integer(core_globals_id^), TSRMLS_DC));
 end;
 
 
-
-function PG(TSRMLS_DC : pointer) : Pphp_Core_Globals;
-begin
-  result := GetPHPGlobals(TSRMLS_DC);
-end;
-
-
-
-
 procedure PHP_FUNCTION(var AFunction : zend_function_entry; AName : zend_pchar; AHandler : pointer);
 begin
   AFunction.fname := AName;
 
   AFunction.handler := AHandler;
-  {$IFDEF PHP4}
-  AFunction.func_arg_types := nil;
-  {$ELSE}
   AFunction.arg_info := nil;
-  {$ENDIF}
 end;
 
-
-{procedure phperror(Error : zend_pchar);
-begin
-  zend_error(E_PARSE, Error);
-end;    }
 {$IFDEF PHP540}
 //HERE
 
@@ -544,322 +449,229 @@ function LoadPHP(const DllFileName: zend_ustr = PHPWin) : boolean;
 
   php_default_post_reader          := GetProcAddress(PHPLib, 'php_default_post_reader');
 
-  sapi_add_header_ex               := GetProcAddress(PHPLib, 'sapi_add_header_ex');
+  LFunc(@sapi_add_header_ex, 'sapi_add_header_ex');
 
-  php_request_startup              := GetProcAddress(PHPLib, 'php_request_startup');
+  LFunc(@php_request_startup, 'php_request_startup');
 
-  php_request_shutdown             := GetProcAddress(PHPLib, 'php_request_shutdown');
+  LFunc(@php_request_shutdown, 'php_request_shutdown');
 
-  php_module_startup               := GetProcAddress(PHPLib, 'php_module_startup');
+  LFunc(@php_module_startup, 'php_module_startup');
 
-  php_module_shutdown              := GetProcAddress(PHPLib, 'php_module_shutdown');
+  LFunc(@php_module_shutdown, 'php_module_shutdown');
 
-  php_module_shutdown_wrapper      := GetProcAddress(PHPLib, 'php_module_shutdown_wrapper');
+  LFunc(@php_module_shutdown_wrapper, 'php_module_shutdown_wrapper');
 
-  sapi_startup                     := GetProcAddress(PHPLib, 'sapi_startup');
+  LFunc(@sapi_startup, 'sapi_startup');
 
-  sapi_shutdown                    := GetProcAddress(PHPLib, 'sapi_shutdown');
+  LFunc(@sapi_shutdown, 'sapi_shutdown');
 
-  sapi_activate                    := GetProcAddress(PHPLib, 'sapi_activate');
+  LFunc(@sapi_activate, 'sapi_activate');
 
-  sapi_deactivate                  := GetProcAddress(PHPLib, 'sapi_deactivate');
+  LFunc(@sapi_deactivate, 'sapi_deactivate');
 
-  php_execute_script               := GetProcAddress(PHPLib, 'php_execute_script');
+  LFunc(@php_execute_script, 'php_execute_script');
 
-  php_handle_aborted_connection    := GetProcAddress(PHPLib, 'php_handle_aborted_connection');
+  LFunc(@php_handle_aborted_connection, 'php_handle_aborted_connection');
 
-  php_register_variable            := GetProcAddress(PHPLib, 'php_register_variable');
+  LFunc(@php_register_variable, 'php_register_variable');
 
-  php_register_variable_safe       := GetProcAddress(PHPLib, 'php_register_variable_safe');
+  LFunc(@php_register_variable_safe, 'php_register_variable_safe');
 
-  php_register_variable_ex         := GetProcAddress(PHPLib, 'php_register_variable_ex');
+  LFunc(@php_register_variable_ex, 'php_register_variable_ex');
 
-  php_output_startup               := GetProcAddress(PHPLib, 'php_output_startup');
+  LFunc(@php_output_startup, 'php_output_startup');
 
-  php_output_activate              := GetProcAddress(PHPLib, 'php_output_activate');
+  LFunc(@php_output_activate, 'php_output_activate');
 
-  php_output_set_status            := GetProcAddress(PHPLib, 'php_output_set_status');
+  LFunc(@php_output_set_status, 'php_output_set_status');
 
-  php_output_register_constants    := GetProcAddress(PHPLib, 'php_output_register_constants');
+  LFunc(@php_output_register_constants, 'php_output_register_constants');
   {$IFDEF PHP540}
-  php_start_ob_buffer              := GetProcAddress(PHPLib, 'php_output_start_user');
+  LFunc(@php_start_ob_buffer, 'php_output_start_user');
 
-  php_start_ob_buffer_named        := GetProcAddress(PHPLib, 'php_output_start_internal');
+  LFunc(@php_start_ob_buffer_named, 'php_output_start_internal');
 
-  php_end_ob_buffer                := GetProcAddress(PHPLib, 'php_output_end');
+  LFunc(@php_end_ob_buffer, 'php_output_end');
 
-  php_end_ob_buffers               := GetProcAddress(PHPLib, 'php_output_end_all');
+  LFunc(@php_end_ob_buffers, 'php_output_end_all');
 
-  php_ob_get_buffer                := GetProcAddress(PHPLib, 'php_output_get_contents');
+  LFunc(@php_ob_get_buffer, 'php_output_get_contents');
 
-  php_ob_get_length                := GetProcAddress(PHPLib, 'php_output_get_length');
+  LFunc(@php_ob_get_length, 'php_output_get_length');
 
-  php_output_set_implicit_flush     :=GetProcAddress(PHPLib, 'php_output_set_implicit_flush');
+  LFunc(@php_output_set_implicit_flush, 'php_output_set_implicit_flush');
 
-  php_get_output_start_filename    := GetProcAddress(PHPLib, 'php_output_get_start_filename');
+  LFunc(@php_get_output_start_filename, 'php_output_get_start_filename');
 
-  php_get_output_start_lineno      := GetProcAddress(PHPLib, 'php_output_get_start_lineno');
+  LFunc(@php_get_output_start_lineno, 'php_output_get_start_lineno');
 
-  php_output_handler_started       := GetProcAddress(PHPLib, 'php_output_handler_started');
+  LFunc(@php_output_handler_started, 'php_output_handler_started');
   {$ELSE}
-  php_start_ob_buffer              := GetProcAddress(PHPLib, 'php_start_ob_buffer');
+  LFunc(@php_start_ob_buffer, 'php_start_ob_buffer');
 
-  php_start_ob_buffer_named        := GetProcAddress(PHPLib, 'php_start_ob_buffer_named');
+  php_start_ob_buffer_named, 'php_start_ob_buffer_named');
 
-  php_end_ob_buffer                := GetProcAddress(PHPLib, 'php_end_ob_buffer');
+  php_end_ob_buffer, 'php_end_ob_buffer');
 
-  php_end_ob_buffers               := GetProcAddress(PHPLib, 'php_end_ob_buffers');
+  php_end_ob_buffers, 'php_end_ob_buffers');
 
-  php_ob_get_buffer                := GetProcAddress(PHPLib, 'php_ob_get_buffer');
+  php_ob_get_buffer, 'php_ob_get_buffer');
 
-  php_ob_get_length                := GetProcAddress(PHPLib, 'php_ob_get_length');
+  php_ob_get_length, 'php_ob_get_length');
 
-  php_start_implicit_flush         := GetProcAddress(PHPLib, 'php_start_implicit_flush');
+  php_start_implicit_flush, 'php_start_implicit_flush');
 
-  php_end_implicit_flush           := GetProcAddress(PHPLib, 'php_end_implicit_flush');
+  php_end_implicit_flush, 'php_end_implicit_flush');
 
-  php_get_output_start_filename    := GetProcAddress(PHPLib, 'php_get_output_start_filename');
+  php_get_output_start_filename, 'php_get_output_start_filename');
 
-  php_get_output_start_lineno      := GetProcAddress(PHPLib, 'php_get_output_start_lineno');
+  php_get_output_start_lineno, 'php_get_output_start_lineno');
 
-  php_ob_handler_used              := GetProcAddress(PHPLib, 'php_ob_handler_used');
+  php_ob_handler_used, 'php_ob_handler_used');
 {$ENDIF}
+    {$IF not Defined(PHP540) and not Defined(PHP550) and not Defined(PHP560)}
+  php_ob_init_conflict, 'php_ob_init_conflict');
+    {$ENDIF}
+  LFunc(@php_strtoupper, 'php_strtoupper');
 
-  php_ob_init_conflict             := GetProcAddress(PHPLib, 'php_ob_init_conflict');
-
-  php_strtoupper                   := GetProcAddress(PHPLib, 'php_strtoupper');
-
-  php_strtolower                   := GetProcAddress(PHPLib, 'php_strtolower');
+  LFunc(@php_strtolower,'php_strtolower');
 
-  php_strtr                        := GetProcAddress(PHPLib, 'php_strtr');
+  LFunc(@php_strtr,   'php_strtr');
 
-  php_stripcslashes                := GetProcAddress(PHPLib, 'php_stripcslashes');
+  LFunc(@php_stripcslashes, 'php_stripcslashes');
 
-  php_basename                     := GetProcAddress(PHPLib, 'php_basename');
+  LFunc(@php_basename, 'php_basename');
 
-  php_dirname                      := GetProcAddress(PHPLib, 'php_dirname');
+  LFunc(@php_dirname, 'php_dirname');
 
-  php_stristr                      := GetProcAddress(PHPLib, 'php_stristr');
+  LFunc(@php_stristr, 'php_stristr');
 
-  php_str_to_str                   := GetProcAddress(PHPLib, 'php_str_to_str');
+  LFunc(@php_str_to_str, 'php_str_to_str');
 
-  php_strip_tags                   := GetProcAddress(PHPLib, 'php_strip_tags');
+  LFunc(@php_strip_tags, 'php_strip_tags');
 
-  php_implode                      := GetProcAddress(PHPLib, 'php_implode');
+  LFunc(@php_implode, 'php_implode');
 
-  php_explode                      := GetProcAddress(PHPLib, 'php_explode');
+  LFunc(@php_explode, 'php_explode');
 
-  php_info_html_esc                := GetProcAddress(PHPLib, 'php_info_html_esc');
+  LFunc(@php_info_html_esc, 'php_info_html_esc');
 
-  php_print_info_htmlhead          := GetProcAddress(PHPLib, 'php_print_info_htmlhead');
+  LFunc(@php_print_info_htmlhead, 'php_print_info_htmlhead');
 
-  php_print_info                   := GetProcAddress(PHPLib, 'php_print_info');
+  LFunc(@php_print_info, 'php_print_info');
 
-  php_info_print_table_colspan_header := GetProcAddress(PHPLib, 'php_info_print_table_colspan_header');
+  LFunc(@php_info_print_table_colspan_header, 'php_info_print_table_colspan_header');
 
-  php_info_print_box_start            := GetProcAddress(PHPLib, 'php_info_print_box_start');
+  LFunc(@php_info_print_box_start, 'php_info_print_box_start');
 
-  php_info_print_box_end              := GetProcAddress(PHPLib, 'php_info_print_box_end');
+  LFunc(@php_info_print_box_end, 'php_info_print_box_end');
 
-  php_info_print_hr                   := GetProcAddress(PHPLib, 'php_info_print_hr');
+  LFunc(@php_info_print_hr, 'php_info_print_hr');
 
-  php_info_print_table_start          := GetProcAddress(PHPLib, 'php_info_print_table_start');
+  LFunc(@php_info_print_table_start, 'php_info_print_table_start');
 
-  php_info_print_table_row1           := GetProcAddress(PHPLib, 'php_info_print_table_row');
+  LFunc(@php_info_print_table_row1, 'php_info_print_table_row');
 
-  php_info_print_table_row2           := GetProcAddress(PHPLib, 'php_info_print_table_row');
+  LFunc(@php_info_print_table_row2, 'php_info_print_table_row');
 
-  php_info_print_table_row3           := GetProcAddress(PHPLib, 'php_info_print_table_row');
+  LFunc(@php_info_print_table_row3, 'php_info_print_table_row');
 
-  php_info_print_table_row4           := GetProcAddress(PHPLib, 'php_info_print_table_row');
+  LFunc(@php_info_print_table_row4, 'php_info_print_table_row');
 
-  php_info_print_table_row            := GetProcAddress(PHPLib, 'php_info_print_table_row');
+  LFunc(@php_info_print_table_row, 'php_info_print_table_row');
 
-  php_info_print_table_end            := GetProcAddress(PHPLib, 'php_info_print_table_end');
-
-  php_body_write                      := GetProcAddress(PHPLib, 'php_body_write');
-
-  php_header_write                    := GetProcAddress(PHPLib, 'php_header_write');
-  {$IFNDEF P_CUT}
-  php_log_err                         := GetProcAddress(PHPLib, 'php_log_err');
+  LFunc(@php_info_print_table_end, 'php_info_print_table_end');
+  {$IF Defined(PHP540) or Defined(PHP550) or Defined(PHP560)}
+  LFunc(@php_write, 'php_write' );
+  {$ELSE}
+  LFunc(@php_body_write, 'php_body_write' );
+  LFunc(@php_header_write, 'php_header_write');
   {$ENDIF}
-  php_html_puts                       := GetProcAddress(PHPLib, 'php_html_puts');
-
-  _php_error_log                      := GetProcAddress(PHPLib, '_php_error_log');
-
-  php_print_credits                   := GetProcAddress(PHPLib, 'php_print_credits');
+  {$IFNDEF CUTTED_PHP7dll}
+  LFunc(@php_log_err, 'php_log_err');
+  {$ENDIF}
+  LFunc(@php_html_puts, 'php_html_puts');
 
-  php_info_print_css                  := GetProcAddress(PHPLib, 'php_info_print_css');
+  LFunc(@_php_error_log, '_php_error_log');
 
-  php_set_sock_blocking               := GetProcAddress(PHPLib, 'php_set_sock_blocking');
+  LFunc(@php_print_credits, 'php_print_credits');
 
-  php_copy_file                       := GetProcAddress(PHPLib, 'php_copy_file');
+  LFunc(@php_info_print_css, 'php_info_print_css');
 
-  {$IFDEF PHP4}
-  php_flock                           := GetProcAddress(PHPLib, 'php_flock');
-  php_lookup_hostname                 := GetProcAddress(PHPLib, 'php_lookup_hostname');
-  {$ENDIF}
+  LFunc(@php_set_sock_blocking, 'php_set_sock_blocking');
 
+  LFunc(@php_copy_file, 'php_copy_file');
 
-  php_header                          := GetProcAddress(PHPLib, 'php_header');
+  LFunc(@php_header, 'php_header');
 
-  php_setcookie                       := GetProcAddress(PHPLib, 'php_setcookie');
+  LFunc(@php_setcookie, 'php_setcookie');
 
-  php_escape_html_entities            := GetProcAddress(PHPLib, 'php_escape_html_entities');
+  LFunc(@php_escape_html_entities, 'php_escape_html_entities');
 
-  php_ini_long                        := GetProcAddress(PHPLib, 'zend_ini_long');
+  LFunc(@php_ini_long, 'zend_ini_long');
 
-  php_ini_double                      := GetProcAddress(PHPLib, 'zend_ini_double');
+  LFunc(@php_ini_double, 'zend_ini_double');
 
-  php_ini_string                      := GetProcAddress(PHPLib, 'zend_ini_string');
+  LFunc(@php_ini_string, 'zend_ini_string');
 
-  php_url_free                        := GetProcAddress(PHPLib, 'php_url_free');
+  LFunc(@php_url_free, 'php_url_free');
 
-  php_url_parse                       := GetProcAddress(PHPLib, 'php_url_parse');
+  LFunc(@php_url_parse, 'php_url_parse');
 
-  php_url_decode                      := GetProcAddress(PHPLib, 'php_url_decode');
+  LFunc(@php_url_decode, 'php_url_decode');
 
-  php_raw_url_decode                  := GetProcAddress(PHPLib, 'php_raw_url_decode');
+  LFunc(@php_raw_url_decode, 'php_raw_url_decode');
 
-  php_url_encode                      := GetProcAddress(PHPLib, 'php_url_encode');
+  LFunc(@php_url_encode, 'php_url_encode');
 
-  php_raw_url_encode                  := GetProcAddress(PHPLib, 'php_raw_url_encode');
+  LFunc(@php_raw_url_encode, 'php_raw_url_encode');
 
   {$IFDEF PHP5}
-  php_register_extensions              := GetProcAddress(PHPLib, 'php_register_extensions');
+  LFunc(@php_register_extensions, 'php_register_extensions');
   {$ELSE}
-  php_startup_extensions              := GetProcAddress(PHPLib, 'php_startup_extensions');
+  LFunc(@php_startup_extensions, 'php_startup_extensions');
   {$ENDIF}
 
-  php_error_docref0                   := GetProcAddress(PHPLib, 'php_error_docref0');
-
-  php_error_docref                    := GetProcAddress(PHPLib, 'php_error_docref0');
-
-  php_error_docref1                   := GetProcAddress(PHPLib, 'php_error_docref1');
+  LFunc(@php_error_docref0, 'php_error_docref0');
 
-  php_error_docref2                   := GetProcAddress(PHPLib, 'php_error_docref2');
+  LFunc(@php_error_docref, 'php_error_docref0');
 
+  LFunc(@php_error_docref1, 'php_error_docref1');
 
-
-  {$IFNDEF QUIET_LOAD}
-  CheckPHPErrors;
-  {$ENDIF}
+  LFunc(@php_error_docref2, 'php_error_docref2');
 
   Result := true;
 end;
 
-
-
-{$IFNDEF QUIET_LOAD}
-procedure CheckPHPErrors;
-begin
-  if @sapi_add_header_ex = nil then raise EPHP4DelphiException.Create('sapi_add_header_ex');
-  if @php_request_startup = nil then raise EPHP4DelphiException.Create('php_request_startup');
-  if @php_request_shutdown = nil then raise EPHP4DelphiException.Create('php_request_shutdown');
-  if @php_module_startup = nil then raise EPHP4DelphiException.Create('php_module_startup');
-  if @php_module_shutdown = nil then raise EPHP4DelphiException.Create('php_module_shutdown');
-  if @php_module_shutdown_wrapper = nil then raise EPHP4DelphiException.Create('php_module_shutdown_wrapper');
-  if @sapi_startup = nil then raise EPHP4DelphiException.Create('sapi_startup');
-  if @sapi_shutdown = nil then raise EPHP4DelphiException.Create('sapi_shutdown');
-  if @sapi_activate = nil then raise EPHP4DelphiException.Create('sapi_activate');
-  if @sapi_deactivate = nil then raise EPHP4DelphiException.Create('sapi_deactivate');
-  if @php_execute_script = nil then raise EPHP4DelphiException.Create('php_execute_script');
-  if @php_handle_aborted_connection = nil then raise EPHP4DelphiException.Create('php_handle_aborted_connection');
-  if @php_register_variable = nil then raise EPHP4DelphiException.Create('php_register_variable');
-  if @php_register_variable_safe = nil then raise EPHP4DelphiException.Create('php_register_variable_safe');
-  if @php_register_variable_ex = nil then raise EPHP4DelphiException.Create('php_register_variable_ex');
-  if @php_strip_tags = nil then raise EPHP4DelphiException.Create('php_strip_tags');
-  {$IFNDEF P_CUT}
-  if @php_log_err = nil then raise EPHP4DelphiException.Create('php_log_err');
-  {$ENDIF}
-  if @php_html_puts = nil then raise EPHP4DelphiException.Create('php_html_puts');
-  if @_php_error_log = nil then raise EPHP4DelphiException.Create('_php_error_log');
-  if @php_print_credits = nil then raise EPHP4DelphiException.Create('php_print_credits');
-  if @php_info_print_css = nil then raise EPHP4DelphiException.Create('php_info_print_css');
-  if @php_set_sock_blocking = nil then raise EPHP4DelphiException.Create('php_set_sock_blocking');
-  if @php_copy_file = nil then raise EPHP4DelphiException.Create('php_copy_file');
-
-  if @php_ini_long = nil then raise EPHP4DelphiException.Create('php_ini_long');
-  if @php_ini_double = nil then raise EPHP4DelphiException.Create('php_ini_double');
-  if @php_ini_string = nil then raise EPHP4DelphiException.Create('php_ini_string');
-  if @php_url_free = nil then raise EPHP4DelphiException.Create('php_url_free');
-  if @php_url_parse = nil then raise EPHP4DelphiException.Create('php_url_parse');
-  if @php_url_decode = nil then raise EPHP4DelphiException.Create('php_url_decode');
-  if @php_raw_url_decode = nil then raise EPHP4DelphiException.Create('php_raw_url_decode');
-  if @php_url_encode = nil then raise EPHP4DelphiException.Create('php_url_encode');
-  if @php_raw_url_encode = nil then raise EPHP4DelphiException.Create('php_raw_url_encode');
-
-  {$IFDEF PHP5}
-  if @php_register_extensions = nil then raise EPHP4DelphiException.Create('php_register_extensions');
-  {$ELSE}
-  if @php_startup_extensions = nil then raise EPHP4DelphiException.Create('php_startup_extensions');
-  {$ENDIF}
-  
-  if @php_error_docref0 = nil then raise EPHP4DelphiException.Create('php_error_docref0');
-  if @php_error_docref = nil then raise EPHP4DelphiException.Create('php_error_docref');
-  if @php_error_docref1 = nil then raise EPHP4DelphiException.Create('php_error_docref1');
-  if @php_error_docref2 = nil then raise EPHP4DelphiException.Create('php_error_docref2');
-end;
-{$ENDIF}
-
 function GetPostVariables: pzval;
-var
- TSRMLS_D : pointer;
- CoreGlobals : Pphp_Core_Globals;
 begin
- TSRMLS_D := ts_resource_ex(0, nil);
- CoreGlobals := PG(TSRMLS_D);
- Result := CoreGlobals^.http_globals[0];
+ Result := GetPHPGlobals(ts_resource_ex(0, nil))^.http_globals[0];
 end;
 
 function GetGetVariables : pzval;
-var
- TSRMLS_D : pointer;
- CoreGlobals : Pphp_Core_Globals;
 begin
- TSRMLS_D := ts_resource_ex(0, nil);
- CoreGlobals := PG(TSRMLS_D);
- Result := CoreGlobals^.http_globals[1];
+ Result := GetPHPGlobals(ts_resource_ex(0, nil))^.http_globals[1];
 end;
 
 function GetServerVariables : pzval;
-var
- TSRMLS_D : pointer;
- CoreGlobals : Pphp_Core_Globals;
 begin
- TSRMLS_D := ts_resource_ex(0, nil);
- CoreGlobals := PG(TSRMLS_D);
- Result := CoreGlobals^.http_globals[3];
+ Result := GetPHPGlobals(ts_resource_ex(0, nil))^.http_globals[3];
 end;
 
 function GetEnvVariables : pzval;
-var
- TSRMLS_D : pointer;
- CoreGlobals : Pphp_Core_Globals;
 begin
- TSRMLS_D := ts_resource_ex(0, nil);
- CoreGlobals := PG(TSRMLS_D);
- Result := CoreGlobals^.http_globals[4];
+ Result := GetPHPGlobals(ts_resource_ex(0, nil))^.http_globals[4];
 end;
 
 function GetFilesVariables : pzval;
-var
- TSRMLS_D : pointer;
- CoreGlobals : Pphp_Core_Globals;
 begin
- TSRMLS_D := ts_resource_ex(0, nil);
- CoreGlobals := PG(TSRMLS_D);
- Result := CoreGlobals^.http_globals[5];
+ Result := GetPHPGlobals(ts_resource_ex(0, nil))^.http_globals[5];
 end;
 
 
 function FloatToValue(Value: Extended): zend_ustr;
 var
-  {$IFDEF VERSION12}
-  c: WideChar;
-  {$ELSE}
-  c: AnsiChar;
-  {$ENDIF}
+  c: CharPtr;
 begin
   c := FormatSettings.DecimalSeparator;
   try
@@ -872,11 +684,7 @@ function FloatToValue(Value: Extended): zend_ustr;
 
 function ValueToFloat(Value : zend_ustr) : extended;
 var
-  {$IFDEF VERSION12}
-  c: WideChar;
-  {$ELSE}
-  c : AnsiChar;
-  {$ENDIF}
+  c: CharPtr;
 begin
   c := FormatSettings.DecimalSeparator;
   try
diff --git a/Source/PHPCommon.pas b/Source/PHPCommon.pas
index d594f7c..04369c1 100644
--- a/Source/PHPCommon.pas
+++ b/Source/PHPCommon.pas
@@ -272,11 +272,7 @@ function TPHPVariable.GetAsFloat: double;
 
 function TPHPVariable.GetAsInteger: integer;
 var
- {$IFDEF VERSION12}
- c : WideChar;
- {$ELSE}
- c : AnsiChar;
- {$ENDIF}
+ c: CharPtr;
 begin
   c := FormatSettings.DecimalSeparator;
   try
@@ -310,11 +306,7 @@ procedure TPHPVariable.SetAsFloat(const Value: double);
 
 procedure TPHPVariable.SetAsInteger(const Value: integer);
 var
- {$IFDEF VERSION12}
- c : WideChar;
- {$ELSE}
- c : AnsiChar;
- {$ENDIF}
+ c: CharPtr;
 begin
   c := FormatSettings.DecimalSeparator;
   try
diff --git a/Source/PHPFunctions.pas b/Source/PHPFunctions.pas
index 8875c7f..80ceda8 100644
--- a/Source/PHPFunctions.pas
+++ b/Source/PHPFunctions.pas
@@ -168,7 +168,9 @@ function ZendTypeToString(_type : integer) : string;
   IS_BOOL              : Result := 'IS_BOOL';
   IS_RESOURCE          : Result := 'IS_RESOURCE';
   IS_CONSTANT          : Result := 'IS_CONSTANT';
+  {$IFNDEF PHP7}
   IS_CONSTANT_ARRAY    : Result := 'IS_CONSTANT_ARRAY';
+  {$ENDIF}
   end;
 end;
 
@@ -389,7 +391,7 @@ procedure TFunctionParams.SetItem(Index: Integer; Value: TFunctionParam);
 
 procedure TFunctionParams.SetItemName(Item: TCollectionItem);
 var
-  I, J: Integer;
+  J: Integer;
   CurItem: TFunctionParam;
 begin
   J := 1;
diff --git a/Source/PHPTypes.pas b/Source/PHPTypes.pas
index 3d00f20..9fa22fe 100644
--- a/Source/PHPTypes.pas
+++ b/Source/PHPTypes.pas
@@ -18,13 +18,8 @@ interface
 uses
   {$IFNDEF FPC} Windows{$ELSE} LCLType{$ENDIF}, {$IFDEF PHP7} hzend_types {$ELSE} ZendTypes {$ENDIF};
 
-{$IFDEF PHP4}
 const
-  phpVersion = 4;
-{$ELSE}
-const
-  phpVersion = 5;
-{$ENDIF}
+  phpVersion = {$IFDEF PHP7}7{$ELSE}5{$ENDIF};
     
 const
   TRequestName : array [0..3] of zend_ustr =
diff --git a/Source/ZENDAPI.pas b/Source/ZENDAPI.pas
index accf608..7417590 100644
--- a/Source/ZENDAPI.pas
+++ b/Source/ZENDAPI.pas
@@ -20,6 +20,7 @@
 interface
 
 uses
+VCL.Dialogs,
   {$IFNDEF FPC} Windows{$ELSE} LCLType,LCLIntf,dynlibs,libc{$ENDIF}, SysUtils,
   {$IFDEF PHP7} hzend_types, {$ElSE} ZendTypes, {$ENDIF} Variants,
   PHPTypes;
@@ -79,7 +80,15 @@   align_test = record
 {$IFNDEF PHP_UNICE}
 function AnsiFormat(const Format: AnsiString; const Args: array of const): AnsiString;
 {$ENDIF}
+function Lfunc(var Func: Pointer; addr: LPCWSTR): Bool;
 function  LoadZEND(const DllFilename: zend_ustr = PHPWin) : boolean;
+function __asm_fetchval
+{$IFDEF CPUX64}
+(val_id: int64; tsrmls_dc_p: pointer)
+{$ELSE}
+(val_id: integer; tsrmls_dc_p: pointer)
+{$ENDIF}
+: pointer;
 
 procedure UnloadZEND;
 function  ZENDLoaded: boolean;
@@ -138,14 +147,7 @@ function STR_EMPTY_ALLOC : zend_pchar;
   zend_disable_function : function(function_name : zend_pchar; function_name_length : uint; TSRMLS_DC : pointer) : integer; cdecl;
   zend_disable_class   : function(class_name : zend_pchar; class_name_length : uint; TSRMLS_DC : pointer) : integer; cdecl;
 
-
-{$IFDEF PHP4}
-  zend_hash_add_or_update  : function(ht: PHashTable; arKey: zend_pchar;
-    nKeyLength: uint; pData: Pointer; nDataSize: uint; pDest: Pointer;
-    flag: Integer): Integer; cdecl;
-{$ELSE}
 {$IFNDEF PHP7}
-var
  _zend_hash_add_or_update : function (ht : {$IFDEF PHP7}Pzend_array{$ELSE}PHashTable{$ENDIF}; arKey : zend_pchar;
     nKeyLength : uint; pData : pointer; nDataSize : uint; pDes : pointer;
     flag : integer; __zend_filename: zend_pchar; __zend_lineno: uint) : integer; cdecl;
@@ -154,33 +156,10 @@ function STR_EMPTY_ALLOC : zend_pchar;
     nKeyLength : uint; pData : {$IFDEF PHP7}pzval{$ELSE}pointer{$ENDIF}; nDataSize : uint; pDes : pointer;
     flag : integer) : integer; cdecl;
 
-{$ENDIF}
 
 function zend_hash_add(ht : {$IFDEF PHP7}Pzend_array{$ELSE}PHashTable{$ENDIF}; arKey : zend_pchar; nKeyLength : uint; pData : pointer; nDataSize : uint; pDest : pointer) : integer; cdecl;
 
 var
- {$IFDEF PHP4}
-  zend_hash_init                                  : function(ht: PHashTable; nSize: uint;
-    pHashFunction: pointer; pDestructor: pointer;
-    persistent: Integer): Integer; cdecl;
-
-  zend_hash_init_ex                               : function(ht: PHashTable; nSize: uint;
-    pHashFunction: pointer; pDestructor: pointer;
-    persistent: Integer; bApplyProtection: boolean): Integer; cdecl;
-
-
-  zend_hash_quick_add_or_update                   : function(ht: PHashTable; arKey: zend_pchar;
-    nKeyLength: uint; h: ulong; pData: Pointer; nDataSize: uint;
-    pDest: Pointer; flag: Integer): Integer; cdecl;
-
-  zend_hash_index_update_or_next_insert           : function(ht: PHashTable; h: ulong;
-    pData: Pointer; nDataSize: uint; pDest: Pointer; flag: Integer): Integer; cdecl;
-
-  zend_hash_merge                                 : procedure(target: PHashTable; source: PHashTable;
-    pCopyConstructor: pointer; tmp: Pointer; size: uint; overwrite: Integer); cdecl;
-
- {$ELSE}
-
  _zend_hash_init : function (ht : {$IFDEF PHP7}Pzend_array{$ELSE}PHashTable{$ENDIF}; nSize : uint;
    pHashFunction : pointer; pDestructor : pointer; persistent: zend_bool;
    __zend_filename: zend_pchar; __zend_lineno: uint) : integer; cdecl;
@@ -193,8 +172,6 @@ function zend_hash_add(ht : {$IFDEF PHP7}Pzend_array{$ELSE}PHashTable{$ENDIF}; a
  function zend_hash_init_ex (ht : {$IFDEF PHP7}Pzend_array{$ELSE}PHashTable{$ENDIF};  nSize : uint; pHashFunction : pointer;
  pDestructor : pointer;  persistent : zend_bool;  bApplyProtection : zend_bool): integer; cdecl;
 
-
-{$ENDIF}
  {$IFDEF PHP7}
  function zend_hash_num_elements(ht: Pzend_array): integer;
  function  add_char_to_string  (_result: Pzval; op1: Pzval; op2: Pzval): Integer;
@@ -313,25 +290,31 @@ function zend_hash_add(ht : {$IFDEF PHP7}Pzend_array{$ELSE}PHashTable{$ENDIF}; a
 function zend_hash_get_current_data(ht: {$IFDEF PHP7} Pzend_array {$ELSE} PHashTable{$ENDIF}; pData: Pointer): Integer; cdecl;
 procedure zend_hash_internal_pointer_reset(ht: {$IFDEF PHP7} Pzend_array {$ELSE} PHashTable{$ENDIF}); cdecl;
 
-
+// zend_constants.h
 var
   zend_get_constant                               : function(name: zend_pchar; name_len: uint; var result: zval;
-    TSRMLS_DC: Pointer): Integer; cdecl;
+    TSRMLS_DC: Pointer): IntPtr; cdecl;
+
+  zend_register_null_constant                     : procedure(name: zend_pchar; name_len: uint;
+    flags: IntPtr; module_number: IntPtr; TSRMLS_DC: Pointer); cdecl;
+
+  zend_register_bool_constant                     : procedure(name: zend_pchar; name_len: uint;
+    bval: zend_bool; flags: IntPtr; module_number: IntPtr; TSRMLS_DC: Pointer); cdecl;
 
   zend_register_long_constant                     : procedure(name: zend_pchar; name_len: uint;
-    lval: Longint; flags: Integer; module_number: Integer; TSRMLS_DC: Pointer); cdecl;
+    lval: Longint; flags: IntPtr; module_number: IntPtr; TSRMLS_DC: Pointer); cdecl;
 
-  zend_register_double_constant                   : procedure(name: zend_pchar; name_len: uint; dval: Double; flags: Integer; module_number: Integer;
-    TSRMLS_DC: Pointer); cdecl;
+  zend_register_double_constant                   : procedure(name: zend_pchar; name_len: uint;
+   dval: Double; flags: IntPtr; module_number: IntPtr; TSRMLS_DC: Pointer); cdecl;
 
-  zend_register_string_constant                   : procedure(name: zend_pchar; name_len: uint; strval: zend_pchar; flags: Integer; module_number: Integer;
-    TSRMLS_DC: Pointer); cdecl;
+  zend_register_string_constant                   : procedure(name: zend_pchar; name_len: uint;
+  strval: zend_pchar; flags: IntPtr; module_number: IntPtr; TSRMLS_DC: Pointer); cdecl;
 
   zend_register_stringl_constant                  : procedure(name: zend_pchar; name_len: uint;
-    strval: zend_pchar; strlen: uint; flags: Integer; module_number: Integer;
+    strval: zend_pchar; strlen: uint; flags: IntPtr; module_number: IntPtr;
     TSRMLS_DC: Pointer); cdecl;
 
-  zend_register_constant                          : function(var c: zend_constant; TSRMLS_DC: Pointer): Integer; cdecl;
+  zend_register_constant                          : function(var c: zend_constant; TSRMLS_DC: Pointer): IntPtr; cdecl;
 
   zend_register_auto_global :
   {$IFDEF PHP700}
@@ -358,26 +341,21 @@ procedure REGISTER_MAIN_STRINGL_CONSTANT(name: zend_pchar; str: zend_pchar; len:
   // deallocates all occurrences of a given id
   ts_free_id                                      : procedure(id: ts_rsrc_id); cdecl;
 
-  tsrm_shutdown                                   : procedure(); cdecl;
+  tsrm_shutdown                                   : procedure; cdecl;
   ts_resource_ex                                  : function(id: integer; p: pointer): pointer; cdecl;
   ts_free_thread                                  : procedure; cdecl;
 
   zend_error                                      : procedure(ErrType: integer; ErrText: zend_pchar); cdecl;
   zend_error_cb                                   : procedure; cdecl;
 
-  zend_eval_string                                : function(str: zend_pchar; val: pointer; strname: zend_pchar; tsrm: pointer): integer; cdecl;
+  zend_eval_string                                : function(str: zend_pchar; ret_val: pointer; strname: zend_pchar; tsrm: pointer): integer; cdecl;
+  zend_eval_string_ex                             : function(str:PAnsiChar;  retval_ptr:pzval; string_name:PAnsiChar; handle_exceptions:longint):longint; cdecl;
   zend_make_compiled_string_description           : function(a: zend_pchar; tsrm: pointer): zend_pchar; cdecl;
-
-  {$IFDEF PHP4}
-  _zval_copy_ctor                                 : function(val: pzval; __zend_filename: zend_pchar; __zend_lineno: uint): integer; cdecl;
-  _zval_dtor                                      : procedure(val: pzval; __zend_filename: zend_pchar; __zend_lineno: uint); cdecl;
-  {$ELSE}
   _zval_copy_ctor_func                            : procedure(val: pzval; __zend_filename: zend_pchar; __zend_lineno: uint); cdecl;
   _zval_dtor_func                                 : procedure(val: pzval; __zend_filename: zend_pchar; __zend_lineno: uint); cdecl;
   _zval_ptr_dtor: procedure(val: ppzval;  __zend_filename: zend_pchar); cdecl;
   procedure  _zval_copy_ctor (val: pzval; __zend_filename: zend_pchar; __zend_lineno: uint); cdecl;
   procedure _zval_dtor(val: pzval; __zend_filename: zend_pchar; __zend_lineno: uint); cdecl;
-  {$ENDIF}
 
 var
   zend_print_variable                             : function(val: pzval): integer; cdecl;
@@ -386,11 +364,6 @@ procedure REGISTER_MAIN_STRINGL_CONSTANT(name: zend_pchar; str: zend_pchar; len:
   zend_get_compiled_filename : function(TSRMLS_DC: Pointer): zend_pchar; cdecl;
   zend_get_compiled_lineno   : function(TSRMLS_DC: Pointer): integer; cdecl;
 
-
-{$IFDEF PHP4}
-function zval_copy_ctor(val : pzval) : integer;
-{$ENDIF}
-
 function ts_resource(id : integer) : pointer;
 function tsrmls_fetch : pointer;
 
@@ -556,17 +529,17 @@ procedure convert_to_string(op: pzval);
   zend_html_putc                                  : procedure(c: zend_uchar); cdecl;
 
   zend_html_puts                                  : procedure(s: zend_pchar; len: uint; TSRMLS_DC: Pointer); cdecl;
+
+  	zend_parse_method_parameters:function(num_args:longint; TSRMLS_DC:Pointer; this_ptr:Pzval; type_spec:PAnsiChar):longint; cdecl varargs;
+
+	zend_parse_method_parameters_ex:function(flags:longint; num_args:longint; TSRMLS_DC:Pointer; this_ptr:Pzval; type_spec:PAnsiChar):longint; cdecl varargs;
+
   {$IFDEF PHP7}
   zend_parse_parameters_throw                     : function(num_args:longint; type_spec:PAnsiChar):longint; cdecl varargs;
   {$ELSE}
   zend_indent                                     : procedure; cdecl;
   {$ENDIF}
-  ZendGetParameters                               :
-  {$IFDEF PHP7}
-    function(ht:longint; param_count:longint):longint; cdecl varargs;
-  {$ELSE}
-    function: integer; cdecl;
-  {$ENDIF}
+  Zend_Get_Parameters                               : function(ht:longint; param_count:longint):longint; cdecl varargs;
   zend_get_params_ex :
   {$IFDEF PHP7}
   function(param_count:longint):longint; cdecl varargs;
@@ -577,15 +550,11 @@ procedure convert_to_string(op: pzval);
    ZvalGetArgs: function(Count: Integer; Args: ppzval): Integer;cdecl varargs;
 	_zend_get_parameters_array_ex:function(param_count:longint; argument_array:Pzval):longint; cdecl;
   {$ELSE}
+  _zend_get_parameters_array: function(ht: integer; param_count:longint; argument_array: ppzval; TSRMLS_DC: pointer): integer; cdecl;
   _zend_get_parameters_array_ex : function(param_count: integer; argument_array:
   pppzval; TSRMLS_CC: pointer): integer; cdecl;
   {$ENDIF}
-function zend_get_parameters_ex(number: integer; var Params: pzval_array): integer;
 function zend_get_parameters_my(number: integer; var Params: pzval_array; TSRMLS_DC: Pointer): integer;
-{$IFNDEF PHP7}
-function zend_get_parameters(ht: integer; param_count: integer; Params: array of
-ppzval): integer;
-{$ENDIF}
 
 
 procedure dispose_pzval_array(Params: pzval_array);
@@ -614,21 +583,8 @@ procedure dispose_pzval_array(Params: pzval_array);
 
   zend_wrong_param_count                          : procedure(TSRMLS_D: pointer); cdecl;
   _zend_hash_quick_add_or_update:function(ht: {$IFDEF PHP7}Pzend_array{$ELSE}PHashTable{$ENDIF}; arKey: zend_pchar; nKeyLength: uint; h: uint; out pData: pzval; nDataSize: uint; pDest: PPointer; flag: Integer) : Integer; cdecl;
-  {$IFDEF PHP4}
-  add_property_long_ex                            : function(arg: pzval; key: zend_pchar; key_len: uint; l: longint): integer; cdecl;
-  {$ELSE}
   add_property_long_ex                            : function(arg: pzval; key: zend_pchar; key_len: uint; l: longint; TSRMLS_DC : pointer): integer; cdecl;
-  {$ENDIF}
 
-  {$IFDEF PHP4}
-  add_property_null_ex                            : function(arg: pzval; key: zend_pchar; key_len: uint): integer; cdecl;
-  add_property_bool_ex                            : function(arg: pzval; key: zend_pchar; key_len: uint; b: integer): integer; cdecl;
-  add_property_resource_ex                        : function(arg: pzval; key: zend_pchar; key_len: uint; r: integer): integer; cdecl;
-  add_property_double_ex                          : function(arg: pzval; key: zend_pchar; key_len: uint; d: double): integer; cdecl;
-  add_property_string_ex                          : function(arg: pzval; key: zend_pchar; key_len: uint; str: zend_pchar; duplicate: integer): integer; cdecl;
-  add_property_stringl_ex                         : function(arg: pzval; key: zend_pchar; key_len: uint; str: zend_pchar; len: uint; duplicate: integer): integer; cdecl;
-  add_property_zval_ex                            : function(arg: pzval; key: zend_pchar; key_len: uint; value: pzval): integer; cdecl;
-  {$ELSE}
   add_property_null_ex                            : function(arg: pzval; key: zend_pchar; key_len: uint; TSRMLS_DC: Pointer): integer; cdecl;
   add_property_bool_ex                            : function(arg: pzval; key: zend_pchar; key_len: uint; b: integer; TSRMLS_DC: Pointer): integer; cdecl;
   add_property_resource_ex                        : function(arg: pzval; key: zend_pchar; key_len: uint; r: integer; TSRMLS_DC: Pointer): integer; cdecl;
@@ -636,9 +592,8 @@ procedure dispose_pzval_array(Params: pzval_array);
   add_property_string_ex                          : function(arg: pzval; key: zend_pchar; key_len: uint; str: zend_pchar; duplicate: integer; TSRMLS_DC: Pointer): integer; cdecl;
   add_property_stringl_ex                         : function(arg: pzval; key: zend_pchar; key_len: uint; str: zend_pchar; len: uint; duplicate: integer; TSRMLS_DC: Pointer): integer; cdecl;
   add_property_zval_ex                            : function(arg: pzval; key: zend_pchar; key_len: uint; value: pzval; TSRMLS_DC: Pointer): integer; cdecl;
-  {$ENDIF}
 
-  {$IFDEF P_CUT}
+  {$IFDEF CUTTED_PHP7dll}
   call_user_function : procedure(func:pzval; argv:pzval; argc:integer);cdecl;
   {$ELSE}
    call_user_function : function(function_table: PHashTable; object_pp: pzval;
@@ -651,17 +606,6 @@ procedure dispose_pzval_array(Params: pzval_array);
                          no_separation: zend_uint; symbol_table: PHashTable;
                           TSRMLS_DC: Pointer): integer; cdecl;
   {$ENDIF}
-                          {
-call_user_function_ex(HashTable *function_table,
-                      zval **object_pp,
-                      zval *function_name,
-                      zval **retval_ptr_ptr,
-                      zend_uint param_count,
-                      zval **params[],
-                      int no_separation,
-                      HashTable *symbol_table
-                      TSRMLS_DC);
-}
 
 
   add_assoc_long_ex                               : function(arg: pzval; key: zend_pchar; key_len: uint; n: longint): integer; cdecl;
@@ -701,17 +645,9 @@ procedure dispose_pzval_array(Params: pzval_array);
 
   _array_init                                     : function(arg: pzval; __zend_filename: zend_pchar; __zend_lineno: uint): integer; cdecl;
 
-  {$IFDEF PHP4}
-  _object_init                                    : function(arg: pzval; __zend_filename: zend_pchar; __zend_lineno: uint; TSRMLS_DC: pointer): integer; cdecl;
-  {$ELSE}
   _object_init                                    : function(arg: pzval;TSRMLS_DC: pointer): integer; cdecl;
-  {$ENDIF}
 
-  {$IFDEF PHP4}
-  _object_init_ex                                 : function (arg: pzval; ce: pzend_class_entry; __zend_filename: zend_pchar; __zend_lineno: uint; TSRMLS_DC: pointer) : integer; cdecl;
-  {$ELSE}
   _object_init_ex                                 : function (arg: pzval; ce: pzend_class_entry; __zend_lineno : integer; TSRMLS_DC : pointer) : integer; cdecl;
-  {$ENDIF}
 
   _object_and_properties_init                     : function(arg: pzval; ce: pointer; properties: phashtable; __zend_filename: zend_pchar; __zend_lineno: uint; TSRMLS_DC: pointer): integer; cdecl;
 
@@ -823,7 +759,11 @@ procedure ZVAL_STRINGLW(z: pzval; s: PWideChar; l: integer; duplicate: boolean);
 
 procedure INIT_CLASS_ENTRY(var class_container: Tzend_class_entry; class_name: zend_pchar; functions:
 {$IFDEF PHP7}HashTable{$ELSE}pointer{$ENDIF});
-
+procedure zend_copy_constant(c: zend_constant);
+{$IF defined(PHP540) or defined(PHP550) or defined(PHP560)}
+procedure zend_copy_constants(target: PHashTable; source: PHashTable); cdecl;
+procedure zend_class_add_ref(aclass: Ppzend_class_entry); cdecl;
+{$ENDIF}
 
 var
   get_zend_version           : function(): zend_pchar; cdecl;
@@ -833,33 +773,26 @@ procedure INIT_CLASS_ENTRY(var class_container: Tzend_class_entry; class_name: z
   zend_output_debug_string   : procedure(trigger_break: boolean; Msg: zend_pchar); cdecl;
 
 {$IFDEF PHP5}
+  {$IF not defined(PHP540) and not defined(PHP550) and not defined(PHP560)}
   zend_copy_constants: procedure(target: PHashTable; source: PHashTable); cdecl;
+  {$ENDIF}
   zend_objects_new : function (_object : pointer; class_type : pointer; TSRMLS_DC : pointer) : {$IFDEF PHP7}zend_object{$ELSE}_zend_object_value{$ENDIF}; cdecl;
   zend_objects_clone_obj: function(_object: pzval; TSRMLS_DC : pointer): {$IFDEF PHP7}zend_object{$ELSE}_zend_object_value{$ENDIF}; cdecl;
   zend_objects_store_add_ref: procedure (_object : pzval; TSRMLS_DC : pointer); cdecl;
   zend_objects_store_del_ref: procedure (_object : pzval; TSRMLS_DC : pointer); cdecl;
 
   function_add_ref: procedure (func: {$IFDEF PHP7}Pzend_function{$ELSE}PZendFunction{$ENDIF}); cdecl;
-
+  {$IF not defined(PHP540) and not defined(PHP550) and not defined(PHP560)}
   zend_class_add_ref: procedure(aclass: Ppzend_class_entry); cdecl;
-
+  {$ENDIF}
 
 {$ENDIF}
 
-
+{$IFNDEF COMPILER_VC9}
 const
   MSCRT = 'msvcrt.dll';
 
 //Microsoft C++ functions
-
-{$IFDEF PHP4}
-function  pipe(phandles : pointer; psize : uint; textmode : integer) : integer; cdecl; external MSCRT name '_pipe';
-procedure close(AHandle : THandle); cdecl; external MSCRT name '_close';
-function  _write(AHandle : integer; ABuffer : pointer; count : uint) : integer; cdecl; external MSCRT name '_write';
-function  setjmp(buf : jump_buf) : integer; cdecl; external  MSCRT name '_setjmp3';
-{$ENDIF}
-
-{$IFNDEF COMPILER_VC9}
 function  strdup(strSource : zend_pchar) : zend_pchar; cdecl; external MSCRT name '_strdup';
 {$ELSE}
 function  DupStr(strSource : zend_pchar) : zend_pchar; cdecl;
@@ -872,9 +805,6 @@ procedure ALLOC_ZVAL(out Result: pzval); overload;
 procedure INIT_PZVAL(p: pzval);
 function MAKE_STD_ZVAL: pzval; overload;
 procedure MAKE_STD_ZVAL(out Result: pzval); overload;
-{$IFNDEF QUIET_LOAD}
-procedure CheckZendErrors;
-{$ENDIF}
 
 var
   PHPLib : THandle = 0;
@@ -899,18 +829,22 @@ function zend_unregister_functions(functions : {$IFDEF PHP7}P_zend_function_entr
   zend_is_true : function(z : pzval) : integer; cdecl;
 
 function object_init(arg: pzval; ce: pzend_class_entry; TSRMLS_DC : pointer) : integer; cdecl; assembler;
-
 function Z_LVAL(z : Pzval) : longint;
 function Z_BVAL(z : Pzval) : boolean;
 function Z_DVAL(z : Pzval) : double;
 function Z_STRVAL(z : Pzval) : zend_ustr;
 function Z_STRUVAL(z : PZval): UTF8String;
 function Z_STRWVAL(z : pzval) : String;
+function Z_CHAR(z: PZval) : zend_uchar;
+function Z_WCHAR(z: PZval) : WideChar;
+function Z_ACHAR(z: PZVAL): AnsiChar;
+function Z_UCHAR(z: PZVAL): UTF8Char;
+
 function Z_STRLEN(z : Pzval) : longint;
 function Z_ARRVAL(z : Pzval ) : PHashTable;
 function Z_OBJ_HANDLE(z :Pzval) : {$IFDEF PHP7} P_zend_object_handlers {$ELSE} zend_object_handle{$ENDIF};
 function Z_OBJ_HT(z : Pzval) : {$IFDEF PHP7}P_zend_object_handlers{$ELSE}pzend_object_handlers{$ENDIF};
-function Z_OBJPROP(z : Pzval) : PHashTable;
+function Z_OBJPROP(z : Pzval;TSRMLS_DC:pointer=nil) : PHashTable;
 function Z_VARREC(z: pzval): TVarRec;
 
  procedure zend_addref_p(z: pzval); cdecl;
@@ -1580,7 +1514,7 @@ function toWChar(s: zend_pchar): PWideChar;
 function HashToVarArray(const Value:{$IFDEF PHP7}Pzend_array{$ELSE}PHashTable{$ENDIF}): Variant;
   Var
   Len,I: Integer;
-  tmp : pppzval;
+  {$IFDEF PHP7}tmp : pzval;{$ELSE}tmp : pppzval;{$ENDIF}
 begin
  len := zend_hash_num_elements(Value);
  Result := VarArrayCreate([0, len - 1], varVariant);
@@ -1611,21 +1545,30 @@ function ZendToVariant(const Value: pzval;
   S: String;
 begin
  case {$IFDEF PHP7} Value^.u1.v._type {$ELSE}Value^._type{$ENDIF} of
- 0: Result := Null;
- 1: Result := Value^.value.lval;
- 2: Result := Value^.value.dval;
- 3: Result := boolean(Value^.value.lval);
- 4: Result := HashToVarArray(Value^.value.ht);
- 5:
+ 0: Result := Null;                           //Null
+ 1: Result := Value^.value.lval;              //LongInt -> Integer
+ 2: Result := Value^.value.dval;              //Double
+ 3: Result := boolean(Value^.value.lval);     //Boolean
+ {$IFDEF PHP7}
+ 4: Result := HashToVarArray(Value^.value.arr);//Array
+ {$ELSE}
+ 4: Result := HashToVarArray(Value^.value.ht);//Array
+ {$ENDIF}
+ 5:                                           //Object
   if Assigned(cobj) then
     Result := cobj(Value)
   else
-    Result := Null;
- 7: Result := Value^.value.lval;
+    Result := Null;                           //String
  6: begin S := Value^.value.str.val; Result := S; end;
+ 7: Result := Value^.value.lval;              //Resource
+                                              //Constant
  8: begin S := Value^.value.str.val; Result := S; end;
- 9: Result := HashToVarArray(Value^.value.ht)
- else Result := Null;
+ {$IFDEF PHP7}
+  9: Result := HashToVarArray(Value^.value.arr) //Constant Array
+ {$ELSE}
+ 9: Result := HashToVarArray(Value^.value.ht) //Constant Array
+ {$ENDIF}
+ else Result := Null;                         //Unknown/undefined
  end;
 end;
 
@@ -2255,15 +2198,46 @@ function ZENDLoaded: boolean;
 procedure UnloadZEND;
 var
  H : THandle;
+ t: Integer;
 begin
-  H := InterlockedExchange(Integer(PHPLib), 0);
+  t := Integer(PHPLib);
+  H := InterlockedExchange(t, 0);
   if H > 0 then
   begin
     FreeLibrary(H);
   end;
 end;
+function Lfunc(var Func: Pointer; addr: LPCWSTR): BOOL;
+begin
+  Result := True;
+  Func := GetProcAddress(PHPLib, addr);
+  if Func = nil then
+  begin
+    {$IFNDEF QUIET_LOAD}
+    raise EPHP4DelphiException.Create(addr);
+    {$ENDIF}
+    Result := False;
+  end;
+end;
+procedure zend_copy_constant(c: zend_constant);
+begin
+  c.name := zend_strndup(c.name, c.name_len - 1);
+	if (c.flags and CONST_PERSISTENT) = 0 then
+    _zval_copy_ctor_func(@c.value, '', 0);
+end;
+{$IF defined(PHP540) or defined(PHP550) or defined(PHP560)}
 
+procedure zend_copy_constants(target: PHashTable;source: PHashTable);
+var tmp: zend_constant;
+begin
+	zend_hash_copy(target, source, @zend_copy_constant, @tmp, sizeof(zend_constant));
+end;
 
+procedure zend_class_add_ref(aclass: Ppzend_class_entry); cdecl;
+begin
+  Inc(aclass^.refcount,1);
+end;
+{$ENDIF}
 function LoadZEND(const DllFilename: zend_ustr = PHPWin) : boolean;
 var
   WriteFuncPtr  : pointer;
@@ -2271,7 +2245,7 @@ function LoadZEND(const DllFilename: zend_ustr = PHPWin) : boolean;
  {$IFDEF QUIET_LOAD}
   Result := false;
  {$ENDIF}
-  PHPLib := {$IFDEF PHP_UNICE}LoadLibrary( PWideChar(WideString(DllFilename)) ){$ELSE}LoadLibraryA(zend_pchar(DllFileName)){$ENDIF};
+  PHPLib := LoadLibrary( PWideChar(WideString(DllFilename)) );
 
 {$IFNDEF QUIET_LOAD}
   if PHPLib = 0 then
@@ -2284,53 +2258,57 @@ function LoadZEND(const DllFilename: zend_ustr = PHPWin) : boolean;
 {$ENDIF}
 
  {$IFDEF PHP5}
-   zend_copy_constants := GetProcAddress(PHPLib, 'zend_copy_constants');
-   zend_objects_new := GetProcAddress(PHPLib, 'zend_objects_new');
-   zend_objects_clone_obj := GetProcAddress(PHPLib, 'zend_objects_clone_obj');
-   function_add_ref := GetProcAddress(PHPLib, 'function_add_ref');
-   zend_class_add_ref := GetProcAddress(PHPLib, 'zend_class_add_ref');
-
-   zend_objects_store_add_ref := GetProcAddress(PHPLib, 'zend_objects_store_add_ref');
-   zend_objects_store_del_ref := GetProcAddress(PHPLib, 'zend_objects_store_del_ref');
-
-   zend_get_std_object_handlers := GetProcAddress(PHPLib, 'zend_get_std_object_handlers');
-   zend_objects_get_address := GetProcAddress(PHPLib, 'zend_objects_get_address');
-   zend_is_true := GetProcAddress(PHPLib, 'zend_is_true');
+ {$IF not defined(PHP540) and not defined(PHP550) and not defined(PHP560)}
+   LFunc(@zend_copy_constants, 'zend_copy_constants');
+ {$ENDIF}
+   LFunc(@zend_objects_new, 'zend_objects_new');
+   LFunc(@zend_objects_clone_obj, 'zend_objects_clone_obj');
+   LFunc(@function_add_ref, 'function_add_ref');
+ {$IF not defined(PHP540) and not defined(PHP550) and not defined(PHP560)}
+   LFunc(@zend_class_add_ref, 'zend_class_add_ref');
+ {$ENDIF}
+
+   LFunc(@zend_objects_store_add_ref, 'zend_objects_store_add_ref');
+   LFunc(@zend_objects_store_del_ref, 'zend_objects_store_del_ref');
+
+   LFunc(@zend_get_std_object_handlers, 'zend_get_std_object_handlers');
+   LFunc(@zend_objects_get_address, 'zend_objects_get_address');
+   LFunc(@zend_is_true, 'zend_is_true');
 {$ENDIF}
 
-  _zend_bailout := GetProcAddress(PHPLib, '_zend_bailout');
+  LFunc(@_zend_bailout, '_zend_bailout');
 
-  zend_disable_function := GetProcAddress(PHPLib, 'zend_disable_function');
-  zend_disable_class := GetProcAddress(PHPLib, 'zend_disable_class');
-  zend_register_list_destructors_ex   := GetProcAddress(PHPLib, 'zend_register_list_destructors_ex');
-  zend_register_resource :=           GetProcAddress(PHPLib, 'zend_register_resource');
-  zend_fetch_resource :=              GetProcAddress(PHPLib, 'zend_fetch_resource');
-  zend_list_insert :=                 GetProcAddress(PHPLib, 'zend_list_insert');
+  LFunc(@zend_disable_function, 'zend_disable_function');
+  LFunc(@zend_disable_class, 'zend_disable_class');
+  LFunc(@zend_register_list_destructors_ex, 'zend_register_list_destructors_ex');
+  LFunc(@zend_register_resource, 'zend_register_resource');
+  LFunc(@zend_fetch_resource, 'zend_fetch_resource');
+  LFunc(@zend_list_insert, 'zend_list_insert');
   {$IFNDEF PHP7}
-  _zend_list_addref :=                GetProcAddress(PHPLib, '_zend_list_addref');
-  _zend_list_delete :=                GetProcAddress(PHPLib, '_zend_list_delete');
-  _zend_list_find :=                  GetProcAddress(PHPLib, '_zend_list_find');
+  LFunc(@_zend_list_addref, '_zend_list_addref');
+  LFunc(@_zend_list_delete, '_zend_list_delete');
+  LFunc(@_zend_list_find, '_zend_list_find');
   {$ENDIF}
-  zend_rsrc_list_get_rsrc_type :=     GetProcAddress(PHPLib, 'zend_rsrc_list_get_rsrc_type');
-  zend_fetch_list_dtor_id :=          GetProcAddress(PHPLib, 'zend_fetch_list_dtor_id');
+  LFunc(@zend_rsrc_list_get_rsrc_type, 'zend_rsrc_list_get_rsrc_type');
+  LFunc(@zend_fetch_list_dtor_id, 'zend_fetch_list_dtor_id');
 
-  zend_get_compiled_filename := GetProcAddress(PHPLib, 'zend_get_compiled_filename');
+  LFunc(@zend_get_compiled_filename, 'zend_get_compiled_filename');
 
-  zend_get_compiled_lineno := GetProcAddress(PHPLib, 'zend_get_compiled_lineno');
+  LFunc(@zend_get_compiled_lineno, 'zend_get_compiled_lineno');
 
-  zend_ini_deactivate := GetProcAddress(PHPLib, 'zend_ini_deactivate');
+  LFunc(@zend_ini_deactivate, 'zend_ini_deactivate');
 
   // -- tsrm_startup
-  tsrm_startup := GetProcAddress(PHPLib, 'tsrm_startup');
+  LFunc(@tsrm_startup, 'tsrm_startup');
 
   // -- ts_allocate_id
-  ts_allocate_id := GetProcAddress(PHPLib, 'ts_allocate_id');
+  LFunc(@ts_allocate_id, 'ts_allocate_id');
 
   // -- ts_free_id
-  ts_free_id := GetProcAddress(PHPLib, 'ts_free_id');
+  LFunc(@ts_free_id, 'ts_free_id');
 
   // -- zend_strndup
-  zend_strndup := GetProcAddress(PHPLib,
+  LFunc(@zend_strndup,
   {$IFNDEF PHP7}
   'zend_strndup'
   {$ELSE}
@@ -2338,7 +2316,7 @@ function LoadZEND(const DllFilename: zend_ustr = PHPWin) : boolean;
   {$ENDIF});
 
   // -- _emalloc
-  _emalloc := GetProcAddress(PHPLib,
+  LFunc(@_emalloc,
   {$IFNDEF PHP7}
   '_emalloc'
   {$ELSE}
@@ -2347,7 +2325,7 @@ function LoadZEND(const DllFilename: zend_ustr = PHPWin) : boolean;
 
 
   // -- _efree
-  _efree := GetProcAddress(PHPLib,
+  LFunc(@_efree,
   {$IFNDEF PHP7}
   '_efree'
   {$ELSE}
@@ -2356,7 +2334,7 @@ function LoadZEND(const DllFilename: zend_ustr = PHPWin) : boolean;
 
 
   // -- _ecalloc
-  _ecalloc := GetProcAddress(PHPLib,
+  LFunc(@_ecalloc,
   {$IFNDEF PHP7}
   '_ecalloc'
   {$ELSE}
@@ -2365,7 +2343,7 @@ function LoadZEND(const DllFilename: zend_ustr = PHPWin) : boolean;
 
 
   // -- _erealloc
-  _erealloc := GetProcAddress(PHPLib,
+  LFunc(@_erealloc,
   {$IFNDEF PHP7}
   '_erealloc'
   {$else}
@@ -2374,7 +2352,7 @@ function LoadZEND(const DllFilename: zend_ustr = PHPWin) : boolean;
 
 
   // -- _estrdup
-  _estrdup := GetProcAddress(PHPLib,
+  LFunc(@_estrdup,
   {$IFNDEF PHP7}
   '_estrdup'
   {$ELSE}
@@ -2382,7 +2360,7 @@ function LoadZEND(const DllFilename: zend_ustr = PHPWin) : boolean;
   {$ENDIF});
 
   // -- _estrndup
-  _estrndup := GetProcAddress(PHPLib,
+  LFunc(@_estrndup,
   {$IFNDEF PHP7}
   '_estrndup'
   {$ELSE}
@@ -2390,7 +2368,7 @@ function LoadZEND(const DllFilename: zend_ustr = PHPWin) : boolean;
   {$ENDIF});
 
   // -- _estrndup  Unicode
-  _estrndupu := GetProcAddress(PHPLib,
+  LFunc(@_estrndupu,
   {$IFNDEF PHP7}
   '_estrndup'
   {$ELSE}
@@ -2398,657 +2376,634 @@ function LoadZEND(const DllFilename: zend_ustr = PHPWin) : boolean;
   {$ENDIF});
 
   // -- zend_set_memory_limit
-  zend_set_memory_limit := GetProcAddress(PHPLib, 'zend_set_memory_limit');
+  LFunc(@zend_set_memory_limit, 'zend_set_memory_limit');
 
   // -- start_memory_manager
-  start_memory_manager := GetProcAddress(PHPLib, 'start_memory_manager');
+  LFunc(@start_memory_manager, 'start_memory_manager');
 
   // -- shutdown_memory_manager
-  shutdown_memory_manager := GetProcAddress(PHPLib, 'shutdown_memory_manager');
-
-  {$IFDEF PHP4}
-  // -- zend_hash_init
-  zend_hash_init := GetProcAddress(PHPLib, 'zend_hash_init');
+  LFunc(@shutdown_memory_manager, 'shutdown_memory_manager');
 
-  // -- zend_hash_init_ex
-  zend_hash_init_ex := GetProcAddress(PHPLib, 'zend_hash_init_ex');
+  LFunc(@_zend_hash_init, '_zend_hash_init');
+  LFunc(@_zend_hash_init_ex, '_zend_hash_init_ex');
 
-  // -- zend_hash_quick_add_or_update
-  zend_hash_quick_add_or_update := GetProcAddress(PHPLib, 'zend_hash_quick_add_or_update');
-
-  // -- zend_hash_index_update_or_next_insert
-  zend_hash_index_update_or_next_insert := GetProcAddress(PHPLib, 'zend_hash_index_update_or_next_insert');
-
-  // -- zend_hash_merge
-  zend_hash_merge := GetProcAddress(PHPLib, 'zend_hash_merge');
-  {$ELSE}
-  _zend_hash_init := GetProcAddress(PHPLib, '_zend_hash_init');
-  _zend_hash_init_ex := GetProcAddress(PHPLib, '_zend_hash_init_ex');
-
-  {$ENDIF}
-
-  {$IFDEF PHP4}
   // -- zend_hash_add_or_update
-  zend_hash_add_or_update := GetProcAddress(PHPLib, 'zend_hash_add_or_update');
-  {$ELSE}
-  // -- zend_hash_add_or_update
-  _zend_hash_add_or_update := GetProcAddress(PHPLib,
+  LFunc(@_zend_hash_add_or_update,
   {$IFDEF PHP7}'_zend_hash_add_or_update@@16'{$ELSE}'_zend_hash_add_or_update'{$ENDIF});
-  {$ENDIF}
 
   // -- zend_hash_destroy
-  zend_hash_destroy := GetProcAddress(PHPLib, {$IFDEF PHP7}'zend_hash_destroy@@4'{$ELSE}'zend_hash_destroy'{$ENDIF});
+  LFunc(@zend_hash_destroy, {$IFDEF PHP7}'zend_hash_destroy@@4'{$ELSE}'zend_hash_destroy'{$ENDIF});
 
   // -- zend_hash_clean
-  zend_hash_clean := GetProcAddress(PHPLib, {$IFDEF PHP7}'zend_hash_clean@@4'{$ELSE}'zend_hash_clean'{$ENDIF});
+  LFunc(@zend_hash_clean, {$IFDEF PHP7}'zend_hash_clean@@4'{$ELSE}'zend_hash_clean'{$ENDIF});
 
   // -- zend_hash_add_empty_element
-  zend_hash_add_empty_element := GetProcAddress(PHPLib, {$IFDEF PHP7}'zend_hash_add_empty_element@@8'{$ELSE}'zend_hash_add_empty_element'{$ENDIF});
+  LFunc(@zend_hash_add_empty_element, {$IFDEF PHP7}'zend_hash_add_empty_element@@8'{$ELSE}'zend_hash_add_empty_element'{$ENDIF});
 
   // -- zend_hash_graceful_destroy
-  zend_hash_graceful_destroy := GetProcAddress(PHPLib, {$IFDEF PHP7}'zend_hash_graceful_destroy@@4'{$ELSE}'zend_hash_graceful_destroy'{$ENDIF});
+  LFunc(@zend_hash_graceful_destroy, {$IFDEF PHP7}'zend_hash_graceful_destroy@@4'{$ELSE}'zend_hash_graceful_destroy'{$ENDIF});
 
   // -- zend_hash_graceful_reverse_destroy
-  zend_hash_graceful_reverse_destroy := GetProcAddress(PHPLib, {$IFDEF PHP7}'zend_hash_graceful_reverse_destroy@@4'{$ELSE}'zend_hash_graceful_reverse_destroy'{$ENDIF});
+  LFunc(@zend_hash_graceful_reverse_destroy, {$IFDEF PHP7}'zend_hash_graceful_reverse_destroy@@4'{$ELSE}'zend_hash_graceful_reverse_destroy'{$ENDIF});
 
   // -- zend_hash_apply
-  zend_hash_apply := GetProcAddress(PHPLib, {$IFDEF PHP7}'zend_hash_apply@@8'{$ELSE}'zend_hash_apply'{$ENDIF});
+  LFunc(@zend_hash_apply, {$IFDEF PHP7}'zend_hash_apply@@8'{$ELSE}'zend_hash_apply'{$ENDIF});
 
   // -- zend_hash_apply_with_argument
-  zend_hash_apply_with_argument := GetProcAddress(PHPLib, {$IFDEF PHP7}'zend_hash_apply_with_argument@@12'{$ELSE}'zend_hash_apply_with_argument'{$ENDIF});
+  LFunc(@zend_hash_apply_with_argument, {$IFDEF PHP7}'zend_hash_apply_with_argument@@12'{$ELSE}'zend_hash_apply_with_argument'{$ENDIF});
 
   // -- zend_hash_reverse_apply
-  zend_hash_reverse_apply := GetProcAddress(PHPLib, {$IFDEF PHP7}'zend_hash_reverse_apply@@8'{$ELSE}'zend_hash_reverse_apply'{$ENDIF});
+  LFunc(@zend_hash_reverse_apply, {$IFDEF PHP7}'zend_hash_reverse_apply@@8'{$ELSE}'zend_hash_reverse_apply'{$ENDIF});
 
   // -- zend_hash_del_key_or_index
-  zend_hash_del_key_or_index := GetProcAddress(PHPLib, {$IFDEF PHP7}'zend_hash_del@@8'{$ELSE}'zend_hash_del_key_or_index'{$ENDIF});
+  LFunc(@zend_hash_del_key_or_index, {$IFDEF PHP7}'zend_hash_del@@8'{$ELSE}'zend_hash_del_key_or_index'{$ENDIF});
 
   // -- zend_get_hash_value
-  zend_get_hash_value := GetProcAddress(PHPLib,
+  LFunc(@zend_get_hash_value,
   {$IFDEF PHP560}'zend_hash_func'{$ELSE}'zend_get_hash_value'{$ENDIF});
 
   // -- zend_hash_find
-  zend_hash_find := GetProcAddress(PHPLib, {$IFDEF PHP7}'zend_hash_find@@8'{$ELSE}'zend_hash_find'{$ENDIF});
+  LFunc(@zend_hash_find, {$IFDEF PHP7}'zend_hash_find@@8'{$ELSE}'zend_hash_find'{$ENDIF});
 
   // -- zend_hash_quick_find
-  zend_hash_quick_find := GetProcAddress(PHPLib, {$IFDEF PHP7}'zend_hash_find@@8'{$ELSE}'zend_hash_quick_find'{$ENDIF});
+  LFunc(@zend_hash_quick_find, {$IFDEF PHP7}'zend_hash_find@@8'{$ELSE}'zend_hash_quick_find'{$ENDIF});
 
   // -- zend_hash_index_find
-  zend_hash_index_find := GetProcAddress(PHPLib, {$IFDEF PHP7}'zend_hash_index_find@@8'{$ELSE}'zend_hash_index_find'{$ENDIF});
+  LFunc(@zend_hash_index_find, {$IFDEF PHP7}'zend_hash_index_find@@8'{$ELSE}'zend_hash_index_find'{$ENDIF});
 
   // -- zend_hash_exists
-  zend_hash_exists := GetProcAddress(PHPLib, {$IFDEF PHP7}'zend_hash_exists@@8'{$ELSE}'zend_hash_exists'{$ENDIF});
+  LFunc(@zend_hash_exists, {$IFDEF PHP7}'zend_hash_exists@@8'{$ELSE}'zend_hash_exists'{$ENDIF});
 
   // -- zend_hash_index_exists
-  zend_hash_index_exists := GetProcAddress(PHPLib, {$IFDEF PHP7}'zend_hash_index_exists@@8'{$ELSE}'zend_hash_index_exists'{$ENDIF});
+  LFunc(@zend_hash_index_exists, {$IFDEF PHP7}'zend_hash_index_exists@@8'{$ELSE}'zend_hash_index_exists'{$ENDIF});
   {$IFDEF PHP7}
-  _zend_hash_add_or_update := GetProcAddress(PHPLib, '_zend_hash_add_or_update@@16');
-  _zend_hash_add := GetProcAddress(PHPLib, '_zend_hash_add@@12');
-  {$IFDEF P_CUT}
-  zend_hash_index_findZval := GetProcAddress(PHPLib,'zend_hash_index_findZval');
-  zend_symtable_findTest := GetProcAddress(PHPLib,'zend_symtable_findTest');
-  zend_hash_index_existsZval := GetProcAddress(PHPLib,'zend_hash_index_existsZval');
+  LFunc(@_zend_hash_add_or_update, '_zend_hash_add_or_update@@16');
+  LFunc(@_zend_hash_add, '_zend_hash_add@@12');
+  {$IFDEF CUTTED_PHP7dll}
+  LFunc(@zend_hash_index_findZval,'zend_hash_index_findZval');
+  LFunc(@zend_symtable_findTest,'zend_symtable_findTest');
+  LFunc(@zend_hash_index_existsZval,'zend_hash_index_existsZval');
   {$ENDIF}
   {$ELSE}
   // -- zend_hash_next_free_element
-  zend_hash_next_free_element := GetProcAddress(PHPLib, 'zend_hash_next_free_element');
+  LFunc(@zend_hash_next_free_element, 'zend_hash_next_free_element');
   {$ENDIF}
   // -- zend_hash_move_forward_ex
-  zend_hash_move_forward_ex := GetProcAddress(PHPLib, {$IFDEF PHP7}'zend_hash_move_forward_ex@@8'{$ELSE}'zend_hash_move_forward_ex'{$ENDIF});
+  LFunc(@zend_hash_move_forward_ex, {$IFDEF PHP7}'zend_hash_move_forward_ex@@8'{$ELSE}'zend_hash_move_forward_ex'{$ENDIF});
 
   // -- zend_hash_move_backwards_ex
-  zend_hash_move_backwards_ex := GetProcAddress(PHPLib, {$IFDEF PHP7}'zend_hash_move_backwards_ex@@8'{$ELSE}'zend_hash_move_backwards_ex'{$ENDIF});
+  LFunc(@zend_hash_move_backwards_ex, {$IFDEF PHP7}'zend_hash_move_backwards_ex@@8'{$ELSE}'zend_hash_move_backwards_ex'{$ENDIF});
 
   // -- zend_hash_get_current_key_ex
-  zend_hash_get_current_key_ex := GetProcAddress(PHPLib, {$IFDEF PHP7}'zend_hash_get_current_key_ex@@16'{$ELSE}'zend_hash_get_current_key_ex'{$ENDIF});
+  LFunc(@zend_hash_get_current_key_ex, {$IFDEF PHP7}'zend_hash_get_current_key_ex@@16'{$ELSE}'zend_hash_get_current_key_ex'{$ENDIF});
 
   // -- zend_hash_get_current_key_type_ex
-  zend_hash_get_current_key_type_ex := GetProcAddress(PHPLib, {$IFDEF PHP7}'zend_hash_get_current_key_type_ex@@8'{$ELSE}'zend_hash_get_current_key_type_ex'{$ENDIF});
+  LFunc(@zend_hash_get_current_key_type_ex, {$IFDEF PHP7}'zend_hash_get_current_key_type_ex@@8'{$ELSE}'zend_hash_get_current_key_type_ex'{$ENDIF});
 
   // -- zend_hash_get_current_data_ex
-  zend_hash_get_current_data_ex := GetProcAddress(PHPLib, {$IFDEF PHP7}'zend_hash_get_current_data_ex@@8'{$ELSE}'zend_hash_get_current_data_ex'{$ENDIF});
+  LFunc(@zend_hash_get_current_data_ex, {$IFDEF PHP7}'zend_hash_get_current_data_ex@@8'{$ELSE}'zend_hash_get_current_data_ex'{$ENDIF});
 
   // -- zend_hash_internal_pointer_reset_ex
-  zend_hash_internal_pointer_reset_ex := GetProcAddress(PHPLib, {$IFDEF PHP7}'zend_hash_internal_pointer_reset_ex@@8'{$ELSE}'zend_hash_internal_pointer_reset_ex'{$ENDIF});
+  LFunc(@zend_hash_internal_pointer_reset_ex, {$IFDEF PHP7}'zend_hash_internal_pointer_reset_ex@@8'{$ELSE}'zend_hash_internal_pointer_reset_ex'{$ENDIF});
 
   // -- zend_hash_internal_pointer_end_ex
-  zend_hash_internal_pointer_end_ex := GetProcAddress(PHPLib, {$IFDEF PHP7}'zend_hash_internal_pointer_end_ex@@8'{$ELSE}'zend_hash_internal_pointer_end_ex'{$ENDIF});
+  LFunc(@zend_hash_internal_pointer_end_ex, {$IFDEF PHP7}'zend_hash_internal_pointer_end_ex@@8'{$ELSE}'zend_hash_internal_pointer_end_ex'{$ENDIF});
 
   // -- zend_hash_copy
-  zend_hash_copy := GetProcAddress(PHPLib, {$IFDEF PHP7}'zend_hash_copy@@12'{$ELSE}'zend_hash_copy'{$ENDIF});
+  LFunc(@zend_hash_copy, {$IFDEF PHP7}'zend_hash_copy@@12'{$ELSE}'zend_hash_copy'{$ENDIF});
 
 
   // -- zend_hash_sort
-  zend_hash_sort := GetProcAddress(PHPLib, {$IFDEF PHP7}'zend_hash_sort_ex@@16'{$ELSE}'zend_hash_sort'{$ENDIF});
+  LFunc(@zend_hash_sort, {$IFDEF PHP7}'zend_hash_sort_ex@@16'{$ELSE}'zend_hash_sort'{$ENDIF});
 
   // -- zend_hash_compare
-  zend_hash_compare := GetProcAddress(PHPLib, 'zend_hash_compare');
+  LFunc(@zend_hash_compare, 'zend_hash_compare');
 
   // -- zend_hash_minmax
-  zend_hash_minmax := GetProcAddress(PHPLib, {$IFDEF PHP7}'zend_hash_minmax@@12'{$ELSE}'zend_hash_minmax'{$ENDIF});
+  LFunc(@zend_hash_minmax, {$IFDEF PHP7}'zend_hash_minmax@@12'{$ELSE}'zend_hash_minmax'{$ENDIF});
 
   // -- zend_hash_num_elements
   {$IFNDEF PHP7}
-  zend_hash_num_elements := GetProcAddress(PHPLib, 'zend_hash_num_elements');
+  LFunc(@zend_hash_num_elements, 'zend_hash_num_elements');
   {$ENDIF}
 
   // -- zend_hash_rehash
-  zend_hash_rehash := GetProcAddress(PHPLib, {$IFDEF PHP7}'zend_hash_rehash@@4'{$ELSE}'zend_hash_rehash'{$ENDIF});
+  LFunc(@zend_hash_rehash, {$IFDEF PHP7}'zend_hash_rehash@@4'{$ELSE}'zend_hash_rehash'{$ENDIF});
 
   // -- zend_hash_func
-  zend_hash_func := GetProcAddress(PHPLib, 'zend_hash_func');
+  LFunc(@zend_hash_func, 'zend_hash_func');
 
   // -- zend_get_constant
-  zend_get_constant := GetProcAddress(PHPLib, 'zend_get_constant');
+  LFunc(@zend_get_constant, 'zend_get_constant');
+
+  // -- zend_register_null_constant
+  LFunc(@zend_register_null_constant, 'zend_register_null_constant');
+
+  // -- zend_register_bool_constant
+  LFunc(@zend_register_bool_constant, 'zend_register_bool_constant');
 
   // -- zend_register_long_constant
-  zend_register_long_constant := GetProcAddress(PHPLib, 'zend_register_long_constant');
+  LFunc(@zend_register_long_constant, 'zend_register_long_constant');
 
   // -- zend_register_double_constant
-  zend_register_double_constant := GetProcAddress(PHPLib, 'zend_register_double_constant');
+  LFunc(@zend_register_double_constant, 'zend_register_double_constant');
 
   // -- zend_register_string_constant
-  zend_register_string_constant := GetProcAddress(PHPLib, 'zend_register_string_constant');
+  LFunc(@zend_register_string_constant, 'zend_register_string_constant');
 
   // -- zend_register_stringl_constant
-  zend_register_stringl_constant := GetProcAddress(PHPLib, 'zend_register_stringl_constant');
+  LFunc(@zend_register_stringl_constant, 'zend_register_stringl_constant');
 
   // -- zend_register_constant
-  zend_register_constant := GetProcAddress(PHPLib, 'zend_register_constant');
+  LFunc(@zend_register_constant, 'zend_register_constant');
 
-  zend_register_auto_global := GetProcAddress(PHPLib, 'zend_register_auto_global');
+  LFunc(@zend_register_auto_global, 'zend_register_auto_global');
   {$IFDEF PHP5}
-  zend_activate_auto_globals := GetProcAddress(PHPLib, 'zend_activate_auto_globals');
+  LFunc(@zend_activate_auto_globals, 'zend_activate_auto_globals');
   {$ENDIF}
 
   // -- tsrm_shutdown
-  tsrm_shutdown := GetProcAddress(PHPLib, 'tsrm_shutdown');
+  LFunc(@tsrm_shutdown, 'tsrm_shutdown');
 
   // -- ts_resource_ex
-  ts_resource_ex := GetProcAddress(PHPLib, 'ts_resource_ex');
+  LFunc(@ts_resource_ex, 'ts_resource_ex');
 
   // -- ts_free_thread
-  ts_free_thread := GetProcAddress(PHPLib, 'ts_free_thread');
+  LFunc(@ts_free_thread, 'ts_free_thread');
 
   // -- zend_error
-  zend_error := GetProcAddress(PHPLib, 'zend_error');
+  LFunc(@zend_error, 'zend_error');
 
   // -- zend_error_cb
-  zend_error_cb := GetProcAddress(PHPLib, 'zend_error_cb');
+  LFunc(@zend_error_cb, 'zend_error_cb');
 
   // -- zend_eval_string
-  zend_eval_string := GetProcAddress(PHPLib, 'zend_eval_string');
-
-  // -- zend_make_compiled_string_description
-  zend_make_compiled_string_description := GetProcAddress(PHPLib, 'zend_make_compiled_string_description');
+  LFunc(@zend_eval_string, 'zend_eval_string');
 
+  // -- zend_eval_string
+  LFunc(@zend_eval_string_ex, 'zend_eval_string_ex');
 
-  {$IFDEF PHP4}
-  // -- _zval_dtor
-  _zval_dtor := GetProcAddress(PHPLib, '_zval_dtor');
-
-  // -- _zval_copy_ctor
-  _zval_copy_ctor := GetProcAddress(PHPLib, '_zval_copy_ctor');
-
-  {$ELSE}
-  _zval_copy_ctor_func := GetProcAddress(PHPLib, {$IFDEF PHP7}'_zval_copy_ctor_func@@4'{$ELSE}'_zval_copy_ctor_func'{$ENDIF});
-  _zval_dtor_func := GetProcAddress(PHPLib, {$IFDEF PHP7}'_zval_dtor_func@@4'{$ELSE}'_zval_dtor_func'{$ENDIF});
-  _zval_ptr_dtor := GetProcAddress(PHPLib, '_zval_ptr_dtor');
+  // -- zend_make_compiled_string_description
+  LFunc(@zend_make_compiled_string_description, 'zend_make_compiled_string_description');
 
-  {$ENDIF}
+  LFunc(@_zval_copy_ctor_func, {$IFDEF PHP7}'_zval_copy_ctor_func@@4'{$ELSE}'_zval_copy_ctor_func'{$ENDIF});
+  LFunc(@_zval_dtor_func, {$IFDEF PHP7}'_zval_dtor_func@@4'{$ELSE}'_zval_dtor_func'{$ENDIF});
+  LFunc(@_zval_ptr_dtor, '_zval_ptr_dtor');
 
   // -- zend_print_variable
-  zend_print_variable := GetProcAddress(PHPLib, 'zend_print_variable');
+  LFunc(@zend_print_variable, 'zend_print_variable');
 
   // -- zend_stack_init
-  zend_stack_init := GetProcAddress(PHPLib, 'zend_stack_init');
+  LFunc(@zend_stack_init, 'zend_stack_init');
 
   // -- zend_stack_push
-  zend_stack_push := GetProcAddress(PHPLib, 'zend_stack_push');
+  LFunc(@zend_stack_push, 'zend_stack_push');
 
   // -- zend_stack_top
-  zend_stack_top := GetProcAddress(PHPLib, 'zend_stack_top');
+  LFunc(@zend_stack_top, 'zend_stack_top');
 
   // -- zend_stack_del_top
-  zend_stack_del_top := GetProcAddress(PHPLib, 'zend_stack_del_top');
+  LFunc(@zend_stack_del_top, 'zend_stack_del_top');
 
   // -- zend_stack_int_top
-  zend_stack_int_top := GetProcAddress(PHPLib, 'zend_stack_int_top');
+  LFunc(@zend_stack_int_top, 'zend_stack_int_top');
 
   // -- zend_stack_is_empty
-  zend_stack_is_empty := GetProcAddress(PHPLib, 'zend_stack_is_empty');
+  LFunc(@zend_stack_is_empty, 'zend_stack_is_empty');
 
   // -- zend_stack_destroy
-  zend_stack_destroy := GetProcAddress(PHPLib, 'zend_stack_destroy');
+  LFunc(@zend_stack_destroy, 'zend_stack_destroy');
 
   // -- zend_stack_base
-  zend_stack_base := GetProcAddress(PHPLib, 'zend_stack_base');
+  LFunc(@zend_stack_base, 'zend_stack_base');
 
   // -- zend_stack_count
-  zend_stack_count := GetProcAddress(PHPLib, 'zend_stack_count');
+  LFunc(@zend_stack_count, 'zend_stack_count');
 
   // -- zend_stack_apply
-  zend_stack_apply := GetProcAddress(PHPLib, 'zend_stack_apply');
+  LFunc(@zend_stack_apply, 'zend_stack_apply');
 
   // -- zend_stack_apply_with_argument
-  zend_stack_apply_with_argument := GetProcAddress(PHPLib, 'zend_stack_apply_with_argument');
+  LFunc(@zend_stack_apply_with_argument, 'zend_stack_apply_with_argument');
 
   // -- _convert_to_string
-  _convert_to_string := GetProcAddress(PHPLib, {$IFDEF PHP7}'_convert_to_string@@4'{$ELSE}'_convert_to_string'{$ENDIF});
+  LFunc(@_convert_to_string, {$IFDEF PHP7}'_convert_to_string@@4'{$ELSE}'_convert_to_string'{$ENDIF});
 
   // -- add_function
-  add_function := GetProcAddress(PHPLib, {$IFDEF PHP7}'add_function@@12'{$ELSE}'add_function'{$ENDIF});
+  LFunc(@add_function, {$IFDEF PHP7}'add_function@@12'{$ELSE}'add_function'{$ENDIF});
 
   // -- sub_function
-  sub_function := GetProcAddress(PHPLib, {$IFDEF PHP7}'sub_function@@12'{$ELSE}'sub_function'{$ENDIF});
+  LFunc(@sub_function, {$IFDEF PHP7}'sub_function@@12'{$ELSE}'sub_function'{$ENDIF});
 
   // -- mul_function
-  mul_function := GetProcAddress(PHPLib, {$IFDEF PHP7}'mul_function@@12'{$ELSE}'mul_function'{$ENDIF});
+  LFunc(@mul_function, {$IFDEF PHP7}'mul_function@@12'{$ELSE}'mul_function'{$ENDIF});
 
   // -- div_function
-  div_function := GetProcAddress(PHPLib, {$IFDEF PHP7}'div_function@@12'{$ELSE}'div_function'{$ENDIF});
+  LFunc(@div_function, {$IFDEF PHP7}'div_function@@12'{$ELSE}'div_function'{$ENDIF});
 
   // -- mod_function
-  mod_function := GetProcAddress(PHPLib, {$IFDEF PHP7}'mod_function@@12'{$ELSE}'mod_function'{$ENDIF});
+  LFunc(@mod_function, {$IFDEF PHP7}'mod_function@@12'{$ELSE}'mod_function'{$ENDIF});
 
   // -- boolean_xor_function
-  boolean_xor_function := GetProcAddress(PHPLib, {$IFDEF PHP7}'boolean_xor_function@@12'{$ELSE}'boolean_xor_function'{$ENDIF});
+  LFunc(@boolean_xor_function, {$IFDEF PHP7}'boolean_xor_function@@12'{$ELSE}'boolean_xor_function'{$ENDIF});
 
   // -- boolean_not_function
-  boolean_not_function := GetProcAddress(PHPLib, {$IFDEF PHP7}'boolean_not_function@@8'{$ELSE}'boolean_not_function'{$ENDIF});
+  LFunc(@boolean_not_function, {$IFDEF PHP7}'boolean_not_function@@8'{$ELSE}'boolean_not_function'{$ENDIF});
 
   // -- bitwise_not_function
-  bitwise_not_function := GetProcAddress(PHPLib, {$IFDEF PHP7}'bitwise_not_function@@8'{$ELSE}'bitwise_not_function'{$ENDIF});
+  LFunc(@bitwise_not_function, {$IFDEF PHP7}'bitwise_not_function@@8'{$ELSE}'bitwise_not_function'{$ENDIF});
 
   // -- bitwise_or_function
-  bitwise_or_function := GetProcAddress(PHPLib, {$IFDEF PHP7}'bitwise_or_function@@12'{$ELSE}'bitwise_or_function'{$ENDIF});
+  LFunc(@bitwise_or_function, {$IFDEF PHP7}'bitwise_or_function@@12'{$ELSE}'bitwise_or_function'{$ENDIF});
 
   // -- bitwise_and_function
-  bitwise_and_function := GetProcAddress(PHPLib, {$IFDEF PHP7}'bitwise_and_function@@12'{$ELSE}'bitwise_and_function'{$ENDIF});
+  LFunc(@bitwise_and_function, {$IFDEF PHP7}'bitwise_and_function@@12'{$ELSE}'bitwise_and_function'{$ENDIF});
 
   // -- bitwise_xor_function
-  bitwise_xor_function := GetProcAddress(PHPLib, {$IFDEF PHP7}'bitwise_xor_function@@12'{$ELSE}'bitwise_xor_function'{$ENDIF});
+  LFunc(@bitwise_xor_function, {$IFDEF PHP7}'bitwise_xor_function@@12'{$ELSE}'bitwise_xor_function'{$ENDIF});
 
   // -- shift_left_function
-  shift_left_function := GetProcAddress(PHPLib, {$IFDEF PHP7}'shift_left_function@@12'{$ELSE}'shift_left_function'{$ENDIF});
+  LFunc(@shift_left_function, {$IFDEF PHP7}'shift_left_function@@12'{$ELSE}'shift_left_function'{$ENDIF});
 
   // -- shift_right_function
-  shift_right_function := GetProcAddress(PHPLib, {$IFDEF PHP7}'shift_right_function@@12'{$ELSE}'shift_right_function'{$ENDIF});
+  LFunc(@shift_right_function, {$IFDEF PHP7}'shift_right_function@@12'{$ELSE}'shift_right_function'{$ENDIF});
 
   // -- concat_function
-  concat_function := GetProcAddress(PHPLib, {$IFDEF PHP7}'concat_function@@12'{$ELSE}'concat_function'{$ENDIF});
+  LFunc(@concat_function, {$IFDEF PHP7}'concat_function@@12'{$ELSE}'concat_function'{$ENDIF});
 
   // -- is_equal_function
-  is_equal_function := GetProcAddress(PHPLib, {$IFDEF PHP7}'is_equal_function@@12'{$ELSE}'is_equal_function'{$ENDIF});
+  LFunc(@is_equal_function, {$IFDEF PHP7}'is_equal_function@@12'{$ELSE}'is_equal_function'{$ENDIF});
 
   // -- is_identical_function
-  is_identical_function := GetProcAddress(PHPLib, {$IFDEF PHP7}'is_identical_function@@12'{$ELSE}'is_identical_function'{$ENDIF});
+  LFunc(@is_identical_function, {$IFDEF PHP7}'is_identical_function@@12'{$ELSE}'is_identical_function'{$ENDIF});
 
   // -- is_not_identical_function
-  is_not_identical_function := GetProcAddress(PHPLib, {$IFDEF PHP7}'is_not_identical_function@@12'{$ELSE}'is_not_identical_function'{$ENDIF});
+  LFunc(@is_not_identical_function, {$IFDEF PHP7}'is_not_identical_function@@12'{$ELSE}'is_not_identical_function'{$ENDIF});
 
   // -- is_not_equal_function
-  is_not_equal_function := GetProcAddress(PHPLib, {$IFDEF PHP7}'is_not_equal_function@@12'{$ELSE}'is_not_equal_function'{$ENDIF});
+  LFunc(@is_not_equal_function, {$IFDEF PHP7}'is_not_equal_function@@12'{$ELSE}'is_not_equal_function'{$ENDIF});
 
   // -- is_smaller_function
-  is_smaller_function := GetProcAddress(PHPLib, {$IFDEF PHP7}'is_smaller_function@@12'{$ELSE}'is_smaller_function'{$ENDIF});
+  LFunc(@is_smaller_function, {$IFDEF PHP7}'is_smaller_function@@12'{$ELSE}'is_smaller_function'{$ENDIF});
 
   // -- is_smaller_or_equal_function
-  is_smaller_or_equal_function := GetProcAddress(PHPLib, {$IFDEF PHP7}'is_smaller_or_equal_function@@12'{$ELSE}'is_smaller_or_equal_function'{$ENDIF});
+  LFunc(@is_smaller_or_equal_function, {$IFDEF PHP7}'is_smaller_or_equal_function@@12'{$ELSE}'is_smaller_or_equal_function'{$ENDIF});
 
   // -- increment_function
-  increment_function := GetProcAddress(PHPLib, {$IFDEF PHP7}'increment_function@@4'{$ELSE}'increment_function'{$ENDIF});
+  LFunc(@increment_function, {$IFDEF PHP7}'increment_function@@4'{$ELSE}'increment_function'{$ENDIF});
 
   // -- decrement_function
-  decrement_function := GetProcAddress(PHPLib, {$IFDEF PHP7}'decrement_function@@4'{$ELSE}'decrement_function'{$ENDIF});
+  LFunc(@decrement_function, {$IFDEF PHP7}'decrement_function@@4'{$ELSE}'decrement_function'{$ENDIF});
 
   // -- convert_scalar_to_number
-  convert_scalar_to_number := GetProcAddress(PHPLib, {$IFDEF PHP7}'convert_scalar_to_number@@4'{$ELSE}'convert_scalar_to_number'{$ENDIF});
+  LFunc(@convert_scalar_to_number, {$IFDEF PHP7}'convert_scalar_to_number@@4'{$ELSE}'convert_scalar_to_number'{$ENDIF});
 
   // -- convert_to_long
-  convert_to_long := GetProcAddress(PHPLib, {$IFDEF PHP7}'convert_to_long@@4'{$ELSE}'convert_to_long'{$ENDIF});
+  LFunc(@convert_to_long, {$IFDEF PHP7}'convert_to_long@@4'{$ELSE}'convert_to_long'{$ENDIF});
 
   // -- convert_to_double
-  convert_to_double := GetProcAddress(PHPLib, {$IFDEF PHP7}'convert_to_double@@4'{$ELSE}'convert_to_double'{$ENDIF});
+  LFunc(@convert_to_double, {$IFDEF PHP7}'convert_to_double@@4'{$ELSE}'convert_to_double'{$ENDIF});
 
   // -- convert_to_long_base
-  convert_to_long_base := GetProcAddress(PHPLib, {$IFDEF PHP7}'convert_to_long_base@@8'{$ELSE}'convert_to_long_base'{$ENDIF});
+  LFunc(@convert_to_long_base, {$IFDEF PHP7}'convert_to_long_base@@8'{$ELSE}'convert_to_long_base'{$ENDIF});
 
   // -- convert_to_null
-  convert_to_null := GetProcAddress(PHPLib, {$IFDEF PHP7}'convert_to_null@@4'{$ELSE}'convert_to_null'{$ENDIF});
+  LFunc(@convert_to_null, {$IFDEF PHP7}'convert_to_null@@4'{$ELSE}'convert_to_null'{$ENDIF});
 
   // -- convert_to_boolean
-  convert_to_boolean := GetProcAddress(PHPLib, {$IFDEF PHP7}'convert_to_boolean@@4'{$ELSE}'convert_to_boolean'{$ENDIF});
+  LFunc(@convert_to_boolean, {$IFDEF PHP7}'convert_to_boolean@@4'{$ELSE}'convert_to_boolean'{$ENDIF});
 
   // -- convert_to_array
-  convert_to_array := GetProcAddress(PHPLib, {$IFDEF PHP7}'convert_to_array@@4'{$ELSE}'convert_to_array'{$ENDIF});
+  LFunc(@convert_to_array, {$IFDEF PHP7}'convert_to_array@@4'{$ELSE}'convert_to_array'{$ENDIF});
 
   // -- convert_to_object
-  convert_to_object := GetProcAddress(PHPLib, {$IFDEF PHP7}'convert_to_object@@4'{$ELSE}'convert_to_object'{$ENDIF});
+  LFunc(@convert_to_object, {$IFDEF PHP7}'convert_to_object@@4'{$ELSE}'convert_to_object'{$ENDIF});
   {$IFNDEF PHP7}
   // -- add_char_to_string
-  add_char_to_string := GetProcAddress(PHPLib, 'add_char_to_string');
+  LFunc(@add_char_to_string, 'add_char_to_string');
 
   // -- add_string_to_string
-  add_string_to_string := GetProcAddress(PHPLib, 'add_string_to_string');
+  LFunc(@add_string_to_string, 'add_string_to_string');
   {$ENDIF}
   // -- zend_string_to_double
-  zend_string_to_double := GetProcAddress(PHPLib, {$IFDEF PHP7}'zend_strtod'{$ELSE}'zend_string_to_double'{$ENDIF});
+  LFunc(@zend_string_to_double, {$IFDEF PHP7}'zend_strtod'{$ELSE}'zend_string_to_double'{$ENDIF});
 
   // -- zval_is_true
-  zval_is_true := GetProcAddress(PHPLib, {$IFDEF PHP7}'zend_is_true@@4'{$ELSE}'zval_is_true'{$ENDIF});
+  LFunc(@zval_is_true, {$IFDEF PHP7}'zend_is_true@@4'{$ELSE}'zval_is_true'{$ENDIF});
 
   // -- compare_function
-  compare_function := GetProcAddress(PHPLib, {$IFDEF PHP7}'compare_function@@12'{$ELSE}'compare_function'{$ENDIF});
+  LFunc(@compare_function, {$IFDEF PHP7}'compare_function@@12'{$ELSE}'compare_function'{$ENDIF});
 
   // -- numeric_compare_function
-  numeric_compare_function := GetProcAddress(PHPLib, {$IFDEF PHP7}'numeric_compare_function@@8'{$ELSE}'numeric_compare_function'{$ENDIF});
+  LFunc(@numeric_compare_function, {$IFDEF PHP7}'numeric_compare_function@@8'{$ELSE}'numeric_compare_function'{$ENDIF});
 
   // -- string_compare_function
-  string_compare_function := GetProcAddress(PHPLib, {$IFDEF PHP7}'string_compare_function@@8'{$ELSE}'string_compare_function'{$ENDIF});
+  LFunc(@string_compare_function, {$IFDEF PHP7}'string_compare_function@@8'{$ELSE}'string_compare_function'{$ENDIF});
 
   // -- zend_str_tolower
-  zend_str_tolower := GetProcAddress(PHPLib, {$IFDEF PHP7}'zend_str_tolower@@8'{$ELSE}'zend_str_tolower'{$ENDIF});
+  LFunc(@zend_str_tolower, {$IFDEF PHP7}'zend_str_tolower@@8'{$ELSE}'zend_str_tolower'{$ENDIF});
 
   // -- zend_binary_zval_strcmp
-  zend_binary_zval_strcmp := GetProcAddress(PHPLib, {$IFDEF PHP7}'zend_binary_zval_strcmp@@8'{$ELSE}'zend_binary_zval_strcmp'{$ENDIF});
+  LFunc(@zend_binary_zval_strcmp, {$IFDEF PHP7}'zend_binary_zval_strcmp@@8'{$ELSE}'zend_binary_zval_strcmp'{$ENDIF});
 
   // -- zend_binary_zval_strncmp
-  zend_binary_zval_strncmp := GetProcAddress(PHPLib, {$IFDEF PHP7}'zend_binary_zval_strncmp@@12'{$ELSE}'zend_binary_zval_strncmp'{$ENDIF});
+  LFunc(@zend_binary_zval_strncmp, {$IFDEF PHP7}'zend_binary_zval_strncmp@@12'{$ELSE}'zend_binary_zval_strncmp'{$ENDIF});
 
   // -- zend_binary_zval_strcasecmp
-  zend_binary_zval_strcasecmp := GetProcAddress(PHPLib, {$IFDEF PHP7}'zend_binary_zval_strcasecmp@@8'{$ELSE}'zend_binary_zval_strcasecmp'{$ENDIF});
+  LFunc(@zend_binary_zval_strcasecmp, {$IFDEF PHP7}'zend_binary_zval_strcasecmp@@8'{$ELSE}'zend_binary_zval_strcasecmp'{$ENDIF});
 
   // -- zend_binary_zval_strncasecmp
-  zend_binary_zval_strncasecmp := GetProcAddress(PHPLib, {$IFDEF PHP7}'zend_binary_zval_strncasecmp@@12'{$ELSE}'zend_binary_zval_strncasecmp'{$ENDIF});
+  LFunc(@zend_binary_zval_strncasecmp, {$IFDEF PHP7}'zend_binary_zval_strncasecmp@@12'{$ELSE}'zend_binary_zval_strncasecmp'{$ENDIF});
 
   // -- zend_binary_strcmp
-  zend_binary_strcmp := GetProcAddress(PHPLib, {$IFDEF PHP7}'zend_binary_strcmp@@16'{$ELSE}'zend_binary_strcmp'{$ENDIF});
+  LFunc(@zend_binary_strcmp, {$IFDEF PHP7}'zend_binary_strcmp@@16'{$ELSE}'zend_binary_strcmp'{$ENDIF});
 
   // -- zend_binary_strncmp
-  zend_binary_strncmp := GetProcAddress(PHPLib, {$IFDEF PHP7}'zend_binary_strncmp@@20'{$ELSE}'zend_binary_strncmp'{$ENDIF});
+  LFunc(@zend_binary_strncmp, {$IFDEF PHP7}'zend_binary_strncmp@@20'{$ELSE}'zend_binary_strncmp'{$ENDIF});
 
   // -- zend_binary_strcasecmp
-  zend_binary_strcasecmp := GetProcAddress(PHPLib, {$IFDEF PHP7}'zend_binary_strcasecmp@@16'{$ELSE}'zend_binary_strcasecmp'{$ENDIF});
+  LFunc(@zend_binary_strcasecmp, {$IFDEF PHP7}'zend_binary_strcasecmp@@16'{$ELSE}'zend_binary_strcasecmp'{$ENDIF});
 
   // -- zend_binary_strncasecmp
-  zend_binary_strncasecmp := GetProcAddress(PHPLib, {$IFDEF PHP7}'zend_binary_strncasecmp@@20'{$ELSE}'zend_binary_strncasecmp'{$ENDIF});
+  LFunc(@zend_binary_strncasecmp, {$IFDEF PHP7}'zend_binary_strncasecmp@@20'{$ELSE}'zend_binary_strncasecmp'{$ENDIF});
 
   // -- zendi_smart_strcmp
-  zendi_smart_strcmp := GetProcAddress(PHPLib, {$IFDEF PHP7}'zendi_smart_strcmp@@8'{$ELSE}'zendi_smart_strcmp'{$ENDIF});
+  LFunc(@zendi_smart_strcmp, {$IFDEF PHP7}'zendi_smart_strcmp@@8'{$ELSE}'zendi_smart_strcmp'{$ENDIF});
 
   // -- zend_compare_symbol_tables
-  zend_compare_symbol_tables := GetProcAddress(PHPLib, {$IFDEF PHP7}'zend_compare_symbol_tables@@8'{$ELSE}'zend_compare_symbol_tables'{$ENDIF});
+  LFunc(@zend_compare_symbol_tables, {$IFDEF PHP7}'zend_compare_symbol_tables@@8'{$ELSE}'zend_compare_symbol_tables'{$ENDIF});
 
   // -- zend_compare_arrays
-  zend_compare_arrays := GetProcAddress(PHPLib, {$IFDEF PHP7}'zend_compare_arrays@@8'{$ELSE}'zend_compare_arrays'{$ENDIF});
+  LFunc(@zend_compare_arrays, {$IFDEF PHP7}'zend_compare_arrays@@8'{$ELSE}'zend_compare_arrays'{$ENDIF});
 
   // -- zend_compare_objects
-  zend_compare_objects := GetProcAddress(PHPLib, {$IFDEF PHP7}'zend_compare_objects@@8'{$ELSE}'zend_compare_objects'{$ENDIF});
+  LFunc(@zend_compare_objects, {$IFDEF PHP7}'zend_compare_objects@@8'{$ELSE}'zend_compare_objects'{$ENDIF});
 
   // -- zend_atoi
-  zend_atoi := GetProcAddress(PHPLib, {$IFDEF PHP7}'zend_atoi@@8'{$ELSE}'zend_atoi'{$ENDIF});
+  LFunc(@zend_atoi, {$IFDEF PHP7}'zend_atoi@@8'{$ELSE}'zend_atoi'{$ENDIF});
 
   // -- get_active_function_name
-  get_active_function_name := GetProcAddress(PHPLib, 'get_active_function_name');
+  LFunc(@get_active_function_name, 'get_active_function_name');
 
   // -- zend_get_executed_filename
-  zend_get_executed_filename := GetProcAddress(PHPLib, 'zend_get_executed_filename');
+  LFunc(@zend_get_executed_filename, 'zend_get_executed_filename');
 
   // -- zend_get_executed_lineno
-  zend_get_executed_lineno := GetProcAddress(PHPLib, 'zend_get_executed_lineno');
+  LFunc(@zend_get_executed_lineno, 'zend_get_executed_lineno');
 
   // -- zend_set_timeout
-  zend_set_timeout := GetProcAddress(PHPLib, 'zend_set_timeout');
+  LFunc(@zend_set_timeout, 'zend_set_timeout');
 
   // -- zend_unset_timeout
-  zend_unset_timeout := GetProcAddress(PHPLib, 'zend_unset_timeout');
+  LFunc(@zend_unset_timeout, 'zend_unset_timeout');
 
   // -- zend_timeout
-  zend_timeout := GetProcAddress(PHPLib, 'zend_timeout');
+  LFunc(@zend_timeout, 'zend_timeout');
 
   // -- zend_highlight
-  zend_highlight := GetProcAddress(PHPLib, 'zend_highlight');
+  LFunc(@zend_highlight, 'zend_highlight');
 
   // -- zend_strip
-  zend_strip := GetProcAddress(PHPLib, 'zend_strip');
+  LFunc(@zend_strip, 'zend_strip');
 
   // -- highlight_file
-  highlight_file := GetProcAddress(PHPLib, 'highlight_file');
+  LFunc(@highlight_file, 'highlight_file');
 
   // -- highlight_string
-  highlight_string := GetProcAddress(PHPLib, 'highlight_string');
+  LFunc(@highlight_string, 'highlight_string');
 
   // -- zend_html_putc
-  zend_html_putc := GetProcAddress(PHPLib, 'zend_html_putc');
+  LFunc(@zend_html_putc, 'zend_html_putc');
 
   // -- zend_html_puts
-  zend_html_puts := GetProcAddress(PHPLib, 'zend_html_puts');
+  LFunc(@zend_html_puts, 'zend_html_puts');
+
+  LFunc(@zend_parse_method_parameters, 'zend_parse_method_parameters');
+  LFunc(@zend_parse_method_parameters_ex, 'zend_parse_method_parameters_ex');
+
   {$IFDEF PHP7}
   // -- zend_parse_parameters_throw
-  zend_parse_parameters_throw := GetProcAddress(PHPLib, 'zend_parse_parameters_throw');
-  ZvalGetArgs  := GetProcAddress(PHPLib, 'zend_get_parameters_ex');
-  _zend_get_parameters_array_ex := GetProcAddress(PHPLib, '_zend_get_parameters_array_ex');
+  LFunc(@zend_parse_parameters_throw, 'zend_parse_parameters_throw');
+  LFunc(@ZvalGetArgs, 'zend_get_parameters_ex');
   {$ELSE}
   // -- zend_indent
-  zend_indent := GetProcAddress(PHPLib, 'zend_indent');
+  LFunc(@zend_indent, 'zend_indent');
   {$ENDIF}
+  // -- _zend_get_parameters_array
+  LFunc(@_zend_get_parameters_array, '_zend_get_parameters_array');
+
   // -- _zend_get_parameters_array_ex
-  _zend_get_parameters_array_ex := GetProcAddress(PHPLib, {$IFDEF PHP7}{$ELSE}{$ENDIF}'_zend_get_parameters_array_ex');
+  LFunc(@_zend_get_parameters_array_ex, '_zend_get_parameters_array_ex');
 
   // -- zend_ini_refresh_caches
-  zend_ini_refresh_caches := GetProcAddress(PHPLib, 'zend_ini_refresh_caches');
+  LFunc(@zend_ini_refresh_caches, 'zend_ini_refresh_caches');
 
   // -- zend_alter_ini_entry
-  zend_alter_ini_entry := GetProcAddress(PHPLib, 'zend_alter_ini_entry');
-  zend_alter_ini_entry_ex:= GetProcAddress(PHPLib, 'zend_alter_ini_entry_ex');
+  LFunc(@zend_alter_ini_entry, 'zend_alter_ini_entry');
+  LFunc(@zend_alter_ini_entry_ex, 'zend_alter_ini_entry_ex');
   // -- zend_restore_ini_entry
-  zend_restore_ini_entry := GetProcAddress(PHPLib, 'zend_restore_ini_entry');
+  LFunc(@zend_restore_ini_entry, 'zend_restore_ini_entry');
 
   // -- zend_ini_long
-  zend_ini_long := GetProcAddress(PHPLib, 'zend_ini_long');
+  LFunc(@zend_ini_long, 'zend_ini_long');
 
   // -- zend_ini_double
-  zend_ini_double := GetProcAddress(PHPLib, 'zend_ini_double');
+  LFunc(@zend_ini_double, 'zend_ini_double');
 
   // -- zend_ini_string
-  zend_ini_string := GetProcAddress(PHPLib, 'zend_ini_string');
+  LFunc(@zend_ini_string, 'zend_ini_string');
 
   // -- compile_string
-  compile_string := GetProcAddress(PHPLib, 'compile_string');
+  LFunc(@compile_string, 'compile_string');
 
   // -- execute
-  execute := GetProcAddress(PHPLib, {$IFDEF PHP550}'zend_execute'{$ELSE}'execute'{$ENDIF});
+  LFunc(@execute, {$IFDEF PHP550}'zend_execute'{$ELSE}'execute'{$ENDIF});
 
   // -- zend_wrong_param_count
-  zend_wrong_param_count := GetProcAddress(PHPLib, 'zend_wrong_param_count');
+  LFunc(@zend_wrong_param_count, 'zend_wrong_param_count');
 
   // -- zend_hash_quick_add_or_update
-  _zend_hash_quick_add_or_update := GetProcAddress(PHPLib, '_zend_hash_quick_add_or_update');
+  LFunc(@_zend_hash_quick_add_or_update, '_zend_hash_quick_add_or_update');
 
   // -- add_property_long_ex
-  add_property_long_ex := GetProcAddress(PHPLib, 'add_property_long_ex');
+  LFunc(@add_property_long_ex, 'add_property_long_ex');
 
   // -- add_property_null_ex
-  add_property_null_ex := GetProcAddress(PHPLib, 'add_property_null_ex');
+  LFunc(@add_property_null_ex, 'add_property_null_ex');
 
   // -- add_property_bool_ex
-  add_property_bool_ex := GetProcAddress(PHPLib, 'add_property_bool_ex');
+  LFunc(@add_property_bool_ex, 'add_property_bool_ex');
 
   // -- add_property_resource_ex
-  add_property_resource_ex := GetProcAddress(PHPLib, 'add_property_resource_ex');
+  LFunc(@add_property_resource_ex, 'add_property_resource_ex');
 
   // -- add_property_double_ex
-  add_property_double_ex := GetProcAddress(PHPLib, 'add_property_double_ex');
+  LFunc(@add_property_double_ex, 'add_property_double_ex');
 
   // -- add_property_string_ex
-  add_property_string_ex := GetProcAddress(PHPLib, 'add_property_string_ex');
+  LFunc(@add_property_string_ex, 'add_property_string_ex');
 
   // -- add_property_stringl_ex
-  add_property_stringl_ex := GetProcAddress(PHPLib, 'add_property_stringl_ex');
+  LFunc(@add_property_stringl_ex, 'add_property_stringl_ex');
 
   // -- add_property_zval_ex
-  add_property_zval_ex := GetProcAddress(PHPLib, 'add_property_zval_ex');
+  LFunc(@add_property_zval_ex, 'add_property_zval_ex');
 
-  call_user_function := GetProcAddress(PHPLib, {$IFDEF P_CUT}'__call_function'{$ELSE}'call_user_function'{$ENDIF});
-  {$IFNDEF P_CUT}
-  call_user_function_ex := GetProcAddress(PHPLib, 'call_user_function_ex');
+  LFunc(@call_user_function, {$IFDEF CUTTED_PHP7dll}'__call_function'{$ELSE}'call_user_function'{$ENDIF});
+  {$IFNDEF CUTTED_PHP7dll}
+  LFunc(@call_user_function_ex, 'call_user_function_ex');
   {$ENDIF}
   // -- add_assoc_long_ex
-  add_assoc_long_ex := GetProcAddress(PHPLib, 'add_assoc_long_ex');
+  LFunc(@add_assoc_long_ex, 'add_assoc_long_ex');
 
   // -- add_assoc_null_ex
-  add_assoc_null_ex := GetProcAddress(PHPLib, 'add_assoc_null_ex');
+  LFunc(@add_assoc_null_ex, 'add_assoc_null_ex');
 
   // -- add_assoc_bool_ex
-  add_assoc_bool_ex := GetProcAddress(PHPLib, 'add_assoc_bool_ex');
+  LFunc(@add_assoc_bool_ex, 'add_assoc_bool_ex');
 
   // -- add_assoc_resource_ex
-  add_assoc_resource_ex := GetProcAddress(PHPLib, 'add_assoc_resource_ex');
+  LFunc(@add_assoc_resource_ex, 'add_assoc_resource_ex');
 
   // -- add_assoc_double_ex
-  add_assoc_double_ex := GetProcAddress(PHPLib, 'add_assoc_double_ex');
+  LFunc(@add_assoc_double_ex, 'add_assoc_double_ex');
 
   // -- add_assoc_string_ex
-  add_assoc_string_ex := GetProcAddress(PHPLib, 'add_assoc_string_ex');
+  LFunc(@add_assoc_string_ex, 'add_assoc_string_ex');
 
   // -- add_assoc_stringl_ex
-  add_assoc_stringl_ex := GetProcAddress(PHPLib, 'add_assoc_stringl_ex');
+  LFunc(@add_assoc_stringl_ex, 'add_assoc_stringl_ex');
 
   // -- add_assoc_zval_ex
-  add_assoc_zval_ex := GetProcAddress(PHPLib, 'add_assoc_zval_ex');
+  LFunc(@add_assoc_zval_ex, 'add_assoc_zval_ex');
 
   // -- add_index_long
-  add_index_long := GetProcAddress(PHPLib, 'add_index_long');
+  LFunc(@add_index_long, 'add_index_long');
 
   // -- add_index_null
-  add_index_null := GetProcAddress(PHPLib, 'add_index_null');
+  LFunc(@add_index_null, 'add_index_null');
 
   // -- add_index_bool
-  add_index_bool := GetProcAddress(PHPLib, 'add_index_bool');
+  LFunc(@add_index_bool, 'add_index_bool');
 
   // -- add_index_resource
-  add_index_resource := GetProcAddress(PHPLib, 'add_index_resource');
+  LFunc(@add_index_resource, 'add_index_resource');
 
   // -- add_index_double
-  add_index_double := GetProcAddress(PHPLib, 'add_index_double');
+  LFunc(@add_index_double, 'add_index_double');
 
   // -- add_index_string
-  add_index_string := GetProcAddress(PHPLib, 'add_index_string');
+  LFunc(@add_index_string, 'add_index_string');
 
   // -- add_index_stringl
-  add_index_stringl := GetProcAddress(PHPLib, 'add_index_stringl');
+  LFunc(@add_index_stringl, 'add_index_stringl');
 
   // -- add_index_zval
-  add_index_zval := GetProcAddress(PHPLib, 'add_index_zval');
+  LFunc(@add_index_zval, 'add_index_zval');
 
   // -- add_next_index_long
-  add_next_index_long := GetProcAddress(PHPLib, 'add_next_index_long');
+  LFunc(@add_next_index_long, 'add_next_index_long');
 
   // -- add_next_index_null
-  add_next_index_null := GetProcAddress(PHPLib, 'add_next_index_null');
+  LFunc(@add_next_index_null, 'add_next_index_null');
 
   // -- add_next_index_bool
-  add_next_index_bool := GetProcAddress(PHPLib, 'add_next_index_bool');
+  LFunc(@add_next_index_bool, 'add_next_index_bool');
 
   // -- add_next_index_resource
-  add_next_index_resource := GetProcAddress(PHPLib, 'add_next_index_resource');
+  LFunc(@add_next_index_resource, 'add_next_index_resource');
 
   // -- add_next_index_double
-  add_next_index_double := GetProcAddress(PHPLib, 'add_next_index_double');
+  LFunc(@add_next_index_double, 'add_next_index_double');
 
   // -- add_next_index_string
-  add_next_index_string := GetProcAddress(PHPLib, 'add_next_index_string');
+  LFunc(@add_next_index_string, 'add_next_index_string');
 
   // -- add_next_index_stringl
-  add_next_index_stringl := GetProcAddress(PHPLib, 'add_next_index_stringl');
+  LFunc(@add_next_index_stringl, 'add_next_index_stringl');
 
   // -- add_next_index_zval
-  add_next_index_zval := GetProcAddress(PHPLib, 'add_next_index_zval');
+  LFunc(@add_next_index_zval, 'add_next_index_zval');
 
   // -- add_get_assoc_string_ex
-  add_get_assoc_string_ex := GetProcAddress(PHPLib, 'add_get_assoc_string_ex');
+  LFunc(@add_get_assoc_string_ex, 'add_get_assoc_string_ex');
 
   // -- add_get_assoc_stringl_ex
-  add_get_assoc_stringl_ex := GetProcAddress(PHPLib, 'add_get_assoc_stringl_ex');
+  LFunc(@add_get_assoc_stringl_ex, 'add_get_assoc_stringl_ex');
 
   // -- add_get_index_long
-  add_get_index_long := GetProcAddress(PHPLib, 'add_get_index_long');
+  LFunc(@add_get_index_long, 'add_get_index_long');
 
   // -- add_get_index_double
-  add_get_index_double := GetProcAddress(PHPLib, 'add_get_index_double');
+  LFunc(@add_get_index_double, 'add_get_index_double');
 
   // -- add_get_index_string
-  add_get_index_string := GetProcAddress(PHPLib, 'add_get_index_string');
+  LFunc(@add_get_index_string, 'add_get_index_string');
 
   // -- add_get_index_stringl
-  add_get_index_stringl := GetProcAddress(PHPLib, 'add_get_index_stringl');
+  LFunc(@add_get_index_stringl, 'add_get_index_stringl');
 
   // -- _array_init
-  _array_init := GetProcAddress(PHPLib, '_array_init');
+  LFunc(@_array_init, '_array_init');
 
   // -- _object_init
-  _object_init := GetProcAddress(PHPLib, '_object_init');
+  LFunc(@_object_init, '_object_init');
 
   // -- _object_init_ex
-  _object_init_ex := GetProcAddress(PHPLib, '_object_init_ex');
+  LFunc(@_object_init_ex, '_object_init_ex');
 
   // -- _object_and_properties_init
-  _object_and_properties_init := GetProcAddress(PHPLib, '_object_and_properties_init');
+  LFunc(@_object_and_properties_init, '_object_and_properties_init');
 
   // -- zend_register_internal_class
-  zend_register_internal_class := GetProcAddress(PHPLib, 'zend_register_internal_class');
+  LFunc(@zend_register_internal_class, 'zend_register_internal_class');
 
   // -- zend_register_internal_class_ex
-  zend_register_internal_class_ex := GetProcAddress(PHPLib, 'zend_register_internal_class_ex');
+  LFunc(@zend_register_internal_class_ex, 'zend_register_internal_class_ex');
 
   // -- zend_startup_module
-  zend_startup_module  := GetProcAddress(PHPLib, 'zend_startup_module');
+  LFunc(@zend_startup_module, 'zend_startup_module');
 
   // -- zend_startup_module_ex
-  zend_startup_module_ex  := GetProcAddress(PHPLib, 'zend_startup_module_ex');
+  LFunc(@zend_startup_module_ex, 'zend_startup_module_ex');
 
   // -- zend_register_module_ex
-  zend_register_module_ex := GetProcAddress(PHPLib, 'zend_register_module_ex');
+  LFunc(@zend_register_module_ex, 'zend_register_module_ex');
 
   // --  zend_register_internal_module
-  zend_register_internal_module := GetProcAddress(PHPLib, 'zend_register_internal_module');
+  LFunc(@zend_register_internal_module, 'zend_register_internal_module');
 
   // -- zend_startup_modules
-  zend_startup_modules := GetProcAddress(PHPLib, 'zend_startup_modules');
+  LFunc(@zend_startup_modules, 'zend_startup_modules');
 
   // -- zend_collect_module_handlers
-  zend_collect_module_handlers := GetProcAddress(PHPLib, 'zend_collect_module_handlers');
+  LFunc(@zend_collect_module_handlers, 'zend_collect_module_handlers');
 
   // -- get_zend_version
-  get_zend_version := GetProcAddress(PHPLib, 'get_zend_version');
+  LFunc(@get_zend_version, 'get_zend_version');
 
   // -- zend_make_printable_zval
-  zend_make_printable_zval := GetProcAddress(PHPLib, 'zend_make_printable_zval');
+  LFunc(@zend_make_printable_zval, 'zend_make_printable_zval');
 
   // -- zend_print_zval
-  zend_print_zval := GetProcAddress(PHPLib, 'zend_print_zval');
+  LFunc(@zend_print_zval, 'zend_print_zval');
 
   // -- zend_print_zval_r
-  zend_print_zval_r := GetProcAddress(PHPLib, 'zend_print_zval_r');
+  LFunc(@zend_print_zval_r, 'zend_print_zval_r');
 
   // -- zend_output_debug_string
-  zend_output_debug_string := GetProcAddress(PHPLib, 'zend_output_debug_string');
+  LFunc(@zend_output_debug_string, 'zend_output_debug_string');
 
   // -- zend_get_parameters
-  ZendGetParameters := GetProcAddress(PHPLib, 'zend_get_parameters');
+  LFunc(@Zend_Get_Parameters, 'zend_get_parameters');
 
   // - zend_get_parameters_ex (native call)
-  zend_get_params_ex := GetProcAddress(PHPLib, 'zend_get_parameters_ex');
+  LFunc(@zend_get_params_ex, 'zend_get_parameters_ex');
   {$IFDEF PHP5}
-  zend_destroy_file_handle := GetProcAddress(PHPLib, 'zend_destroy_file_handle');
+  LFunc(@zend_destroy_file_handle, 'zend_destroy_file_handle');
   {$ENDIF}
 
- {$IFNDEF QUIET_LOAD}
- CheckZendErrors;
- {$ENDIF}
-
-  WriteFuncPtr := GetProcAddress(PHPLib, 'zend_write');
+  LFunc(WriteFuncPtr, 'zend_write');
   if Assigned(WriteFuncPtr) then
     @zend_write := pointer(WriteFuncPtr^);
 
@@ -3090,11 +3045,6 @@ procedure INIT_CLASS_ENTRY(var class_container: Tzend_class_entry; class_name: z
   class_container.name_length := strlen(class_name);
   class_container.builtin_functions := functions;
   {$ENDIF}
-  {$IFDEF PHP4}
-  class_container.handle_function_call := nil;
-  class_container.handle_property_get := nil;
-  class_container.handle_property_set := nil;
-  {$ENDIF}
 end;
 {$IFNDEF PHP7}
 function ZEND_FAST_ALLOC: pzval;
@@ -3144,29 +3094,6 @@ function MAKE_STD_ZVAL: pzval;
   INIT_PZVAL(Result);
 end;
 
-function zend_get_parameters_ex(number: integer; var Params: pzval_array): integer;
-var
-  i  : integer;
-begin
-
-  if number = 0 then
-  begin
-    Result := SUCCESS;
-    Exit;
-  end;
-  {$IFDEF PHP7}
-  Params.value.arr.nNumOfElements := number;
-  for i := 0 to number - 1 do
-    zend_hash_index_add_empty_element(Params.value.arr, i);
-  Result := ZvalGetArgs(number, @Params);
-  {$ELSE}
-   SetLength(Params, number);
-  for i := 0 to number - 1 do
-    New(Params[i]);
-  Result := zend_get_parameters(number, number, Params);
-  {$ENDIF}
-end;
-
 function zend_get_parameters_my(number: integer; var Params: pzval_array; TSRMLS_DC: Pointer): integer;
 var
   i  : integer;
@@ -3212,40 +3139,17 @@ function zend_get_parameters_my(number: integer; var Params: pzval_array; TSRMLS
   begin
      Params[i]^ :=  p^^;
      if i <> number then
+     {$IFDEF CPUX64}
+        p^ := ppzval( integer(p^) + sizeof(ppzval) );
+     {$ELSE}
          inc(integer(p^), sizeof(ppzval));
+     {$ENDIF}
   end;
 
   efree(p);
   {$ENDIF}
 end;
-{$IFNDEF PHP7}
-function zend_get_parameters(ht: integer; param_count: integer; Params: array of ppzval): integer; assembler; register;
-asm
-  push  esi
-  mov   esi, ecx
-  mov   ecx, [ebp+8]
-  cmp   ecx, 0
-  je @first
-  @toploop:
-  {$IFDEF VERSION6}
-  push  [esi][ecx * 4]
-  {$ELSE}
-  push  dword [esi][ecx * 4]
-  {$ENDIF}
-  loop   @toploop
-  @first:
-  push    dword [esi]
-  push    edx
-  push    eax
-  call    ZendGetParameters
-  mov   ecx, [ebp+8]
-  add     ecx, 3
-  @toploop2:
-  pop     edx
-  loop   @toploop2
-  pop     esi
-end;
-{$ENDIF}
+
 procedure dispose_pzval_array(Params: pzval_array);
 var
   i : integer;
@@ -3274,271 +3178,6 @@ constructor EPHP4DelphiException.Create(const Msg: zend_ustr);
   zend_error(E_PARSE, Error);
 end;}
 
-
-{$IFNDEF QUIET_LOAD}
-procedure CheckZendErrors;
-begin
-  if @zend_disable_function = nil then raise EPHP4DelphiException.Create('zend_disable_function');
-  if @zend_disable_class = nil then raise EPHP4DelphiException.Create('zend_disable_class');
-  if @zend_register_list_destructors_ex = nil then raise EPHP4DelphiException.Create('zend_register_list_destructors_ex');
-  if @zend_register_resource = nil then raise EPHP4DelphiException.Create('zend_register_resource');
-  if @zend_fetch_resource =    nil then raise EPHP4DelphiException.Create('zend_fetch_resource');
-  if @zend_list_insert =       nil then raise EPHP4DelphiException.Create('zend_list_insert');
-  {$IFNDEF PHP7}
-  if @_zend_list_addref =      nil then raise EPHP4DelphiException.Create('zend_list_addref');
-  if @_zend_list_delete =      nil then raise EPHP4DelphiException.Create('zend_list_delete');
-  if @_zend_list_find =        nil then raise EPHP4DelphiException.Create('_zend_list_find');
-  {$ENDIF}
-  if @zend_rsrc_list_get_rsrc_type =  nil then raise EPHP4DelphiException.Create('zend_rsrc_list_get_rsrc_type');
-  if @zend_fetch_list_dtor_id =       nil then raise EPHP4DelphiException.Create('zend_fetch_list_dtor_id');
-  if @zend_get_compiled_filename = nil then raise EPHP4DelphiException.Create('zend_get_compiled_filename');
-  if @zend_get_compiled_lineno = nil then raise EPHP4DelphiException.Create('zend_get_compiled_lineno');
-  if @tsrm_startup = nil then raise EPHP4DelphiException.Create('tsrm_startup');
-  if @ts_allocate_id = nil then raise EPHP4DelphiException.Create('ts_allocate_id');
-  if @ts_free_id = nil then raise EPHP4DelphiException.Create('ts_free_id');
-  if @zend_strndup = nil then raise EPHP4DelphiException.Create('zend_strndup');
-
-  if @_emalloc = nil then raise EPHP4DelphiException.Create('_emalloc');
-  if @_efree = nil then raise EPHP4DelphiException.Create('_efree');
-  if @_ecalloc = nil then raise EPHP4DelphiException.Create('_ecalloc');
-  if @_erealloc = nil then raise EPHP4DelphiException.Create('_erealloc');
-  if @_estrdup = nil then raise EPHP4DelphiException.Create('_estrdup');
-  if @_estrndup = nil then raise EPHP4DelphiException.Create('_estrndup');
-  if @zend_set_memory_limit = nil then raise EPHP4DelphiException.Create('zend_set_memory_limit');
-  if @start_memory_manager = nil then raise EPHP4DelphiException.Create('start_memory_manager');
-  if @shutdown_memory_manager = nil then raise EPHP4DelphiException.Create('shutdown_memory_manager');
-  {$IFDEF PHP4}
-  if @zend_hash_init = nil then raise EPHP4DelphiException.Create('zend_hash_init');
-  if @zend_hash_init_ex = nil then raise EPHP4DelphiException.Create('zend_hash_init_ex');
-  if @zend_hash_add_or_update = nil then raise EPHP4DelphiException.Create('zend_hash_add_or_update');
-  if @zend_hash_quick_add_or_update = nil then raise EPHP4DelphiException.Create('zend_hash_quick_add_or_update');
-  if @zend_hash_index_update_or_next_insert = nil then raise EPHP4DelphiException.Create('zend_hash_index_update_or_next_insert');
-  if @zend_hash_merge = nil then raise EPHP4DelphiException.Create('zend_hash_merge');
-  {$ENDIF}
-
-  {$IFDEF PHP5}
-  if @_zend_hash_add_or_update = nil then raise EPHP4DelphiException.Create('_zend_hash_add_or_update');
-  {$ENDIF}
-
-  if @zend_hash_destroy = nil then raise EPHP4DelphiException.Create('zend_hash_destroy');
-  if @zend_hash_clean = nil then raise EPHP4DelphiException.Create('zend_hash_clean');
-  if @zend_hash_add_empty_element = nil then raise EPHP4DelphiException.Create('zend_hash_add_empty_element');
-  if @zend_hash_graceful_destroy = nil then raise EPHP4DelphiException.Create('zend_hash_graceful_destroy');
-  if @zend_hash_graceful_reverse_destroy = nil then raise EPHP4DelphiException.Create('zend_hash_graceful_reverse_destroy');
-  if @zend_hash_apply = nil then raise EPHP4DelphiException.Create('zend_hash_apply');
-  if @zend_hash_apply_with_argument = nil then raise EPHP4DelphiException.Create('zend_hash_apply_with_argument');
-  if @zend_hash_reverse_apply = nil then raise EPHP4DelphiException.Create('zend_hash_reverse_apply');
-  if @zend_hash_del_key_or_index = nil then raise EPHP4DelphiException.Create('zend_hash_del_key_or_index');
-  if @zend_get_hash_value = nil then raise EPHP4DelphiException.Create('zend_get_hash_value');
-  if @zend_hash_find = nil then raise EPHP4DelphiException.Create('zend_hash_find');
-  if @zend_hash_quick_find = nil then raise EPHP4DelphiException.Create('zend_hash_quick_find');
-  if @zend_hash_index_find = nil then raise EPHP4DelphiException.Create('zend_hash_index_find');
-  if @zend_hash_exists = nil then raise EPHP4DelphiException.Create('zend_hash_exists');
-  if @zend_hash_index_exists = nil then raise EPHP4DelphiException.Create('zend_hash_index_exists');
-  {$IFDEF PHP7}
-  if @_zend_hash_add = nil then raise EPHP4DelphiException.Create('_zend_hash_add');
-  if @_zend_hash_add_or_update = nil then raise EPHP4DelphiException.Create('_zend_hash_add_or_update');
-
-  if @zend_hash_index_findZval = nil then raise EPHP4DelphiException.Create('zend_hash_index_findZval');
-  if @zend_symtable_findTest = nil then raise EPHP4DelphiException.Create('zend_symtable_findTest');
-  if @zend_hash_index_existsZval = nil then raise EPHP4DelphiException.Create('zend_hash_index_existsZval');
-
-  {$ENDIF}
-  {$IFNDEF PHP7}
-  if @zend_hash_next_free_element = nil then raise EPHP4DelphiException.Create('zend_hash_next_free_element');
-  {$ENDIF}
-  if @zend_hash_move_forward_ex = nil then raise EPHP4DelphiException.Create('zend_hash_move_forward_ex');
-  if @zend_hash_move_backwards_ex = nil then raise EPHP4DelphiException.Create('zend_hash_move_backwards_ex');
-  if @zend_hash_get_current_key_ex = nil then raise EPHP4DelphiException.Create('zend_hash_get_current_key_ex');
-  if @zend_hash_get_current_key_type_ex = nil then raise EPHP4DelphiException.Create('zend_hash_get_current_key_type_ex');
-  if @zend_hash_get_current_data_ex = nil then raise EPHP4DelphiException.Create('zend_hash_get_current_data_ex');
-  if @zend_hash_internal_pointer_reset_ex = nil then raise EPHP4DelphiException.Create('zend_hash_internal_pointer_reset_ex');
-  if @zend_hash_internal_pointer_end_ex = nil then raise EPHP4DelphiException.Create('zend_hash_internal_pointer_end_ex');
-  if @zend_hash_copy = nil then raise EPHP4DelphiException.Create('zend_hash_copy');
-  if @zend_hash_sort = nil then raise EPHP4DelphiException.Create('zend_hash_sort');
-  if @zend_hash_compare = nil then raise EPHP4DelphiException.Create('zend_hash_compare');
-  if @zend_hash_minmax = nil then raise EPHP4DelphiException.Create('zend_hash_minmax');
-  if @zend_hash_num_elements = nil then raise EPHP4DelphiException.Create('zend_hash_num_elements');
-  if @zend_hash_rehash = nil then raise EPHP4DelphiException.Create('zend_hash_rehash');
-  if @zend_hash_func = nil then raise EPHP4DelphiException.Create('zend_hash_func');
-  if @zend_get_constant = nil then raise EPHP4DelphiException.Create('zend_get_constant');
-  if @zend_register_long_constant = nil then raise EPHP4DelphiException.Create('zend_register_long_constant');
-  if @zend_register_double_constant = nil then raise EPHP4DelphiException.Create('zend_register_double_constant');
-  if @zend_register_string_constant = nil then raise EPHP4DelphiException.Create('zend_register_string_constant');
-  if @zend_register_stringl_constant = nil then raise EPHP4DelphiException.Create('zend_register_stringl_constant');
-  if @zend_register_constant = nil then raise EPHP4DelphiException.Create('zend_register_constant');
-  if @tsrm_shutdown = nil then raise EPHP4DelphiException.Create('tsrm_shutdown');
-  if @ts_resource_ex = nil then raise EPHP4DelphiException.Create('ts_resource_ex');
-  if @ts_free_thread = nil then raise EPHP4DelphiException.Create('ts_free_thread');
-  if @zend_error = nil then raise EPHP4DelphiException.Create('zend_error');
-  if @zend_error_cb = nil then raise EPHP4DelphiException.Create('zend_error_cb');
-  if @zend_eval_string = nil then raise EPHP4DelphiException.Create('zend_eval_string');
-  if @zend_make_compiled_string_description = nil then raise EPHP4DelphiException.Create('zend_make_compiled_string_description');
-
-  {$IFDEF PHP4}
-  if @_zval_dtor = nil then raise EPHP4DelphiException.Create('_zval_dtor');
-  if @_zval_copy_ctor = nil then raise EPHP4DelphiException.Create('_zval_copy_ctor');
-  {$ELSE}
-  if @_zval_dtor_func = nil then raise EPHP4DelphiException.Create('_zval_dtor_func');
-  if @_zval_copy_ctor_func = nil then raise EPHP4DelphiException.Create('_zval_copy_ctor_func');
- {$ENDIF}
-
-  if @zend_print_variable = nil then raise EPHP4DelphiException.Create('zend_print_variable');
-  if @zend_stack_init = nil then raise EPHP4DelphiException.Create('zend_stack_init');
-  if @zend_stack_push = nil then raise EPHP4DelphiException.Create('zend_stack_push');
-  if @zend_stack_top = nil then raise EPHP4DelphiException.Create('zend_stack_top');
-  if @zend_stack_del_top = nil then raise EPHP4DelphiException.Create('zend_stack_del_top');
-  if @zend_stack_int_top = nil then raise EPHP4DelphiException.Create('zend_stack_int_top');
-  if @zend_stack_is_empty = nil then raise EPHP4DelphiException.Create('zend_stack_is_empty');
-  if @zend_stack_destroy = nil then raise EPHP4DelphiException.Create('zend_stack_destroy');
-  if @zend_stack_base = nil then raise EPHP4DelphiException.Create('zend_stack_base');
-  if @zend_stack_count = nil then raise EPHP4DelphiException.Create('zend_stack_count');
-  if @zend_stack_apply = nil then raise EPHP4DelphiException.Create('zend_stack_apply');
-  if @zend_stack_apply_with_argument = nil then raise EPHP4DelphiException.Create('zend_stack_apply_with_argument');
-  if @_convert_to_string = nil then raise EPHP4DelphiException.Create('_convert_to_string');
-  if @add_function = nil then raise EPHP4DelphiException.Create('add_function');
-  if @sub_function = nil then raise EPHP4DelphiException.Create('sub_function');
-  if @mul_function = nil then raise EPHP4DelphiException.Create('mul_function');
-  if @div_function = nil then raise EPHP4DelphiException.Create('div_function');
-  if @mod_function = nil then raise EPHP4DelphiException.Create('mod_function');
-  if @boolean_xor_function = nil then raise EPHP4DelphiException.Create('boolean_xor_function');
-  if @boolean_not_function = nil then raise EPHP4DelphiException.Create('boolean_not_function');
-  if @bitwise_not_function = nil then raise EPHP4DelphiException.Create('bitwise_not_function');
-  if @bitwise_or_function = nil then raise EPHP4DelphiException.Create('bitwise_or_function');
-  if @bitwise_and_function = nil then raise EPHP4DelphiException.Create('bitwise_and_function');
-  if @bitwise_xor_function = nil then raise EPHP4DelphiException.Create('bitwise_xor_function');
-  if @shift_left_function = nil then raise EPHP4DelphiException.Create('shift_left_function');
-  if @shift_right_function = nil then raise EPHP4DelphiException.Create('shift_right_function');
-  if @concat_function = nil then raise EPHP4DelphiException.Create('concat_function');
-  if @is_equal_function = nil then raise EPHP4DelphiException.Create('is_equal_function');
-  if @is_identical_function = nil then raise EPHP4DelphiException.Create('is_identical_function');
-  if @is_not_identical_function = nil then raise EPHP4DelphiException.Create('is_not_identical_function');
-  if @is_not_equal_function = nil then raise EPHP4DelphiException.Create('is_not_equal_function');
-  if @is_smaller_function = nil then raise EPHP4DelphiException.Create('is_smaller_function');
-  if @is_smaller_or_equal_function = nil then raise EPHP4DelphiException.Create('is_smaller_or_equal_function');
-  if @increment_function = nil then raise EPHP4DelphiException.Create('increment_function');
-  if @decrement_function = nil then raise EPHP4DelphiException.Create('decrement_function');
-  if @convert_scalar_to_number = nil then raise EPHP4DelphiException.Create('convert_scalar_to_number');
-  if @convert_to_long = nil then raise EPHP4DelphiException.Create('convert_to_long');
-  if @convert_to_double = nil then raise EPHP4DelphiException.Create('convert_to_double');
-  if @convert_to_long_base = nil then raise EPHP4DelphiException.Create('convert_to_long_base');
-  if @convert_to_null = nil then raise EPHP4DelphiException.Create('convert_to_null');
-  if @convert_to_boolean = nil then raise EPHP4DelphiException.Create('convert_to_boolean');
-  if @convert_to_array = nil then raise EPHP4DelphiException.Create('convert_to_array');
-  if @convert_to_object = nil then raise EPHP4DelphiException.Create('convert_to_object');
-  if @add_char_to_string = nil then raise EPHP4DelphiException.Create('add_char_to_string');
-  if @add_string_to_string = nil then raise EPHP4DelphiException.Create('add_string_to_string');
-  if @zend_string_to_double = nil then raise EPHP4DelphiException.Create('zend_string_to_double');
-  if @zval_is_true = nil then raise EPHP4DelphiException.Create('zval_is_true');
-  if @compare_function = nil then raise EPHP4DelphiException.Create('compare_function');
-  if @numeric_compare_function = nil then raise EPHP4DelphiException.Create('numeric_compare_function');
-  if @string_compare_function = nil then raise EPHP4DelphiException.Create('string_compare_function');
-  if @zend_str_tolower = nil then raise EPHP4DelphiException.Create('zend_str_tolower');
-  if @zend_binary_zval_strcmp = nil then raise EPHP4DelphiException.Create('zend_binary_zval_strcmp');
-  if @zend_binary_zval_strncmp = nil then raise EPHP4DelphiException.Create('zend_binary_zval_strncmp');
-  if @zend_binary_zval_strcasecmp = nil then raise EPHP4DelphiException.Create('zend_binary_zval_strcasecmp');
-  if @zend_binary_zval_strncasecmp = nil then raise EPHP4DelphiException.Create('zend_binary_zval_strncasecmp');
-  if @zend_binary_strcmp = nil then raise EPHP4DelphiException.Create('zend_binary_strcmp');
-  if @zend_binary_strncmp = nil then raise EPHP4DelphiException.Create('zend_binary_strncmp');
-  if @zend_binary_strcasecmp = nil then raise EPHP4DelphiException.Create('zend_binary_strcasecmp');
-  if @zend_binary_strncasecmp = nil then raise EPHP4DelphiException.Create('zend_binary_strncasecmp');
-  if @zendi_smart_strcmp = nil then raise EPHP4DelphiException.Create('zendi_smart_strcmp');
-  if @zend_compare_symbol_tables = nil then raise EPHP4DelphiException.Create('zend_compare_symbol_tables');
-  if @zend_compare_arrays = nil then raise EPHP4DelphiException.Create('zend_compare_arrays');
-  if @zend_compare_objects = nil then raise EPHP4DelphiException.Create('zend_compare_objects');
-  if @zend_atoi = nil then raise EPHP4DelphiException.Create('zend_atoi');
-  if @get_active_function_name = nil then raise EPHP4DelphiException.Create('get_active_function_name');
-  if @zend_get_executed_filename = nil then raise EPHP4DelphiException.Create('zend_get_executed_filename');
-  if @zend_set_timeout = nil then raise EPHP4DelphiException.Create('zend_set_timeout');
-  if @zend_unset_timeout = nil then raise EPHP4DelphiException.Create('zend_unset_timeout');
-  if @zend_timeout = nil then raise EPHP4DelphiException.Create('zend_timeout');
-  if @zend_highlight = nil then raise EPHP4DelphiException.Create('zend_highlight');
-  if @zend_strip = nil then raise EPHP4DelphiException.Create('zend_strip');
-  if @highlight_file = nil then raise EPHP4DelphiException.Create('highlight_file');
-  if @highlight_string = nil then raise EPHP4DelphiException.Create('highlight_string');
-  if @zend_html_putc = nil then raise EPHP4DelphiException.Create('zend_html_putc');
-  if @zend_html_puts = nil then raise EPHP4DelphiException.Create('zend_html_puts');
-  {$IFDEF PHP7}
-  if @zend_parse_parameters_throw = nil then EPHP4DelphiException.Create('zend_parse_parameters_throw');
-  if @ZvalGetArgs = nil then EPHP4DelphiException.Create('ZvalGetArgs');
-  if @_zend_get_parameters_array_ex = nil then EPHP4DelphiException.Create('_zend_get_parameters_array_ex');
-  {$ELSE}
-  if @zend_indent = nil then raise EPHP4DelphiException.Create('zend_indent');
-  {$ENDIF}
-  if @_zend_get_parameters_array_ex = nil then raise EPHP4DelphiException.Create('_zend_get_parameters_array_ex');
-  if @zend_ini_refresh_caches = nil then raise EPHP4DelphiException.Create('zend_ini_refresh_caches');
-  if @zend_alter_ini_entry = nil then raise EPHP4DelphiException.Create('zend_alter_ini_entry');
-  if @zend_restore_ini_entry = nil then raise EPHP4DelphiException.Create('zend_restore_ini_entry');
-  if @zend_ini_long = nil then raise EPHP4DelphiException.Create('zend_ini_long');
-  if @zend_ini_double = nil then raise EPHP4DelphiException.Create('zend_ini_double');
-  if @zend_ini_string = nil then raise EPHP4DelphiException.Create('zend_ini_string');
-  if @compile_string = nil then raise EPHP4DelphiException.Create('compile_string');
-  if @execute = nil then raise EPHP4DelphiException.Create('execute');
-  if @zend_wrong_param_count = nil then raise EPHP4DelphiException.Create('zend_wrong_param_count');
-  if @add_property_long_ex = nil then raise EPHP4DelphiException.Create('add_property_long_ex');
-  if @add_property_null_ex = nil then raise EPHP4DelphiException.Create('add_property_null_ex');
-  if @add_property_bool_ex = nil then raise EPHP4DelphiException.Create('add_property_bool_ex');
-  if @add_property_resource_ex = nil then raise EPHP4DelphiException.Create('add_property_resource_ex');
-  if @add_property_double_ex = nil then raise EPHP4DelphiException.Create('add_property_double_ex');
-  if @add_property_string_ex = nil then raise EPHP4DelphiException.Create('add_property_string_ex');
-  if @add_property_stringl_ex = nil then raise EPHP4DelphiException.Create('add_property_stringl_ex');
-  if @add_property_zval_ex = nil then raise EPHP4DelphiException.Create('add_property_zval_ex');
-  if @call_user_function = nil then raise EPHP4DelphiException.Create('call_user_function');
-  {$IFNDEF P_CUT}
-  if @call_user_function_ex = nil then raise EPHP4DelphiException.Create('call_user_function_ex');
-  {$ENDIF}
-  if @add_assoc_long_ex = nil then raise EPHP4DelphiException.Create('add_assoc_long_ex');
-  if @add_assoc_null_ex = nil then raise EPHP4DelphiException.Create('add_assoc_null_ex');
-  if @add_assoc_bool_ex = nil then raise EPHP4DelphiException.Create('add_assoc_bool_ex');
-  if @add_assoc_resource_ex = nil then raise EPHP4DelphiException.Create('add_assoc_resource_ex');
-  if @add_assoc_double_ex = nil then raise EPHP4DelphiException.Create('add_assoc_double_ex');
-  if @add_assoc_string_ex = nil then raise EPHP4DelphiException.Create('add_assoc_string_ex');
-  if @add_assoc_stringl_ex = nil then raise EPHP4DelphiException.Create('add_assoc_stringl_ex');
-  if @add_assoc_zval_ex = nil then raise EPHP4DelphiException.Create('add_assoc_zval_ex');
-  if @add_index_long = nil then raise EPHP4DelphiException.Create('add_index_long');
-  if @add_index_null = nil then raise EPHP4DelphiException.Create('add_index_null');
-  if @add_index_bool = nil then raise EPHP4DelphiException.Create('add_index_bool');
-  if @add_index_resource = nil then raise EPHP4DelphiException.Create('add_index_resource');
-  if @add_index_double = nil then raise EPHP4DelphiException.Create('add_index_double');
-  if @add_index_string = nil then raise EPHP4DelphiException.Create('add_index_string');
-  if @add_index_stringl = nil then raise EPHP4DelphiException.Create('add_index_stringl');
-  if @add_index_zval = nil then raise EPHP4DelphiException.Create('add_index_zval');
-  if @add_next_index_long = nil then raise EPHP4DelphiException.Create('add_next_index_long');
-  if @add_next_index_null = nil then raise EPHP4DelphiException.Create('add_next_index_null');
-  if @add_next_index_bool = nil then raise EPHP4DelphiException.Create('add_next_index_bool');
-  if @add_next_index_resource = nil then raise EPHP4DelphiException.Create('add_next_index_resource');
-  if @add_next_index_double = nil then raise EPHP4DelphiException.Create('add_next_index_double');
-  if @add_next_index_string = nil then raise EPHP4DelphiException.Create('add_next_index_string');
-  if @add_next_index_stringl = nil then raise EPHP4DelphiException.Create('add_next_index_stringl');
-  if @add_next_index_zval = nil then raise EPHP4DelphiException.Create('add_next_index_zval');
-  if @add_get_assoc_string_ex = nil then raise EPHP4DelphiException.Create('add_get_assoc_string_ex');
-  if @add_get_assoc_stringl_ex = nil then raise EPHP4DelphiException.Create('add_get_assoc_stringl_ex');
-  if @add_get_index_long = nil then raise EPHP4DelphiException.Create('add_get_index_long');
-  if @add_get_index_double = nil then raise EPHP4DelphiException.Create('add_get_index_double');
-  if @add_get_index_string = nil then raise EPHP4DelphiException.Create('add_get_index_string');
-  if @add_get_index_stringl = nil then raise EPHP4DelphiException.Create('add_get_index_stringl');
-  if @_array_init = nil then raise EPHP4DelphiException.Create('_array_init');
-  if @_object_init = nil then raise EPHP4DelphiException.Create('_object_init');
-  if @_object_init_ex = nil then raise EPHP4DelphiException.Create('_object_init_ex');
-  if @_object_and_properties_init = nil then raise EPHP4DelphiException.Create('_object_and_properties_init');
-  if @zend_register_internal_class = nil then raise EPHP4DelphiException.Create('zend_register_internal_class');
-  if @zend_register_internal_class_ex = nil then raise EPHP4DelphiException.Create('zend_register_internal_class_ex');
-  if @zend_startup_module = nil then raise EPHP4DelphiException.Create('zend_startup_module');
-  if @zend_startup_module_ex = nil then raise EPHP4DelphiException.Create('zend_startup_module_ex');
-  if @zend_register_module_ex = nil then raise EPHP4DelphiException.Create('zend_register_module_ex');
-  if @zend_register_internal_module = nil then raise EPHP4DelphiException.Create('zend_register_internal_module');
-  if @zend_startup_modules = nil then raise EPHP4DelphiException.Create('zend_startup_modules');
-  if @zend_collect_module_handlers = nil then raise EPHP4DelphiException.Create('zend_collect_module_handlers');
-
-  if @get_zend_version = nil then raise EPHP4DelphiException.Create('get_zend_version');
-  if @zend_make_printable_zval = nil then raise EPHP4DelphiException.Create('zend_make_printable_zval');
-  if @zend_print_zval = nil then raise EPHP4DelphiException.Create('zend_print_zval');
-  if @zend_print_zval_r = nil then raise EPHP4DelphiException.Create('zend_print_zval_r');
-  if @zend_output_debug_string = nil then raise EPHP4DelphiException.Create('zend_output_debug_string');
-  if @ZendGetParameters = nil then raise EPHP4DelphiException.Create('zend_get_parameters');
-end;
-{$ENDIF}
-
 function zend_hash_get_current_data(ht:  {$IFDEF PHP7} Pzend_array {$ELSE} PHashTable{$ENDIF}; pData: Pointer): Integer; cdecl;
 begin
   result := zend_hash_get_current_data_ex(ht, pData, cardinal(nil));
@@ -3559,13 +3198,6 @@ function tsrmls_fetch : pointer;
   result := ts_resource_ex(0, nil);
 end;
 
-{$IFDEF PHP4}
-function zval_copy_ctor(val : pzval) : integer;
-begin
-  result := _zval_copy_ctor(val, nil, 0);
-end;
-{$ENDIF}
-
 function zend_unregister_functions(functions : {$IFDEF PHP7}P_zend_function_entry{$ELSE}pzend_function_entry{$ENDIF}; count : integer; function_table :  {$IFDEF PHP7} Pzend_array {$ELSE} PHashTable{$ENDIF}; TSRMLS_DC : pointer) : integer;
 var
  i : integer;
@@ -3669,30 +3301,41 @@ function zend_register_functions(functions : {$IFDEF PHP7}P_zend_function_entry{
 
 end;
 
-
+function __asm_fetchval
+{$IFDEF CPUX64}
+(val_id: int64; tsrmls_dc_p: pointer)
+{$ELSE}
+(val_id: integer; tsrmls_dc_p: pointer)
+{$ENDIF}
+: pointer; assembler; register;
+{$IFDEF CPUX64}
+asm
+  mov rcx, val_id
+  mov rdx, dword64 ptr tsrmls_dc_p
+  mov rax, dword64 ptr [rdx]
+  mov rcx, dword64 ptr [rax+rcx*8-8]
+  mov Result, rcx
+end;
+{$ELSE}
+asm
+  mov ecx, val_id
+  mov edx, dword ptr tsrmls_dc_p
+  mov eax, dword ptr [edx]
+  mov ecx, dword ptr [eax+ecx*4-4]
+  mov Result, ecx
+end;
+{$ENDIF}
 
 function GetGlobalResource(resource_name: AnsiString) : pointer;
 var
  global_id : pointer;
- global_value : integer;
- global_ptr   : pointer;
- tsrmls_dc : pointer;
 begin
   Result := nil;
   try
     global_id := GetProcAddress(PHPLib, zend_pchar(resource_name));
     if Assigned(global_id) then
      begin
-       tsrmls_dc := tsrmls_fetch;
-       global_value := integer(global_id^);
-       asm
-         mov ecx, global_value
-         mov edx, dword ptr tsrmls_dc
-         mov eax, dword ptr [edx]
-         mov ecx, dword ptr [eax+ecx*4-4]
-         mov global_ptr, ecx
-       end;
-       Result := global_ptr;
+       Result := __asm_fetchval(integer(global_id^), tsrmls_fetch);
      end;
   except
     Result := nil;
@@ -3702,23 +3345,13 @@ function GetGlobalResource(resource_name: AnsiString) : pointer;
 function GetGlobalResourceDC(resource_name: AnsiString;TSRMLS_DC:pointer) : pointer;
 var
  global_id : pointer;
- global_value : integer;
- global_ptr   : pointer;
 begin
   Result := nil;
   try
     global_id := GetProcAddress(PHPLib, zend_pchar(resource_name));
     if Assigned(global_id) then
      begin
-       global_value := integer(global_id^);
-       asm
-         mov ecx, global_value
-         mov edx, dword ptr TSRMLS_DC
-         mov eax, dword ptr [edx]
-         mov ecx, dword ptr [eax+ecx*4-4]
-         mov global_ptr, ecx
-       end;
-       Result := global_ptr;
+       Result := __asm_fetchval(integer(global_id^), TSRMLS_DC);
      end;
   except
     Result := nil;
@@ -3763,6 +3396,20 @@ procedure copy_zend_constant(C: PZendConstant); cdecl;
 end;
 
 function object_init(arg: pzval; ce: pzend_class_entry; TSRMLS_DC : pointer) : integer; cdecl; assembler;
+{$IFDEF CPUX64}
+asm
+  mov rax, [rsp + 32]
+  mov rcx, [rsp + 24]
+  mov rdx, [rsp + 16]
+  pop rbp
+  push rax
+  push rcx
+  push rdx
+  call _object_init_ex
+  add rsp, $0c
+  ret
+end;
+{$ELSE}
 asm
   mov eax, [esp + 16]
   mov ecx, [esp + 12]
@@ -3775,6 +3422,7 @@ function object_init(arg: pzval; ce: pzend_class_entry; TSRMLS_DC : pointer) : i
   add esp, $0c
   ret
 end;
+{$ENDIF}
 
 
 function Z_LVAL(z : pzval) : longint;
@@ -3948,6 +3596,79 @@ function Z_STRWVAL(z : pzval) : String;
     end;
 end;
 
+function Z_CHAR(z: PZval) : zend_uchar;
+var S: zend_ustr;
+begin
+Result := #0;
+  if z = nil then
+      exit;
+
+  if {$IFDEF PHP7}z.u1.v._type{$ELSE}z._type{$ENDIF} = IS_STRING then
+     S := z.value.str.val
+  else
+    case {$IFDEF PHP7}z.u1.v._type{$ELSE}z._type{$ENDIF} of
+       IS_LONG: S := IntToStr(z.value.lval);
+       IS_DOUBLE: S := FloatToStr(z.value.dval);
+       IS_BOOL: if z.value.lval = 0 then S := '0' else S := '1';
+    end;
+  SetLength(S,1);
+  Result := zend_uchar(S[1]);
+end;
+function Z_ACHAR(z: PZVAL): AnsiChar;
+var S: AnsiString;
+begin
+Result := #0;
+  if z = nil then
+      exit;
+
+  if {$IFDEF PHP7}z.u1.v._type{$ELSE}z._type{$ENDIF} = IS_STRING then
+     S := z.value.str.val
+  else
+    case {$IFDEF PHP7}z.u1.v._type{$ELSE}z._type{$ENDIF} of
+       IS_LONG: S := IntToStr(z.value.lval);
+       IS_DOUBLE: S := FloatToStr(z.value.dval);
+       IS_BOOL: if z.value.lval = 0 then S := '0' else S := '1';
+    end;
+  SetLength(S,1);
+  Result := AnsiChar(S[1]);
+end;
+function Z_WCHAR(z: PZVAL): WideChar;
+var S: WideString;
+begin
+Result := #0;
+  if z = nil then
+      exit;
+
+  if {$IFDEF PHP7}z.u1.v._type{$ELSE}z._type{$ENDIF} = IS_STRING then
+     S := z.value.str.val
+  else
+    case {$IFDEF PHP7}z.u1.v._type{$ELSE}z._type{$ENDIF} of
+       IS_LONG: S := IntToStr(z.value.lval);
+       IS_DOUBLE: S := FloatToStr(z.value.dval);
+       IS_BOOL: if z.value.lval = 0 then S := '0' else S := '1';
+    end;
+  SetLength(S,1);
+  Result := WideChar(S[1]);
+end;
+function Z_UCHAR(z: PZVAL): UTF8Char;
+var S: UTF8String;
+begin
+Result := #0;
+  if z = nil then
+      exit;
+
+  if {$IFDEF PHP7}z.u1.v._type{$ELSE}z._type{$ENDIF} = IS_STRING then
+     S := z.value.str.val
+  else
+    case {$IFDEF PHP7}z.u1.v._type{$ELSE}z._type{$ENDIF} of
+       IS_LONG: S := IntToStr(z.value.lval);
+       IS_DOUBLE: S := FloatToStr(z.value.dval);
+       IS_BOOL: if z.value.lval = 0 then S := '0' else S := '1';
+    end;
+  SetLength(S,1);
+  Result := Utf8Char(S[1]);
+end;
+
 function Z_STRLEN(z : pzval) : longint;
 begin
   Result := Length(Z_STRVAL(z));
@@ -3968,15 +3689,14 @@ function Z_OBJ_HT(z : pzval) : {$IFDEF PHP7}hzend_types.P_zend_object_handlers{$
   Result := z.value.obj.handlers;
 end;
 
-function Z_OBJPROP(z : pzval) : {$IFDEF PHP7}hzend_types.PHashTable{$ELSE}PHashTable{$ENDIF};
+function Z_OBJPROP(z : pzval;TSRMLS_DC:pointer=nil) : {$IFDEF PHP7}hzend_types.PHashTable{$ELSE}PHashTable{$ENDIF};
 {$IFDEF PHP7}
 begin
   Result := Z_OBJ_HT(z)^.get_properties(z);
 end;
 {$ELSE}
-var
- TSRMLS_DC : pointer;
 begin
+  if TSRMLS_DC = nil then
   TSRMLS_DC := ts_resource_ex(0, nil);
   Result := Z_OBJ_HT(z)^.get_properties(@z, TSRMLS_DC);
 end;
diff --git a/Source/ZendTypes.pas b/Source/ZendTypes.pas
index b48329a..0de67d3 100644
--- a/Source/ZendTypes.pas
+++ b/Source/ZendTypes.pas
@@ -478,12 +478,27 @@ interface
 
 { Common Types }
 type
-  zend_uint   = uint;
+  CharPtr =
+  {$IFDEF VERSION12}
+    WideChar
+  {$ELSE}
+    AnsiChar
+  {$ENDIF};
+  {$IFDEF CPUX64}
+  IntPtr = Int64;
+  UIntPtr = UInt64;
+  ULongPtr = ULong64;
+  {$ELSE}
+  IntPtr = Longint;
+  UIntPtr = LongWord;
+  ULongPtr = ULong;
+  {$ENDIF}
+  zend_uint   = UIntPtr;
   zend_bool   = boolean;
   zend_uchar  = {$IFDEF PHP_UNICE}Utf8Char{$ELSE}AnsiChar{$ENDIF};
   zend_ustr   = {$IFDEF PHP_UNICE}Utf8String{$ELSE}AnsiString{$ENDIF};
-  zend_ulong  = ulong;
-  zend_long   = integer;
+  zend_ulong  = ULongPtr;
+  zend_long   = IntPtr;
   zend_pchar  = {$IFDEF PHP_UNICE}PUtf8Char{$ELSE}PAnsiChar{$ENDIF};
   zend_pstr   = {$IFDEF PHP_UNICE}PUtf8String{$ELSE}PAnsiString{$ENDIF};
   {$IFDEF PHP7}
@@ -800,23 +815,7 @@   zend_function = record
   Pzend_class_entry = ^Tzend_class_entry;
   PPZend_class_entry = ^PZend_class_entry;
   {$ENDIF}
-  {$IFDEF PHP4}
-  Tzend_class_entry =
-    record
-    _type: zend_uchar;
-    name: zend_pchar;
-    name_length: uint;
-    parent: pointer;
-    refcount: pointer;
-    constants_updated: boolean;
-    function_table: THashTable;
-    default_properties: THashTable;
-    builtin_functions: pointer;
-    handle_function_call: pointer;
-    handle_property_get: pointer;
-    handle_property_set: pointer;
-  end;
-  {$ELSE}
+
   {$IFNDEF PHP7}
   Tzend_class_entry = record
    _type : zend_uchar;
@@ -879,7 +878,7 @@   Tzend_class_entry = record
    module : pointer;
   end;
   {$ENDIF}
-  {$ENDIF}
+
   {$IFNDEF PHP7}
   //P_zend_object_handlers = ^_zend_object_handlers;
   Pzend_Object = ^Tzend_object;
@@ -912,7 +911,7 @@   _zend_object = record
    Tzend_object_get_classname  = function(_object : pointer; class_name : pointer; class_name_len : pointer; p : integer; TSRMLS_DC : pointer) : integer; cdecl;
 
  {$IFNDEF PHP7}
- zend_object_handlers = record
+ _zend_object_handlers = record
 	// general object functions
 	add_ref : pointer;
 	del_ref : pointer;
@@ -946,7 +945,8 @@  zend_object_handlers = record
    {$ENDIF}
    zend_object_handle = cardinal;
   {$IFNDEF PHP7}
-  pzend_object_handlers = ^zend_object_handlers;
+  zend_object_handlers = _zend_object_handlers;
+  pzend_object_handlers = ^_zend_object_handlers;
 
 
   _zend_object_value = record
@@ -969,24 +969,10 @@   zvalue_value = record
           len: integer;
         end);
       3: (ht: PHashTable);
-      {$IFDEF PHP4}
-      4: (obj: Tzend_Object);
-      {$ELSE}
       4 : (obj :  _zend_object_value);
-      {$ENDIF}
   end;
   pppzval = ^ppzval;
   ppzval = ^pzval;
- {$IFDEF PHP4}
-  Pzval = ^zval;
-  zval = record
-    value: zvalue_value;
-    _type: Byte;
-    is_ref: Byte;
-    refcount: Smallint;
-  end;
-  Tzval = zval;
- {$ELSE}
 
   pzval = ^zval;
   zval = record
@@ -995,14 +981,14 @@   zval = record
    _type : byte;
    is_ref : byte;
   end;
- {$ENDIF}
+
 {$ENDIF}
 
   ppzval_array = ^pzval_array;
+
   pzval_array = array of ppzval;
   pzval_array_ex = array of pzval;
 
-
 type
   PZend_rsrc_list_entry = ^zend_rsrc_list_entry;
   zend_rsrc_list_entry = record
@@ -1088,7 +1074,7 @@   _zend_stream = record
   PZendFileHandle = ^TZendFileHandle;
   zend_file_handle =
     record
-    {$IFDEF PHP530}
+    {$IF Defined(PHP530) or Defined(PHP540) or Defined(PHP550) or Defined(PHP560) or Defined(PHP700)}
     _type : zend_stream_type;
     {$ELSE}
     _type: uchar;
@@ -1098,22 +1084,19 @@   _zend_stream = record
     handle:
     record
       case Integer of
-        1:
-        (
-          fd: Integer;
-          );
-        2:
-        (
-          fp: pointer;
-          );
-        {$IFDEF PHP5}
-        3 :
-        (
-         stream : TZendStream;
-         );
+        {$IFDEF PHP7}
+        0:( fd: Integer; );
+        1:( fp: pointer; );
+        2 : ( stream : TZendStream; );
+        {$ELSE}
+        1:( fd: Integer; );
+        2:( fp: pointer; );
+          {$IFDEF PHP5}
+          3 : ( stream : TZendStream; );
+          {$ENDIF}
         {$ENDIF}
     end;
-    free_filename: shortint;
+    free_filename: {$IFDEF PHP7}byte{$ELSE}shortint{$ENDIF};
   end;
   TZendFileHandle = zend_file_handle;
 
@@ -1180,13 +1163,9 @@    _zend_arg_info = record
   zend_function_entry = record
     fname: zend_pchar;
     handler: pointer;
-    {$IFDEF PHP4}
-    func_arg_types: Pbyte;
-    {$ELSE}
      arg_info : PZendArgInfo;
      num_args : zend_uint;
      flags : zend_uint;
-    {$ENDIF}
   end;
   Tzend_function_entry = zend_function_entry;
   TZendFunctionEntry = zend_function_entry;
@@ -1502,21 +1481,10 @@   zend_executor_globals  = record
      symtable_cache_ptr : ^PHashTable;
 
      opline_ptr : pointer;
-
-     {$IFDEF PHP4}
-     current_execute_data : pointer;
-     {$ENDIF}
-
      active_symbol_table : PHashTable;
      symbol_table : {$IFDEF PHP7}HashTable{$ELSE}THashTable{$ENDIF};	// main symbol table
-
      included_files : {$IFDEF PHP7}HashTable{$ELSE}THashTable{$ENDIF};	// files already included */
-
-     {$IFDEF PHP4}
-     bailout : jump_buf;
-     {$ELSE}
      bailout : p_jump_buf;
-     {$ENDIF}
 
      error_reporting : integer;
      orig_error_reporting : integer;
@@ -1545,10 +1513,6 @@   zend_executor_globals  = record
      {$ENDIF}
      {$ENDIF}
 
-     {$IFDEF PHP4}
-     bailout_set : zend_bool;
-     {$ENDIF}
-
      full_tables_cleanup : zend_bool;
      {$IFDEF PHP5}
      ze1_compatibility_mode : zend_bool;
diff --git a/Source/php4AppUnit.pas b/Source/php4AppUnit.pas
index 71e903b..459d395 100644
--- a/Source/php4AppUnit.pas
+++ b/Source/php4AppUnit.pas
@@ -35,9 +35,7 @@  TPHPInfoBlock = class
  private
   FBuffer  : zend_ustr;
   FVarList : TStringList;
-  {$IFDEF PHP5}
   FVirtualStream : TMemoryStream;
-  {$ENDIF}
   procedure SetVarList(AValue : TStringList);
  public
   constructor Create; virtual;
@@ -190,26 +188,23 @@ procedure PrepareStartup;
   php_delphi_module.module_shutdown_func := nil;
   php_delphi_module.info_func := @php_info_delphi;
   php_delphi_module.version := '7.4';
-  {$IFDEF PHP4}
-  php_delphi_module.global_startup_func := nil;
-  {$ENDIF}
   php_delphi_module.request_shutdown_func := nil;
-  {$IFDEF PHP5}
+
   {$IFNDEF PHP520}
   php_delphi_module.global_id := 0;
   {$ENDIF}
-  {$ENDIF}
+
   php_delphi_module.module_started := 0;
   php_delphi_module._type := 0;
   php_delphi_module.handle := nil;
   php_delphi_module.module_number := 0;
 
   {$IFDEF PHP530}
-  {$IFNDEF COMPILER_VC9}
-  php_delphi_module.build_id := strdup(zend_pchar(ZEND_MODULE_BUILD_ID));
-  {$ELSE}
-  php_delphi_module.build_id := DupStr(zend_pchar(ZEND_MODULE_BUILD_ID));
-  {$ENDIF}
+    {$IFNDEF COMPILER_VC9}
+      php_delphi_module.build_id := strdup(zend_pchar(ZEND_MODULE_BUILD_ID));
+    {$ELSE}
+      php_delphi_module.build_id := DupStr(zend_pchar(ZEND_MODULE_BUILD_ID));
+    {$ENDIF}
   {$ENDIF}
 
 end;
@@ -228,18 +223,7 @@ procedure PrepareResult(RequestID : integer; TSRMLS_D : pointer);
 
 begin
   InfoBlock := TPHPInfoBlock(RequestID);
-
-  {$IFDEF PHP4}
-   ht := GetSymbolsTable
-  {$ELSE}
-    begin
-     EG := GetExecutorGlobals;
-     if Assigned(EG) then
-     ht := @EG.symbol_table
-      else
-        ht := nil;
-    end ;
-  {$ENDIF}
+   ht := GetSymbolsTable;
 
   if Assigned(ht) then
    begin
@@ -285,8 +269,7 @@ function ExecutePHP(RequestID : integer; FileName : zend_pchar) : integer; stdca
    file_handle.opened_path := nil;
    file_handle.free_filename := 0;
    file_handle.handle.fp := nil;
-
-   PG(TSRMLS_D)^.register_globals := true;
+   GetPHPGlobals(TSRMLS_D)^.register_globals := true;
    gl := GetSAPIGlobals;
    TPHPInfoBlock(RequestID).FBuffer := '';
    gl^.server_context := pointer(RequestID);
@@ -295,9 +278,8 @@ function ExecutePHP(RequestID : integer; FileName : zend_pchar) : integer; stdca
 
    php_request_startup(TSRMLS_D);
    result := php_execute_script(@file_handle, TSRMLS_D);
-   {$IFDEF PHP5}
    zend_destroy_file_handle(@file_handle, TSRMLS_D);
-   {$ENDIF}
+
    PrepareResult(RequestID, TSRMLS_D);
    php_request_shutdown(nil);
   except
@@ -477,7 +459,7 @@ function ExecuteCode(RequestID : integer; ACode : zend_pchar) : integer; stdcall
 
   TSRMLS_D := ts_resource_ex(0, nil);
 
-  PG(TSRMLS_D)^.register_globals := true;
+  GetPHPGlobals(TSRMLS_D)^.register_globals := true;
   gl := GetSAPIGlobals;
   TPHPInfoBlock(RequestID).FBuffer := '';
   gl^.server_context := pointer(RequestID);
@@ -645,19 +627,15 @@ constructor TPHPInfoBlock.Create;
   inherited Create;
   FBuffer := '';
   FVarList := TStringList.Create;
-  {$IFDEF PHP5}
   FVirtualStream := TMemoryStream.Create;
-  {$ENDIF}
 end;
 
 destructor TPHPInfoBlock.Destroy;
 begin
   FBuffer := '';
   FVarList.Free;
-  {$IFDEF PHP5}
   if FVirtualStream <> nil then
    FreeAndNil(FVirtualStream);
-  {$ENDIF}
   inherited;
 end;
 
@@ -733,7 +711,9 @@ procedure StopEngine;
      try
        delphi_sapi_module.shutdown(@delphi_sapi_module);
        sapi_shutdown;
+       {$IF not Defined(PHP550) and not Defined(PHP560)}
        tsrm_shutdown();
+       {$ENDIF}
      except
      end;
    end;
diff --git a/Source/php4delphi.pas b/Source/php4delphi.pas
index 35a7d96..33ffd04 100644
--- a/Source/php4delphi.pas
+++ b/Source/php4delphi.pas
@@ -94,9 +94,10 @@   TpsvCustomPHP = class(TPHPComponent)
     FRequestType : TPHPRequestType;
     FOnReadResult : TPHPReadResultEvent;
     FContentType: zend_ustr;
-    {$IFDEF PHP5}
-    FVirtualStream : TMemoryStream;
+    {$IFDEF sCPUX64}
+    FCode: zend_ustr;
     {$ENDIF}
+    FVirtualStream : TStringStream;
     procedure SetVariables(Value : TPHPVariables);
     procedure SetHeaders(Value : TPHPHeaders);
     function GetVariableCount: integer;
@@ -108,7 +109,7 @@   TpsvCustomPHP = class(TPHPComponent)
     procedure PrepareVariables; virtual;
     function RunTime : boolean;
     function GetThreadSafeResourceManager : pointer;
-    function  CreateVirtualFile(ACode : zend_ustr) : boolean;
+    function  CreateVirtualFile(A_code: zend_ustr) : boolean;
     procedure CloseVirtualFile;
     {$IFDEF PHP4}
     property  VirtualCode : string read FVirtualCode;
@@ -865,10 +866,10 @@ procedure delphi_error_cb(_type : integer; const error_filename : zend_pchar;
                 else
                     error_type_str := 'Unknown error';
                end;
-              {$IFDEF P_CUT}
-               ShowMessage(zend_pchar(
+              {$IFDEF CUTTED_PHP7dll}
+               ShowMessage(
                 {$IFDEF PHP_UNICE}Format{$ELSE}AnsiFormat{$ENDIF}
-                ('PHP4DELPHI %s:  %s in %s on line %d', [error_type_str, buffer, error_filename, error_lineno])));
+                ('PHP4DELPHI %s:  %s in %s on line %d', [error_type_str, buffer, error_filename, error_lineno]));
               {$ELSE}
                 php_log_err(zend_pchar(
                {$IFDEF PHP_UNICE}Format{$ELSE}AnsiFormat{$ENDIF}
@@ -990,7 +991,7 @@ constructor TpsvCustomPHP.Create(AOwner: TComponent);
   {$IFDEF PHP4}
   FVirtualCode := '';
   {$ELSE}
-  FVirtualStream := TMemoryStream.Create;
+  FVirtualStream := TStringStream.Create;
   {$ENDIF}
 end;
 
@@ -1031,6 +1032,9 @@ function TpsvCustomPHP.Execute : zend_ustr;
   {$IFDEF PHP5}
   ZendStream : TZendStream;
   {$ENDIF}
+  {$IFDEF sCPUX64}
+  z: pzval;
+  {$ENDIF}
 begin
 
   if not EngineActive then
@@ -1062,27 +1066,24 @@ function TpsvCustomPHP.Execute : zend_ustr;
       if not FileExists(FFileName) then
         raise Exception.CreateFmt('File %s does not exists', [FFileName]);
      end;
-
     StartupRequest;
 
-
     ZeroMemory(@file_handle, sizeof(zend_file_handle));
-
+    {$IFNDEF sCPUX64}
     if FUseMapping then
      begin
        {$IFDEF PHP5}
        ZeroMemory(@ZendStream, sizeof(ZendStream));
        ZendStream.reader := delphi_stream_reader;
        ZendStream.closer := delphi_stream_closer;
-       {$IFDEF PHP530}
-       ZendStream.fsizer := delphi_stream_fsizer;
-       {$ELSE}
-       {$IFDEF PHP510}
-       ZendStream.fteller := delphi_stream_teller;
-       {$ENDIF}
-       ZendStream.interactive := 0;
-       {$ENDIF}
-
+         {$IFDEF PHP530}
+            ZendStream.fsizer := delphi_stream_fsizer;
+          {$ELSE}
+            {$IFDEF PHP510}
+             ZendStream.fteller := delphi_stream_teller;
+            {$ENDIF}
+            ZendStream.interactive := 0;
+          {$ENDIF}
        ZendStream.handle := FVirtualStream;
 
        file_handle._type := ZEND_HANDLE_STREAM;
@@ -1101,6 +1102,10 @@ function TpsvCustomPHP.Execute : zend_ustr;
        {$ENDIF}
      end
       else
+    {$ENDIF}
+    {$IFDEF CPUX64}
+      if not FUseMapping then
+    {$ENDIF}
        begin
          file_handle._type := ZEND_HANDLE_FILENAME;
          file_handle.filename := zend_pchar(FFileName);
@@ -1109,7 +1114,21 @@ function TpsvCustomPHP.Execute : zend_ustr;
        end;
 
     try
-      php_execute_script(@file_handle, TSRMLS_D);
+    begin
+      //ShowMessage('php_execute_script');
+      {$IFDEF CPUX64}
+      if FUseMapping then
+      begin
+        ShowMessage('eval');
+        z := ALLOC_ZVAL;
+        INIT_PZVAL(z);
+        z^._type := IS_STRING;
+        zend_eval_string(zend_pchar(FCode), z, 'SAPI execution', TSRMLS_D);
+      end
+      else
+      {$ENDIF}
+        PHPAPI.php_execute_script(@file_handle, TSRMLS_D);
+    end
     except
       FBuffer.Clear;
       try
@@ -1147,7 +1166,7 @@ function TpsvCustomPHP.Execute : zend_ustr;
   end;
 end;
 
-function TpsvCustomPHP.RunCode(ACode : zend_ustr) : zend_ustr;
+function TpsvCustomPHP.RunCode(Acode : zend_ustr) : zend_ustr;
 begin
   if not EngineActive then
    begin
@@ -1158,19 +1177,26 @@ function TpsvCustomPHP.RunCode(ACode : zend_ustr) : zend_ustr;
   ClearHeaders;
   ClearBuffer;
   FUseMapping := true;
+
   try
    if FUseDelimiters then
     begin
       if Pos('<?', ACode) = 0 then
         ACode := Format('<? %s ?>', [ACode]);
     end;
+      {$IFDEF CPUX64}
+      FCode := Acode;
+      {$ELSE}
     if not CreateVirtualFile(ACode) then
       begin
         Result := '';
         Exit;
       end;
+      {$ENDIF}
      Result := Execute;
+     {$IFNDEF CPUX64}
      CloseVirtualFile;
+     {$ENDIF}
      finally
        FUseMapping := false;
      end;
@@ -1208,25 +1234,12 @@ procedure TpsvCustomPHP.PrepareResult;
   data: ^ppzval;
   cnt : integer;
   variable : pzval;
-  {$IFDEF PHP5}
-  EG : pzend_executor_globals;
-  {$ENDIF}
 begin
   if FVariables.Count = 0 then
    Exit;
 
   if FExecuteMethod = emServer then
-  {$IFDEF PHP4}
    ht := GetSymbolsTable
-  {$ELSE}
-    begin
-     EG := GetExecutorGlobals;
-     if Assigned(EG) then
-     ht := @EG.symbol_table
-      else
-        ht := nil;
-    end
-  {$ENDIF}
     else
      ht := GetTrackHash('_GET');
   if Assigned(ht) then
@@ -1278,19 +1291,22 @@ procedure TpsvCustomPHP.StartupRequest;
 
   gl := GetSAPIGlobals;
   gl^.server_context := Self;
-
+  //ShowMessage('TpsvCustomPHP.StartupRequest -- RegisterGlobals');
   if PHPEngine.RegisterGlobals then
    GetPHPGlobals(TSRMLS_D)^.register_globals := true;
-
+  //ShowMessage('TpsvCustomPHP.StartupRequest -- Try');
   try
+  //ShowMessage('TpsvCustomPHP.StartupRequest -- FOnReadPost');
     if Assigned(FOnReadPost) then
      FOnReadPost(Self, FPostStream);
-
+   //ShowMessage('TpsvCustomPHP.StartupRequest -- zend_alter_ini_entry');
     zend_alter_ini_entry('max_execution_time', 19, zend_pchar(TimeStr), Length(TimeStr), ZEND_INI_SYSTEM, ZEND_INI_STAGE_RUNTIME);
+   //ShowMessage('TpsvCustomPHP.StartupRequest -- php_request_startup');
     php_request_startup(TSRMLS_D);
+   //ShowMessage('TpsvCustomPHP.StartupRequest -- FOnRequestStartup');
     if Assigned(FOnRequestStartup) then
       FOnRequestStartup(Self);
-
+    //ShowMessage('TpsvCustomPHP.StartupRequest --');
     FSessionActive := true;
   except
     FSessionActive := false;
@@ -1406,7 +1422,7 @@ procedure TpsvCustomPHP.CloseVirtualFile;
   {$ENDIF}
 end;
 
-function TpsvCustomPHP.CreateVirtualFile(ACode : zend_ustr): boolean;
+function TpsvCustomPHP.CreateVirtualFile(A_code : zend_ustr): boolean;
 {$IFDEF PHP4}
 var
  _handles : array[0..1] of THandle;
@@ -1422,7 +1438,7 @@ function TpsvCustomPHP.CreateVirtualFile(ACode : zend_ustr): boolean;
      Exit; {empty buffer was provided}
    end;
 
-  FVirtualCode := ACode;
+  FVirtualCode := A_code;
 
   if pipe(@_handles, 4096, 0) = -1 then
    begin
@@ -1436,16 +1452,15 @@ function TpsvCustomPHP.CreateVirtualFile(ACode : zend_ustr): boolean;
   FVirtualWriteHandle := _handles[1];
   Result := true;
   {$ELSE}
-  if ACode = '' then
+  if A_code = '' then
    Exit;
-  try
+   try
     FVirtualStream.Clear;
-    FVirtualStream.Write(ACode[1], Length(ACode));
-    FVirtualStream.Position := 0;
-    Result := true;
-  except
-    Result := false;
-  end;
+    FVirtualStream.WriteString(A_code);
+    FVirtualStream.Seek(0, TSeekOrigin.soBeginning);
+   finally
+    Result := True;
+   end;
   {$ENDIF}
 end;
 
@@ -1531,7 +1546,7 @@ procedure TPHPEngine.HandleRequest(ht: integer; return_value: pzval;
 
   if ht > 0 then
    begin
-     if ( not (zend_get_parameters_ex(ht, Params) = SUCCESS )) then
+     if ( not (zend_get_parameters_my(ht, Params, TSRMLS_DC) = SUCCESS )) then
       begin
         zend_wrong_param_count(TSRMLS_DC);
         Exit;
@@ -1592,7 +1607,7 @@ procedure TPHPEngine.HandleRequest(ht: integer; return_value: pzval;
 
 procedure TPHPEngine.PrepareIniEntry;
 var
-  p   : integer;
+  p, p2   : pointer;
   TimeStr : string;
 begin
   if not PHPLoaded then
@@ -1601,11 +1616,9 @@ procedure TPHPEngine.PrepareIniEntry;
    if FHandleErrors then
    begin
     // p := integer(GetProcAddress(PHPLib, 'zend_do_print'));
-     p := integer(GetProcAddress(PHPLib, 'zend_error_cb'));
-     asm
-       mov edx, dword ptr [p]
-       mov dword ptr [edx], offset delphi_error_cb
-     end;
+     p := GetProcAddress(PHPLib, 'zend_error_cb');
+     p2 := @delphi_error_cb;
+     Move(p, p2, 1);
    end;
     {$IFNDEF PHP540}
   if FSafeMode then
@@ -1707,7 +1720,8 @@ procedure TPHPEngine.RegisterConstants;
       strlen(zend_pchar(ConstantName)) + 1,
       zend_pchar(ConstantValue), CONST_PERSISTENT or CONST_CS, 0, TSRMLS_D);
   end;
-
+  zend_register_bool_constant( zend_pchar('UTF8_SUPPORT'), 13, {$IFDEF PHP_UNICE}TRUE{$ELSE}FALSE{$ENDIF},
+    CONST_PERSISTENT or CONST_CS, 0, TSRMLS_D);
   RegisterInternalConstants(TSRMLS_D);
 end;
 
@@ -1752,12 +1766,13 @@ procedure TPHPEngine.ShutdownEngine;
      {Shutdown PHP thread safe resource manager}
      if Assigned(FOnEngineShutdown) then
        FOnEngineShutdown(Self);
-
+    {$IF not Defined(PHP550) and not Defined(PHP560)}
     try
     tsrm_shutdown();
     except
 
     end;
+    {$ENDIF}
     FHash.Clear;
    finally
      FEngineActive := false;
@@ -1807,83 +1822,35 @@ procedure TPHPEngine.RefreshLibrary;
  cnt, offset : integer;
  HashName : zend_ustr;
 begin
-  SetLength(FLibraryEntryTable, FHash.Count + MyFuncs.Count + 14);
+  SetLength(FLibraryEntryTable, FHash.Count + MyFuncs.Count + 5);
 
   PHP_FUNCTION(FLibraryEntryTable[0], 'delphi_date', @delphi_date);
-  PHP_FUNCTION(FLibraryEntryTable[1], 'delphi_extract_file_dir', @delphi_extract_file_dir);
-  PHP_FUNCTION(FLibraryEntryTable[2], 'delphi_extract_file_drive', @delphi_extract_file_drive);
-  PHP_FUNCTION(FLibraryEntryTable[3], 'delphi_extract_file_name', @delphi_extract_file_name);
-
-  FLibraryEntryTable[4].fname := 'delphi_extract_file_ext';
-  FLibraryEntryTable[4].handler := @delphi_extract_file_ext;
-  {$IFDEF PHP4}
-  FLibraryEntryTable[4].func_arg_types := nil;
-  {$ELSE}
-  FLibraryEntryTable[4].arg_info := nil;
-  {$ENDIF}
 
-  FLibraryEntryTable[5].fname := 'delphi_show_message';
-  FLibraryEntryTable[5].handler := @delphi_show_message;
-  {$IFDEF PHP4}
-  FLibraryEntryTable[5].func_arg_types := nil;
-  {$ELSE}
-  FLibraryEntryTable[5].arg_info := nil;
-  {$ENDIF}
+  FLibraryEntryTable[1].fname := 'delphi_get_author';
+  FLibraryEntryTable[1].handler := @delphi_get_author;
+  FLibraryEntryTable[1].arg_info := nil;
 
-  FLibraryEntryTable[6].fname :=  'register_delphi_object';
-  FLibraryEntryTable[6].handler := @register_delphi_object;
-  {$IFDEF PHP4}
-  FLibraryEntryTable[6].func_arg_types := nil;
-  {$ELSE}
-  FLibraryEntryTable[6].arg_info := nil;
-  {$ENDIF}
-
-  FLibraryEntryTable[7].fname := 'delphi_get_author';
-  FLibraryEntryTable[7].handler := @delphi_get_author;
-  {$IFDEF PHP4}
-  FLibraryEntryTable[7].func_arg_types := nil;
-  {$ELSE}
-  FLibraryEntryTable[7].arg_info := nil;
-  {$ENDIF}
-
-  FLibraryEntryTable[8].fname := 'delphi_is_uc';
-  FLibraryEntryTable[8].handler := @delphi_is_uc;
-  {$IFDEF PHP4}
-  FLibraryEntryTable[8].func_arg_types := nil;
-  {$ELSE}
-  FLibraryEntryTable[8].arg_info := nil;
-  {$ENDIF}
-
-  FLibraryEntryTable[9].fname := 'delphi_str_date';
-  FLibraryEntryTable[9].handler := @delphi_str_date;
-  {$IFDEF PHP4}
-  FLibraryEntryTable[9].func_arg_types := nil;
-  {$ELSE}
-  FLibraryEntryTable[9].arg_info := nil;
-  {$ENDIF}
-
-  PHP_FUNCTION(FLibraryEntryTable[10], 'delphi_get_system_directory', @delphi_get_system_directory);
-  PHP_FUNCTION(FLibraryEntryTable[11], 'InputBox', @delphi_input_box);
-  PHP_FUNCTION(FLibraryEntryTable[12], 'register_delphi_component', @register_delphi_component);
+  FLibraryEntryTable[2].fname := 'delphi_str_date';
+  FLibraryEntryTable[2].handler := @delphi_str_date;
+  FLibraryEntryTable[2].arg_info := nil;
 
+  PHP_FUNCTION(FLibraryEntryTable[3], 'InputBox', @delphi_input_box);
 
     for cnt := 0 to FHash.Count - 1 do
     begin
       HashName := FHash[cnt];
 
       {$IFNDEF COMPILER_VC9}
-      FLibraryEntryTable[cnt+13].fname := strdup(zend_pchar(HashName));
+      FLibraryEntryTable[cnt+4].fname := strdup(zend_pchar(HashName));
       {$ELSE}
-      FLibraryEntryTable[cnt+13].fname := DupStr(zend_pchar(HashName));
+      FLibraryEntryTable[cnt+4].fname := DupStr(zend_pchar(HashName));
       {$ENDIF}
 
-      FLibraryEntryTable[cnt+13].handler := @DispatchRequest;
-      {$IFDEF PHP4}
-      FLibraryEntryTable[cnt+13].func_arg_types := nil;
-      {$ENDIF}
+      FLibraryEntryTable[cnt+4].handler := @DispatchRequest;
+      FLibraryEntryTable[cnt+4].arg_info := nil;
     end;
 
-    offset := FHash.Count + 13;
+    offset := FHash.Count + 4;
     for cnt := 0 to MyFuncs.Count - 1 do
     begin
         HashName := MyFuncs[cnt];
@@ -1894,17 +1861,13 @@ procedure TPHPEngine.RefreshLibrary;
         {$ENDIF}
 
          FLibraryEntryTable[cnt+offset].handler := MyFuncs.Objects[ cnt ];
-        {$IFDEF PHP4}
-         FLibraryEntryTable[cnt+offset].func_arg_types := nil;
-        {$ENDIF}
+         FLibraryEntryTable[cnt+offset].arg_info := nil;
     end;
 
 
-    FLibraryEntryTable[FHash.Count+MyFuncs.Count+13].fname := nil;
-    FLibraryEntryTable[FHash.Count+MyFuncs.Count+13].handler := nil;
-    {$IFDEF PHP4}
-    FLibraryEntryTable[FHash.Count+MyFuncs.Count+13].func_arg_types := nil;
-    {$ENDIF}
+    FLibraryEntryTable[FHash.Count+MyFuncs.Count+4].fname := nil;
+    FLibraryEntryTable[FHash.Count+MyFuncs.Count+4].handler := nil;
+    FLibraryEntryTable[FHash.Count+MyFuncs.Count+4].arg_info := nil;
 
     FLibraryModule.functions := @FLibraryEntryTable[0];
 end;
diff --git a/Source/phpClass.pas b/Source/phpClass.pas
index a684840..8e3f286 100644
--- a/Source/phpClass.pas
+++ b/Source/phpClass.pas
@@ -156,7 +156,6 @@   TPHPClassInstance = class(TComponent)
     property    Properties : TClassProperties read FProperties write SetProperties;
   end;
 
-
 {$IFDEF PHP5}
 procedure RegisterClassHandlers;
 {$ENDIF}
@@ -174,11 +173,7 @@ implementation
  {$ENDIF}
 
 const
- {$IFDEF PHP4}
- le_classresource_name = 'TPHPCLASS4';
- {$ELSE}
  le_classresource_name = 'TPHPCLASS5';
- {$ENDIF}
 
 procedure class_destructor_handler(rsrc : PZend_rsrc_list_entry; TSRMLS_D : pointer); cdecl;
 var
@@ -224,211 +219,6 @@ function  class_call_constructor(AClassName : zend_ustr; return_value : pzval) :
    end;
 end;
 
-{$IFDEF PHP4}
-
-//PHP4
-function class_set_property_handler(property_reference : Pzend_property_reference; value : pzval) : integer; cdecl;
-var
- this_ptr : pzval;
- OBJ : TPHPClassInstance;
- data: ^ppzval;
- element : pzend_list_element;
- prop  : pzend_overloaded_element;
- p : pointer;
- propname : zend_ustr;
- tsrmls : pointer;
- param : TClassProperty;
-begin
-  tsrmls := ts_resource_ex(0, nil);
-  element :=  property_reference^.elements_list^.head;
-  p := @element^.data;
-  prop := pzend_overloaded_element(p);
-  propname := prop^.element.value.str.val;
-
-  this_ptr := property_reference^._object;
-  new(data);
-  if zend_hash_find(this_ptr^.value.obj.properties, 'instance', strlen('instance') + 1, data) = SUCCESS then
-    Obj := zend_fetch_resource(data^, TSRMLS, -1, 'class resource', nil, 1, le_classresource)
-      else
-        OBJ := nil;
-  freemem(data);
-  if Assigned(Obj) then
-   begin
-    convert_to_string(value);
-    param := Obj.Properties.ByName(propname);
-    if Assigned(param) then
-     param.Value := value.value.str.val;
-   end;
-  Result := SUCCESS;
-end;
-
-
-
-//PHP4
-procedure class_call_function(ht : integer; return_value : pzval; this_ptr : pzval;
-      return_value_used : integer; TSRMLS_DC : pointer; property_reference : Pzend_property_reference ); cdecl;
-var
- OBJ : TPHPClassInstance;
- Producer : TPHPClass;
- M : TPHPClassMethod;
- data: ^ppzval;
- element : pzend_list_element;
- prop  : pzend_overloaded_element;
- p : pointer;
- MethodName : zend_ustr;
- Params : pzval_array;
- j : integer;
-begin
-  element :=  property_reference^.elements_list^.head;
-  p := @element^.data;
-  prop := pzend_overloaded_element(p);
-  MethodName := prop^.element.value.str.val;
-  this_ptr := property_reference^._object;
-  new(data);
-  if (zend_hash_find(this_ptr^.value.obj.properties, 'instance', strlen('instance') + 1, data) = SUCCESS) then
-   Obj := zend_fetch_resource(data^, TSRMLS_DC, -1, 'class resource', nil, 1, le_classresource)
-     else
-       Obj := nil;
-  freemem(data);
-
-  if not Assigned(Obj) then
-   begin
-     //not assigned obj = new instance (constructor)
-     class_call_constructor(MethodName, this_ptr);
-     exit;
-   end;
-
-  if ht > 0 then
-    begin
-      if ( not (zend_get_parameters_ex(ht, Params) = SUCCESS )) then
-        begin
-           zend_wrong_param_count(TSRMLS_DC);
-           Exit;
-        end;
-    end;
-
-
-   Producer := Obj.Producer;
-   if Assigned(Producer) then
-    begin
-      M := Producer.Methods.ByName(MethodName);
-      if Assigned(M) then
-       begin
-         if Assigned(M.FOnExecute) then
-          begin
-             if M.Parameters.Count <> ht then
-                begin
-                  zend_wrong_param_count(TSRMLS_DC);
-                   Exit;
-                end;
-
-               if ht > 0 then
-                  begin
-                     for j := 0 to ht - 1 do
-                       begin
-                         if not IsParamTypeCorrect(M.Parameters[j].ParamType, Params[j]^) then
-                            begin
-                              zend_error(E_WARNING, zend_pchar(Format('Wrong parameter type for %s()', [get_active_function_name(TSRMLS_DC)])));
-                               Exit;
-                             end;
-                             M.Parameters[j].Value := zval2variant(Params[j]^^);
-                           end;
-                  end; // if ht > 0
-
-
-             M.ZendVar.AsZendVariable := return_value; //direct access to zend variable
-             M.FOnExecute(Obj, M.Parameters, M.ReturnValue, M.FZendVar.AsZendVariable, this_ptr, TSRMLS_DC);
-             if M.ZendVar.ISNull then   //perform variant conversion
-              variant2zval(M.ReturnValue, return_value);
-
-          end;
-       end;
-    end;
-   dispose_pzval_array(Params);
-end;
-
-
-//PHP4
-procedure class_get_property_handler(val : pzval; property_reference : PZend_property_reference); cdecl;
-var
- this_ptr : pzval;
- element : pzend_list_element;
- prop  : pzend_overloaded_element;
- obj : TPHPClassInstance;
- p : pointer;
- propname : zend_ustr;
- tsrmls : pointer;
- data: ^ppzval;
- param : TClassProperty;
-begin
-  tsrmls := ts_resource_ex(0, nil);
-  element := property_reference^.elements_list^.head;
-  p := @element^.data;
-  prop := pzend_overloaded_element(p);
-  propname := prop^.element.value.str.val;
-  this_ptr := property_reference^._object;
-  new(data);
-  if ( zend_hash_find(this_ptr^.value.obj.properties, 'instance', strlen('instance') + 1, data) <> SUCCESS) then
-   Obj := nil
-     else
-       Obj := zend_fetch_resource(data^, TSRMLS, -1, 'class resource', nil, 1, le_classresource);
-  freemem(data);
-  if Assigned(Obj) then
-   begin
-    param := Obj.Properties.ByName(propname);
-    if Assigned(param) then
-     ZVAL_STRING(val, zend_pchar(param.value), true)
-       else
-         ZVAL_EMPTY_STRING(val)
-   end
-     else
-       ZVAL_STRING(val, 'undefined', true);
-end;
-
-//PHP4
-procedure _class_get_property_wrapper; assembler;
-asm
-  push        ebp
-  mov         ebp,esp
-  sub         esp,50h
-  push        ebx
-  push        esi
-  push        edi
-  lea         edi,[ebp-50h]
-  mov         ecx,14h
-  mov         eax,0CCCCCCCCh
-  rep         stosd
-  mov         eax,dword ptr [ebp+0Ch]
-  push        eax
-  lea         ecx,[ebp-10h]
-  push        ecx
-  call        class_get_property_handler
-  add         esp,8
-  mov         edx,dword ptr [ebp+8]
-  mov         eax,dword ptr [ebp-10h]
-  mov         dword ptr [edx],eax
-  mov         ecx,dword ptr [ebp-0Ch]
-  mov         dword ptr [edx+4],ecx
-  mov         eax,dword ptr [ebp-8]
-  mov         dword ptr [edx+8],eax
-  mov         ecx,dword ptr [ebp-4]
-  mov         dword ptr [edx+0Ch],ecx
-  mov         eax,dword ptr [ebp+8]
-
-  pop         edi
-  pop         esi
-  pop         ebx
-  add         esp,50h
-  cmp         ebp,esp
-  mov         esp,ebp
-  pop         ebp
-  ret
-end;
-{$ENDIF}
-
-
-
-
 {$IFDEF PHP5}
 
 // Read object property value  (getter)
@@ -535,7 +325,7 @@ function class_call_method(method : zend_pchar; ht : integer; return_value : pzv
 
   if ht > 0 then
     begin
-      if ( not (zend_get_parameters_ex(ht, Params) = SUCCESS )) then
+      if ( not (zend_get_parameters_my(ht, Params, TSRMLS_DC) = SUCCESS )) then
         begin
            zend_wrong_param_count(TSRMLS_DC);
            Result := FAILURE;
@@ -679,24 +469,12 @@ procedure TPHPClass.ClassRegister(AModuleNumber : integer);
 
     ZeroMemory(@FClassEntry, SizeOf(TZend_Class_Entry));
 
-    {$IFDEF PHP5}
     FClassFunction[0].fname := zend_pchar(FClassName);
     FClassFunction[0].handler := @class_init_new;
     INIT_CLASS_ENTRY(FClassEntry, zend_pchar(FClassName) , @FClassFunction);
-    {$ELSE}
-    INIT_CLASS_ENTRY(FClassEntry, zend_pchar(FClassName) , nil);
-    {$ENDIF}
 
 
     FClassObject := zend_register_internal_class(@FClassEntry,  tsrmls);
-
-    {$IFDEF PHP4}
-    FClassObject.handle_property_get :=   @_class_get_property_wrapper;
-    FClassObject.handle_property_set :=   @class_set_property_handler;
-    FClassObject.handle_function_call :=  @class_call_function;
-    {$ENDIF}
-
-
     Application.RegisterPHPClass(FClassName, FClassObject);
   end;
 end;
@@ -743,17 +521,8 @@ function TPHPClass.InstanceConstructor(return_value : pzval): TPHPClassInstance;
   FClassObject := GetClassEntry;
   if not assigned(FClassObject) then
    Exit;
-   {$IFDEF PHP4}
-  _object_init_ex(return_value, FClassObject, nil, 0, TSRMLS);
-  {$ELSE}
   object_init(return_value, FClassObject,  TSRMLS );
-   {$ENDIF}
-
-  {$IFDEF PHP4}
-  add_property_resource_ex(return_value, 'instance', strlen('instance') +1, rn);
-  {$ELSE}
   add_property_resource_ex(return_value, 'instance', strlen('instance') +1, rn, TSRMLS);
-  {$ENDIF}
 
  {$IFDEF PHP5}
    return_value.value.obj.handlers := @ClassObjectHandlers;
@@ -787,18 +556,8 @@ procedure TPHPClass.ProduceInstance(AValue: pzval);
  FClassObject := Application.GetPHPClass(FClassName);
  if not assigned(FClassObject) then
   Exit;
-
-  {$IFDEF PHP4}
- _object_init_ex(AValue, FClassObject, nil, 0, TSRMLS);
-  {$ELSE}
   object_init(AValue, FClassObject, TSRMLS );
- {$ENDIF}
-
- {$IFDEF PHP4}
- add_property_resource_ex(AValue, 'instance', strlen('instance') +1, rn);
- {$ELSE}
  add_property_resource_ex(AValue, 'instance', strlen('instance') +1, rn, TSRMLS);
- {$ENDIF}
 
  {$IFDEF PHP5}
    AValue.value.obj.handlers := @ClassObjectHandlers;
@@ -882,11 +641,7 @@ function TClassProperty.GetAsFloat: double;
 
 function TClassProperty.GetAsInteger: integer;
 var
- {$IFDEF VERSION12}
- c : WideChar;
- {$ELSE}
- c : AnsiChar;
- {$ENDIF}
+ c: CharPtr;
 begin
   c := FormatSettings.DecimalSeparator;
   try
@@ -920,11 +675,7 @@ procedure TClassProperty.SetAsFloat(const Value: double);
 
 procedure TClassProperty.SetAsInteger(const Value: integer);
 var
- {$IFDEF VERSION12}
- c : WideChar;
- {$ELSE}
- c : AnsiChar;
- {$ENDIF}
+ c: CharPtr;
 begin
   c := FormatSettings.DecimalSeparator;
   try
diff --git a/Source/phpModules.pas b/Source/phpModules.pas
index 9943c82..04dcf0a 100644
--- a/Source/phpModules.pas
+++ b/Source/phpModules.pas
@@ -265,7 +265,7 @@ function rshutdown (_type : integer; module_number : integer; TSRMLS_DC : pointe
 procedure DispatchRequest(ht : integer; return_value : pzval; return_value_ptr : ppzval;
             this_ptr : pzval; return_value_used : integer; TSRMLS_DC : pointer); cdecl;
 begin
-  ZVAL_NULL(return_value);
+  ZVAL(return_value);
   if Assigned(Application) then
    try
      Application.HandleRequest(ht, return_value, return_value_ptr, this_ptr,  return_value_used, TSRMLS_DC);
@@ -343,15 +343,11 @@ function get_module : Pzend_module_entry; cdecl;
     {$ENDIF}
 
       module_entry_table[cnt].handler := @DispatchRequest;
-      {$IFDEF PHP4}
-      module_entry_table[cnt].func_arg_types := nil;
-      {$ENDIF}
+      module_entry_table[cnt].arg_info := nil;
     end;
     module_entry_table[Extension.FFunctions.Count].fname := nil;
     module_entry_table[Extension.FFunctions.Count].handler := nil;
-    {$IFDEF PHP4}
-    module_entry_table[Extension.FFunctions.Count].func_arg_types := nil;
-    {$ENDIF}
+    module_entry_table[Extension.FFunctions.Count].arg_info := nil;
 
     ModuleEntry.functions :=  @module_entry_table[0];
     ModuleEntry._type := ORD(Extension.ModuleType) + 1;

From c2bdc6ee76d0172200463f07e09fae45f1412d33 Mon Sep 17 00:00:00 2001
From: Lev Zenin <ZeLev@pm.me>
Date: Wed, 12 Feb 2020 00:52:52 +0200
Subject: [PATCH 17/35] intpr

---
 Source/PHPAPI.pas  |  6 +++---
 Source/ZENDAPI.pas | 11 +++--------
 2 files changed, 6 insertions(+), 11 deletions(-)

diff --git a/Source/PHPAPI.pas b/Source/PHPAPI.pas
index d1a6baf..2a14ce9 100644
--- a/Source/PHPAPI.pas
+++ b/Source/PHPAPI.pas
@@ -345,7 +345,7 @@ function GetSAPIGlobals : Psapi_globals_struct;
 begin
   Result := nil;
   if Assigned(sapi_globals_id) then
-     Result := __asm_fetchval(integer(sapi_globals_id^), tsrmls_fetch);
+     Result := __asm_fetchval(IntPtr(sapi_globals_id^), tsrmls_fetch);
 end;
 function GetSAPIGlobals(TSRMLS_DC : pointer) : Psapi_globals_struct;
 var
@@ -354,7 +354,7 @@ function GetSAPIGlobals(TSRMLS_DC : pointer) : Psapi_globals_struct;
   Result := nil;
   sapi_global_id := GetProcAddress(PHPLib, 'sapi_globals_id');
   if Assigned(sapi_global_id) then
-     Result := __asm_fetchval(integer(sapi_globals_id^), TSRMLS_DC);
+     Result := __asm_fetchval(IntPtr(sapi_globals_id^), TSRMLS_DC);
 end;
 
 function GetStringOf(const V: TVarData): string;
@@ -407,7 +407,7 @@ function GetPHPGlobals(TSRMLS_DC : pointer) : Pphp_Core_Globals;
 begin
   Result := nil;
   if Assigned(core_globals_id) then
-     Result := Pphp_Core_Globals(__asm_fetchval(integer(core_globals_id^), TSRMLS_DC));
+     Result := Pphp_Core_Globals(__asm_fetchval(IntPtr(core_globals_id^), TSRMLS_DC));
 end;
 
 
diff --git a/Source/ZENDAPI.pas b/Source/ZENDAPI.pas
index 7417590..c39df3e 100644
--- a/Source/ZENDAPI.pas
+++ b/Source/ZENDAPI.pas
@@ -3301,12 +3301,7 @@ function zend_register_functions(functions : {$IFDEF PHP7}P_zend_function_entry{
 
 end;
 
-function __asm_fetchval
-{$IFDEF CPUX64}
-(val_id: int64; tsrmls_dc_p: pointer)
-{$ELSE}
-(val_id: integer; tsrmls_dc_p: pointer)
-{$ENDIF}
+function __asm_fetchval(val_id: IntPtr; tsrmls_dc_p: pointer)
 : pointer; assembler; register;
 {$IFDEF CPUX64}
 asm
@@ -3335,7 +3330,7 @@ function GetGlobalResource(resource_name: AnsiString) : pointer;
     global_id := GetProcAddress(PHPLib, zend_pchar(resource_name));
     if Assigned(global_id) then
      begin
-       Result := __asm_fetchval(integer(global_id^), tsrmls_fetch);
+       Result := __asm_fetchval(IntPtr(global_id^), tsrmls_fetch);
      end;
   except
     Result := nil;
@@ -3351,7 +3346,7 @@ function GetGlobalResourceDC(resource_name: AnsiString;TSRMLS_DC:pointer) : poin
     global_id := GetProcAddress(PHPLib, zend_pchar(resource_name));
     if Assigned(global_id) then
      begin
-       Result := __asm_fetchval(integer(global_id^), TSRMLS_DC);
+       Result := __asm_fetchval(IntPtr(global_id^), TSRMLS_DC);
      end;
   except
     Result := nil;

From 09f6b4852ff363f72a5e4a27bdc12f5421166e82 Mon Sep 17 00:00:00 2001
From: Lev Zenin <ZeLev@pm.me>
Date: Wed, 12 Feb 2020 13:57:07 +0200
Subject: [PATCH 18/35] Closed #4 , #2

Still facing encoding problems with RunCode() function
---
 Source/DelphiFunctions.pas               |   2 +-
 Source/Demos/psvPHP/console/phpcon.dpr   |   4 +-
 Source/Demos/psvPHP/console/phpcon.dproj |   2 +-
 Source/PHP.INC                           |   9 +-
 Source/PHPAPI.pas                        |  12 +-
 Source/PHPFunctions.pas                  |  23 +-
 Source/PHPLibrary.pas                    |  13 +-
 Source/PHPProjectWizard.pas              |   2 +-
 Source/PHPTypes.pas                      |  12 +-
 Source/ZENDAPI.pas                       | 330 +++++++++--------------
 Source/ZendTypes.pas                     |  17 +-
 Source/hzend_types.pas                   |   8 +-
 Source/php4AppIntf.pas                   |   3 +-
 Source/php4AppUnit.pas                   |   2 +-
 Source/php4delphi.pas                    |  25 +-
 Source/phpClass.pas                      |  16 +-
 16 files changed, 202 insertions(+), 278 deletions(-)

diff --git a/Source/DelphiFunctions.pas b/Source/DelphiFunctions.pas
index 3be090d..74bbcc3 100644
--- a/Source/DelphiFunctions.pas
+++ b/Source/DelphiFunctions.pas
@@ -18,7 +18,7 @@ interface
 uses
   SysUtils, Classes,
   VCL.Controls,
-  {$IFDEF PHP7} hzend_types, {$ELSE} ZendTypes, {$ENDIF} ZendAPI, PHPTypes, PHPAPI, VCL.Dialogs, typinfo,
+  ZendTypes, ZendAPI, PHPTypes, PHPAPI, VCL.Dialogs, typinfo,
   VCL.Forms, VCL.stdctrls;
 
 {$ifdef fpc}
diff --git a/Source/Demos/psvPHP/console/phpcon.dpr b/Source/Demos/psvPHP/console/phpcon.dpr
index 5ac140b..afe658b 100644
--- a/Source/Demos/psvPHP/console/phpcon.dpr
+++ b/Source/Demos/psvPHP/console/phpcon.dpr
@@ -31,7 +31,7 @@ var
 begin
   if zend_parse_method_parameters(1, TSRMLS_DC, this_ptr, 'z', @Text) = 0 then
   begin
-    ShowMessage(Z_STRVAL(Text));
+    ShowMessage(WideString(Z_RawStr(Text)));
   end;
 end;
     procedure grc(ht: integer; return_value: pzval;
@@ -42,7 +42,7 @@ var
 begin
   if zend_parse_method_parameters(1, TSRMLS_DC, this_ptr, 'z', @p) = 0 then
   begin
-      p^.value.lval := 0;
+      ZVAL_STRING(z,'🐆🐆🐆 .-=WPD=-. 🐆🐆🐆',true);
   end;
 end;
 begin
diff --git a/Source/Demos/psvPHP/console/phpcon.dproj b/Source/Demos/psvPHP/console/phpcon.dproj
index fdd2dd5..06928a9 100644
--- a/Source/Demos/psvPHP/console/phpcon.dproj
+++ b/Source/Demos/psvPHP/console/phpcon.dproj
@@ -8,7 +8,7 @@
         <AppType>Console</AppType>
         <FrameworkType>None</FrameworkType>
         <ProjectVersion>18.2</ProjectVersion>
-        <Platform Condition="'$(Platform)'==''">Win64</Platform>
+        <Platform Condition="'$(Platform)'==''">Win32</Platform>
     </PropertyGroup>
     <PropertyGroup Condition="'$(Config)'=='Base' or '$(Base)'!=''">
         <Base>true</Base>
diff --git a/Source/PHP.INC b/Source/PHP.INC
index 2662f6d..5ee313f 100644
--- a/Source/PHP.INC
+++ b/Source/PHP.INC
@@ -52,7 +52,7 @@ backward compatibility between PHP versions.
   {$DEFINE ZEND_WIN32}
   {$DEFINE PHP_COMPILER_ID}
 {$ENDIF}
-{s$DEFINE soulengine_build}
+{$DEFINE soulengine_build}
 {.$DEFINE PHP7}
 {.$DEFINE CUTTED_PHP7dll}
  {$IFDEF PHP7}
@@ -64,7 +64,6 @@ backward compatibility between PHP versions.
 	{$DEFINE PHP530}
 	{$DEFINE PHP540}
 	{$DEFINE PHP550}
-	{//$DEFINE PHP_UNICE}
 	{$DEFINE ZEND_WIN32}
 	{$DEFINE PHP_COMPILER_ID}
 {$ENDIF}
@@ -97,6 +96,12 @@ backward compatibility between PHP versions.
  {$DEFINE ZTS}                                               {zts support}
 {$ENDIF}
 
+{$IF Defined(COMPILER_VC11) and Defined(PHP560) or Defined(PHP7)}
+  {$DEFINE PHP_UNICODE}
+{$ELSEIF Defined(COMPILER_VC12) or Defined(COMPILER_VC13) or Defined(COMPILER_VC14) or Defined(COMPILER_VC15)}
+  {$DEFINE PHP_UNICODE}
+{$ENDIF}
+
 {$IFNDEF VER80}                                             {Delphi 1.0}
   {$DEFINE VERSION2}                                        {Delphi 2.0 and BCB 1 or higher}
 {$ENDIF}
diff --git a/Source/PHPAPI.pas b/Source/PHPAPI.pas
index 2a14ce9..28b154e 100644
--- a/Source/PHPAPI.pas
+++ b/Source/PHPAPI.pas
@@ -29,7 +29,7 @@ interface
  Windows
  {$ENDIF},
 
- {$IFDEF PHP7} hzend_types, {$ELSE} ZendTypes, {$ENDIF}
+  ZendTypes,
   PHPTypes, zendAPI,
 
 
@@ -704,7 +704,7 @@ function GetPHPVersion: TPHPFileInfo;
 {$ELSE}
 function GetPHPVersion: TPHPFileInfo;
 var
-  FileName: {$IFDEF PHP_UNICE}String{$ELSE}AnsiString{$ENDIF};
+  FileName: String;
   InfoSize, Wnd: DWORD;
   VerBuf: Pointer;
   FI: PVSFixedFileInfo;
@@ -715,20 +715,12 @@ function GetPHPVersion: TPHPFileInfo;
   Result.Release := 0;
   Result.Build := 0;
   FileName := PHPWin;
-  {$IFDEF PHP_UNICE}
   InfoSize := GetFileVersionInfoSize(PWideChar(Filename), Wnd);
-  {$ELSE}
-  InfoSize := GetFileVersionInfoSizeA(PAnsiChar(FileName), Wnd);
-  {$ENDIF}
    if InfoSize <> 0 then
     begin
       GetMem(VerBuf, InfoSize);
       try
-      {$IFDEF PHP_UNICE}
       if GetFileVersionInfo(PWideChar(FileName), Wnd, InfoSize, VerBuf) then
-      {$ELSE}
-        if GetFileVersionInfoA(PAnsiChar(FileName), Wnd, InfoSize, VerBuf) then
-      {$ENDIF}
           if VerQueryValue(VerBuf, '\', Pointer(FI), VerSize) then
            begin
              Result.MajorVersion := HIWORD(FI.dwFileVersionMS);
diff --git a/Source/PHPFunctions.pas b/Source/PHPFunctions.pas
index 80ceda8..07abf5b 100644
--- a/Source/PHPFunctions.pas
+++ b/Source/PHPFunctions.pas
@@ -20,10 +20,10 @@
 interface
  uses
    Windows, SysUtils,  Classes,
-   {$IFDEF PHP_UNICE}WideStrUtils, {$ENDIF}
+   {$IFDEF PHP_UNICODE}WideStrUtils, {$ENDIF}
    {$IFDEF VERSION6} Variants,
    {$ENDIF}
-  {$IFDEF PHP7} hzend_types, {$ELSE} ZendTypes, {$ENDIF} PHPTypes, ZendAPI, PHPAPI ;
+   ZendTypes, PHPTypes, ZendAPI, PHPAPI ;
 
 type
   TParamType = (tpString, tpInteger, tpFloat, tpBoolean, tpArray, tpUnknown);
@@ -316,17 +316,17 @@ procedure TPHPFunction.SetDisplayName(const Value: string);
   NameValue : zend_ustr;
 begin
    NameValue := Value;
-  if {$IFDEF PHP_UNICE}CompareText{$ELSE}AnsiCompareText{$ENDIF}(NameValue, FFunctionName) <> 0 then
+  if {$IFDEF PHP_UNICODE}CompareText{$ELSE}AnsiCompareText{$ENDIF}(NameValue, FFunctionName) <> 0 then
   begin
     if Collection <> nil then
       for I := 0 to Collection.Count - 1 do
       begin
         F := TPHPFunctions(Collection).Items[I];
         if (F <> Self) and (F is TPHPFunction) and
-          ({$IFDEF PHP_UNICE}CompareText{$ELSE}AnsiCompareText{$ENDIF}(NameValue, F.FunctionName) = 0) then
+          ({$IFDEF PHP_UNICODE}CompareText{$ELSE}AnsiCompareText{$ENDIF}(NameValue, F.FunctionName) = 0) then
           raise Exception.CreateFmt('Duplicate function name: %s', [Value]);
       end;
-    FFunctionName :=  {$IFDEF PHP_UNICE}UTF8LowerCase{$ELSE}AnsiLowerCase{$ENDIF}(Value);
+    FFunctionName :=  {$IFDEF PHP_UNICODE}UTF8LowerCase{$ELSE}AnsiLowerCase{$ENDIF}(Value);
     Changed(False);
   end;
 end;
@@ -467,14 +467,14 @@ procedure TFunctionParam.SetDisplayName(const Value: string);
   I: Integer;
   F: TFunctionParam;
 begin
-  if {$IFDEF PHP_UNICE}CompareText{$ELSE}AnsiCompareText{$ENDIF}(Value, FName) <> 0 then
+  if {$IFDEF PHP_UNICODE}CompareText{$ELSE}AnsiCompareText{$ENDIF}(Value, FName) <> 0 then
   begin
     if Collection <> nil then
       for I := 0 to Collection.Count - 1 do
       begin
         F := TFunctionParams(Collection).Items[I];
         if ((F <> Self) and (F is TFunctionParam) and
-          ({$IFDEF PHP_UNICE}CompareText{$ELSE}AnsiCompareText{$ENDIF}(Value, F.Name) = 0)) then
+          ({$IFDEF PHP_UNICODE}CompareText{$ELSE}AnsiCompareText{$ENDIF}(Value, F.Name) = 0)) then
           raise Exception.Create('Duplicate parameter name');
       end;
     FName := Value;
@@ -611,14 +611,7 @@ function TZendVariable.GetAsString: zend_ustr;
    end;
 
   case {$IFDEF PHP7}FValue^.u1.v._type{$ELSE} FValue^._type{$ENDIF} of
-   IS_STRING : begin
-                 try
-                   SetLength(Result, FValue^.value.str.len);
-                   Move(FValue^.value.str.val^, Result[1], FValue^.value.str.len);
-                 except
-                   Result := '';
-                 end;
-               end;
+   IS_STRING : result := Z_STRVAL(FValue);
    IS_DOUBLE : result := FloatToStr(FValue^.value.dval);
    IS_LONG   : result := IntToStr(FValue^.value.lval);
    IS_NULL   : result := '';
diff --git a/Source/PHPLibrary.pas b/Source/PHPLibrary.pas
index 531998f..1ffad85 100644
--- a/Source/PHPLibrary.pas
+++ b/Source/PHPLibrary.pas
@@ -16,6 +16,9 @@
 interface
  uses
   Windows, SysUtils, Classes,
+  {$IFDEF PHP_UNICODE}
+  WideStrUtils,
+  {$ENDIF}
   {$IFDEF VERSION6}
   Variants,
   {$ENDIF}
@@ -178,7 +181,7 @@ procedure TPHPSimpleLibrary.RegisterMethod(AName: zend_ustr; ADescription : zend
 begin
   Func := TPHPFunction(Functions.Add);
   Func.FunctionName :=
-  {$IFDEF PHP_UNICE}LowerCase{$ELSE}AnsiLowerCase{$ENDIF}(AName);
+  {$IFDEF PHP_UNICODE}UTF8LowerCase{$ELSE}AnsiLowerCase{$ENDIF}(AName);
   Func.Description := ADescription;
 
   for cnt := 0 to Length(AParams) - 1 do
@@ -353,28 +356,28 @@ procedure TPHPSystemLibrary.CompareTextProc;
 procedure TPHPSystemLibrary.AnsiUpperCaseProc;
 begin
   ReturnOutputArg(
-    {$IFDEF PHP_UNICE}UpperCase{$ELSE}AnsiUpperCase{$ENDIF}( GetInputArgAsString( 0 ) )
+    {$IFDEF PHP_UNICODE}UTF8UpperCase{$ELSE}AnsiUpperCase{$ENDIF}( GetInputArgAsString( 0 ) )
   );
 end;
 
 procedure TPHPSystemLibrary.AnsiLowerCaseProc;
 begin
   ReturnOutputArg(
-    {$IFDEF PHP_UNICE}LowerCase{$ELSE}AnsiLowerCase{$ENDIF}( GetInputArgAsString( 0 ) )
+    {$IFDEF PHP_UNICODE}UTF8LowerCase{$ELSE}AnsiLowerCase{$ENDIF}( GetInputArgAsString( 0 ) )
   );
 end;
 
 procedure TPHPSystemLibrary.AnsiCompareStrProc;
 begin
   ReturnOutputArg(
-    {$IFDEF PHP_UNICE}CompareStr{$ELSE}AnsiCompareStr{$ENDIF}( GetInputArgAsString( 0 ),GetInputArgAsString( 1 ) )
+    {$IFDEF PHP_UNICODE}CompareStr{$ELSE}AnsiCompareStr{$ENDIF}( GetInputArgAsString( 0 ),GetInputArgAsString( 1 ) )
   );
 end;
 
 procedure TPHPSystemLibrary.AnsiCompareTextProc;
 begin
    ReturnOutputArg(
-    {$IFDEF PHP_UNICE}CompareText{$ELSE}AnsiCompareText{$ENDIF}( GetInputArgAsString( 0 ),GetInputArgAsString( 1 ) )
+    {$IFDEF PHP_UNICODE}CompareText{$ELSE}AnsiCompareText{$ENDIF}( GetInputArgAsString( 0 ),GetInputArgAsString( 1 ) )
    );
 end;
 
diff --git a/Source/PHPProjectWizard.pas b/Source/PHPProjectWizard.pas
index 4a281d1..78c8a6e 100644
--- a/Source/PHPProjectWizard.pas
+++ b/Source/PHPProjectWizard.pas
@@ -268,7 +268,7 @@ function TPHPProjectCreator.GetFileName: string;
       begin
         try
           TempFileName := ProjGroup.Projects[i].FileName;
-          if {$IFDEF PHP_UNICE}CompareFileName{$ELSE}AnsiCompareFileName{$ENDIF}(ExtractFileName(TempFileName), ExtractFileName(TempFileName2)) = 0 then
+          if CompareFileName(ExtractFileName(TempFileName), ExtractFileName(TempFileName2)) = 0 then
           begin
             Found := True;
             Break;
diff --git a/Source/PHPTypes.pas b/Source/PHPTypes.pas
index 9fa22fe..6516dbe 100644
--- a/Source/PHPTypes.pas
+++ b/Source/PHPTypes.pas
@@ -16,7 +16,7 @@
 interface
 
 uses
-  {$IFNDEF FPC} Windows{$ELSE} LCLType{$ENDIF}, {$IFDEF PHP7} hzend_types {$ELSE} ZendTypes {$ENDIF};
+  {$IFNDEF FPC} Windows{$ELSE} LCLType{$ENDIF}, ZendTypes;
 
 const
   phpVersion = {$IFDEF PHP7}7{$ELSE}5{$ENDIF};
@@ -249,8 +249,8 @@ interface
 
   sapi_module_struct =
     record
-      name : PAnsiChar;
-      pretty_name : PAnsiChar;
+      name : zend_pchar;
+      pretty_name : zend_pchar;
 
       startup  : TModuleStartupFunc;
       //int (*startup)(struct _sapi_module_struct *sapi_module);
@@ -283,14 +283,14 @@ interface
       get_request_time : pointer;
       terminate_process : pointer;
 
-      php_ini_path_override : PAnsiChar;
+      php_ini_path_override : zend_pchar;
 
       block_interruptions : pointer;
       unblock_interruptions : pointer;
 
       default_post_reader : pointer;
       treat_data : pointer;
-      executable_location : PAnsiChar;
+      executable_location : zend_pchar;
 
       php_ini_ignore : Integer;
 
@@ -308,7 +308,7 @@ interface
 
       phpinfo_as_text : integer;
 
-      ini_entries : PAnsiChar;
+      ini_entries : zend_pchar;
 
       additional_functions: Pointer;
       input_filter_init : Pointer;
diff --git a/Source/ZENDAPI.pas b/Source/ZENDAPI.pas
index c39df3e..2a965f2 100644
--- a/Source/ZENDAPI.pas
+++ b/Source/ZENDAPI.pas
@@ -21,8 +21,9 @@ interface
 
 uses
 VCL.Dialogs,
-  {$IFNDEF FPC} Windows{$ELSE} LCLType,LCLIntf,dynlibs,libc{$ENDIF}, SysUtils,
-  {$IFDEF PHP7} hzend_types, {$ElSE} ZendTypes, {$ENDIF} Variants,
+WideStrUtils,
+  {$IFDEF FPC} LCLType,LCLIntf,dynlibs,libc{$ELSE}Windows{$ENDIF}, SysUtils,
+  ZendTypes, Variants,
   PHPTypes;
 type
 TArrayVariant = array of variant;
@@ -77,7 +78,7 @@   align_test = record
   end;
 const
   PLATFORM_ALIGNMENT = (SizeOf(align_test));
-{$IFNDEF PHP_UNICE}
+{$IFNDEF PHP_UNICODE}
 function AnsiFormat(const Format: AnsiString; const Args: array of const): AnsiString;
 {$ENDIF}
 function Lfunc(var Func: Pointer; addr: LPCWSTR): Bool;
@@ -318,13 +319,13 @@ procedure zend_hash_internal_pointer_reset(ht: {$IFDEF PHP7} Pzend_array {$ELSE}
 
   zend_register_auto_global :
   {$IFDEF PHP700}
-  function(name:Pzend_string; jit:zend_bool; auto_global_callback:Pointer):longint; cdecl;
+  function(name:Pzend_string; jit:boolean; instance_init_callback:Pointer): IntPtr; cdecl;
   {$ELSE}
     {$IFDEF PHP5}
-    function(name: zend_pchar; name_len: uint; jit:boolean; callback: Pointer; TSRMLS_DC: Pointer): Integer; cdecl;
+    function(name: zend_pchar; name_len: uint; jit:boolean; instance_init_callback: Pointer; TSRMLS_DC: Pointer): IntPtr; cdecl;
      zend_activate_auto_globals: procedure(TSRMLS_C: Pointer); cdecl;
     {$ELSE}
-    function(name: zend_pchar; name_len: uint; callback: Pointer; TSRMLS_DC: Pointer): Integer; cdecl;
+    function(name: zend_pchar; name_len: uint; callback: Pointer; TSRMLS_DC: Pointer): IntPtr; cdecl;
     {$ENDIF}
   {$ENDIF}
 procedure REGISTER_MAIN_LONG_CONSTANT(name: zend_pchar; lval: longint; flags: integer; TSRMLS_DC: Pointer);
@@ -349,7 +350,7 @@ procedure REGISTER_MAIN_STRINGL_CONSTANT(name: zend_pchar; str: zend_pchar; len:
   zend_error_cb                                   : procedure; cdecl;
 
   zend_eval_string                                : function(str: zend_pchar; ret_val: pointer; strname: zend_pchar; tsrm: pointer): integer; cdecl;
-  zend_eval_string_ex                             : function(str:PAnsiChar;  retval_ptr:pzval; string_name:PAnsiChar; handle_exceptions:longint):longint; cdecl;
+  zend_eval_string_ex                             : function(str: zend_pchar;  retval_ptr:pzval; string_name: zend_pchar; handle_exceptions:longint):longint; cdecl;
   zend_make_compiled_string_description           : function(a: zend_pchar; tsrm: pointer): zend_pchar; cdecl;
   _zval_copy_ctor_func                            : procedure(val: pzval; __zend_filename: zend_pchar; __zend_lineno: uint); cdecl;
   _zval_dtor_func                                 : procedure(val: pzval; __zend_filename: zend_pchar; __zend_lineno: uint); cdecl;
@@ -530,12 +531,12 @@ procedure convert_to_string(op: pzval);
 
   zend_html_puts                                  : procedure(s: zend_pchar; len: uint; TSRMLS_DC: Pointer); cdecl;
 
-  	zend_parse_method_parameters:function(num_args:longint; TSRMLS_DC:Pointer; this_ptr:Pzval; type_spec:PAnsiChar):longint; cdecl varargs;
+  	zend_parse_method_parameters:function(num_args:longint; TSRMLS_DC:Pointer; this_ptr:Pzval; type_spec:zend_pchar):longint; cdecl varargs;
 
-	zend_parse_method_parameters_ex:function(flags:longint; num_args:longint; TSRMLS_DC:Pointer; this_ptr:Pzval; type_spec:PAnsiChar):longint; cdecl varargs;
+	zend_parse_method_parameters_ex:function(flags:longint; num_args:longint; TSRMLS_DC:Pointer; this_ptr:Pzval; type_spec:zend_pchar):longint; cdecl varargs;
 
   {$IFDEF PHP7}
-  zend_parse_parameters_throw                     : function(num_args:longint; type_spec:PAnsiChar):longint; cdecl varargs;
+  zend_parse_parameters_throw                     : function(num_args:longint; type_spec:zend_pchar):longint; cdecl varargs;
   {$ELSE}
   zend_indent                                     : procedure; cdecl;
   {$ENDIF}
@@ -566,7 +567,7 @@ procedure dispose_pzval_array(Params: pzval_array);
 var
   _zend_bailout                                   : procedure (filename : zend_pchar; lineno : uint); cdecl;
 
-  zend_alter_ini_entry                            : function(name: PAnsiChar; name_length: uint; new_value: PAnsiChar; new_value_length: uint; modify_type: Integer; stage: Integer): Integer; cdecl;
+  zend_alter_ini_entry                            : function(name: zend_pchar; name_length: uint; new_value: zend_pchar; new_value_length: uint; modify_type: Integer; stage: Integer): Integer; cdecl;
   zend_alter_ini_entry_ex                            : function(name: zend_pchar; name_length: uint; new_value: zend_pchar; new_value_length: uint; modify_type: Integer; stage: Integer; force_change: integer): Integer; cdecl;
 
   zend_restore_ini_entry                          : function(name: zend_pchar; name_length: uint; stage: Integer): Integer; cdecl;
@@ -674,13 +675,6 @@ procedure ZEND_PUTS(str: zend_pchar);
   zend_register_internal_module    : function(module_entry: Pzend_module_entry; TSRMLS_DC: pointer): Pzend_module_entry;cdecl;
   zend_startup_modules             : function(TSRMLS_DC:pointer):integer;
   zend_collect_module_handlers     : function(TSRMLS_DC:pointer):integer;
-  function ZvalInt(z:zval):Integer;
-  function ZvalDouble(z:zval):Double;
-  function ZvalBool(z:zval):Boolean;
-
-  function ZvalStrS(z:zval) : string;
-  function ZvalStr(z:zval)  : zend_ustr;
-  function ZvalStrW(z:zval) : WideString;
 
   procedure ZvalVAL(z:pzval; v:Boolean) overload;
   procedure ZvalVAL(z:pzval; v:Integer; const _type:Integer = IS_LONG) overload;
@@ -739,8 +733,9 @@ procedure ZVAL_ARRAYWS(z: pzval; keynames: array of string; keyvals: array of st
 procedure HashToArray(HT: {$IFDEF PHP7}Pzend_array{$ELSE}PHashTable{$ENDIF}; var AR: TArrayVariant); overload;
 procedure ArrayToHash(AR: Array of Variant; var HT: pzval); overload;
 procedure ArrayToHash(Keys,AR: Array of Variant; var HT: pzval); overload;
-function ToStrA(V: Variant): zend_ustr;
-function ToStr(V: Variant): String;
+function ToStrA(V: Variant): AnsiString;
+function ToStrW(V: Variant): WideString;
+function ToStr(V: Variant): zend_ustr;
 function toWChar(s: zend_pchar): PWideChar;
 function ZendToVariant(const Value: pzval;cobj: TObjectBConvertMethod=nil): Variant;
 {$IFNDEF PHP7}
@@ -750,10 +745,11 @@ function ZendToVariant(const Value: pppzval;cobj: TObjectBConvertMethod=nil): Va
 {$ENDIF}
 procedure VariantToZend(const Value: Variant; z: pzval;
 cobj: TObjectAConvertMethod=nil);
-procedure ZVAL_STRING(z: pzval; s: zend_pchar; duplicate: boolean);
-procedure ZVAL_STRINGU(z: pzval; s: PUtf8Char; duplicate: boolean);
-procedure ZVAL_STRINGW(z: pzval; s: PWideChar; duplicate: boolean);
-
+procedure ZVAL_RawStr(z: pzval; s:RawByteString; duplicate: boolean);
+procedure ZVAL_STRING(z: pzval; s: WideString; duplicate: boolean);
+procedure ZVAL_STRINGU(z: pzval; s: UTF8String; duplicate: boolean);
+procedure ZVAL_STRINGW(z: pzval; StW: WideString; duplicate: boolean);
+procedure ZVAL_STRINGA(z: pzval; s: AnsiString; duplicate: boolean);
 procedure ZVAL_STRINGL(z: pzval; s: zend_pchar; l: integer; duplicate: boolean);
 procedure ZVAL_STRINGLW(z: pzval; s: PWideChar; l: integer; duplicate: boolean);
 
@@ -832,9 +828,11 @@ function object_init(arg: pzval; ce: pzend_class_entry; TSRMLS_DC : pointer) : i
 function Z_LVAL(z : Pzval) : longint;
 function Z_BVAL(z : Pzval) : boolean;
 function Z_DVAL(z : Pzval) : double;
-function Z_STRVAL(z : Pzval) : zend_ustr;
+function Z_RAWSTR(z: PZval): RawByteString;
+function Z_STRVAL(z : Pzval) : WideString;
+function Z_ASTRVAL(z : Pzval) : AnsiString;
 function Z_STRUVAL(z : PZval): UTF8String;
-function Z_STRWVAL(z : pzval) : String;
+function Z_WSTRVAL(z : pzval) : String;
 function Z_CHAR(z: PZval) : zend_uchar;
 function Z_WCHAR(z: PZval) : WideChar;
 function Z_ACHAR(z: PZVAL): AnsiChar;
@@ -873,7 +871,7 @@ function  add_char_to_string  (_result: Pzval; op1: Pzval; op2: Pzval): Integer;
   if op1.u1.v._type = IS_STRING then
   begin
     _result.value.str.len := op1.value.str.len + op2.value.str.len;
-    _result.value.str.val := zend_pchar(zend_ustr(op1.value.str.val) + zend_ustr(op2.value.str.val));
+    _result.value.str.val := op1.value.str.val + op2.value.str.val;
     Result := SUCCESS;
   end;
 End;
@@ -1024,35 +1022,6 @@ procedure ZvalString(z:pzval; s:string; len:Integer = 0);
   else
     ZvalString(z, _s, len);
 end;
-function ZvalInt;
-begin
-  Result := z.value.lval;
-end;
-
-function ZvalDouble;
-begin
-  Result := z.value.dval;
-end;
-
-function ZvalBool;
-begin
-  Result := boolean(z.value.lval);
-end;
-
-function ZvalStrS;
-begin
- Result := z.value.str.val;
-end;
-
-function ZvalStr;
-begin
- Result := z.value.str.val;
-end;
-
-function ZvalStrW;
-begin
- Result := WideString(z.value.str.val);
-end;
 
 procedure ZvalVAL(z:pzval; v:Boolean);
 Begin
@@ -1262,7 +1231,7 @@ function ZValArrayKeyExists(v: pzval; idx: Integer; out pData: pzval)
 function ZValArrayKeyDel(v: pzval; key: zend_ustr): Boolean; overload;
 {$IFDEF PHP7}
 var
-  pzs: pzend_string;
+  pzs: zend_pchar;
 {$ENDIF}
 begin
   Result := false;
@@ -1282,7 +1251,7 @@ function ZValArrayKeyDel(v: pzval; key: zend_ustr): Boolean; overload;
 function ZValArrayKeyDel(v: pzval; idx: Integer): Boolean; overload;
 {$IFDEF PHP7}
 var
-  pzs: pzend_string;
+  pzs: zend_pchar;
 {$ENDIF}
 begin
   Result := false;
@@ -1359,9 +1328,9 @@ function GetArgPZval;
       vtUnicodeString:
         ZvalVAL(Result, UnicodeString(Args._Reserved1));
       vtWideChar:
-        ZvalVAL(Result, zend_ustr(Args.VWideChar));
+        ZvalVAL(Result, zend_pchar(Args.VWideChar));
       vtChar:
-        ZvalVAL(Result, zend_pchar(zend_uchar(Args.VChar)));
+        ZvalVAL(Result, zend_pchar(Args.VChar));
       vtPWideChar:
         ZvalVAL(Result, Args.VPWideChar);
       vtPChar:
@@ -1373,66 +1342,52 @@ function GetArgPZval;
 end;
 
 
-procedure ZVAL_STRINGU(z: pzval; s: PUtf8Char; duplicate: boolean);
+procedure ZVAL_STRINGU(z: pzval; s: UTF8String; duplicate: boolean);
 var
-  __s : PUTF8Char;
+  sc: PUTF8Char;
 begin
-  if not assigned(s) then
-   __s := ''
-    else
-     __s := s;
-
-  z^.value.str.len := length(__s);
+  sc := PUtf8Char(s);
+  z^.value.str.len := Length(s);
   if duplicate then
-
-   z^.value.str.val := estrndup(__s, z^.value.str.len)
+    z^.value.str.val := estrndup(sc, z^.value.str.len)
   else
-    z^.value.str.val := __s;
-  {$IFDEF PHP7} z^.u1.v._type {$ELSE} z^._type {$ENDIF} := IS_STRING;
+    z^.value.str.val := sc;
+
+  z^._type := IS_STRING;
 end;
 
-procedure ZVAL_STRING(z: pzval; s: zend_pchar; duplicate: boolean);
-var
-  __s : zend_pchar;
+procedure ZVAL_RawStr(z: pzval; s: RawByteString; duplicate: boolean);
+var _s: RawByteString;
 begin
-  if not assigned(s) then
-   __s := ''
-    else
-     __s := s;
-
-  z^.value.str.len := strlen(__s);
-  if duplicate then
-
-   z^.value.str.val := estrndup(__s, z^.value.str.len)
-  else
-    z^.value.str.val := __s;
-  {$IFDEF PHP7} z^.u1.v._type {$ELSE} z^._type {$ENDIF} := IS_STRING;
+  _s := s;
+  SetCodePage(_s, CP_UTF8, not IsUTF8String(_s));
+  ZVAL_STRINGU(z, UTF8String(_s), duplicate);
 end;
 
-procedure ZVAL_STRINGW(z: pzval; s: PWideChar; duplicate: boolean);
+procedure ZVAL_STRING(z: pzval; s: WideString; duplicate: boolean);
+begin
+  ZVAL_STRINGU(z, UTF8String(s), duplicate);
+end;
+procedure ZVAL_STRINGW(z: pzval; StW: WideString; duplicate: boolean);
 var
-  __s : zend_pchar;
-  StA : zend_ustr;
-  StW : WideString;
+  St: UTF8String;
+  sc: PUTF8Char;
 begin
-  if not assigned(s) then
-   __s := ''
-    else
-      begin
-        StW := WideString(s);
-        StA := zend_ustr(StW);
-        __s := zend_pchar(StA);
-      end;
 
-  z^.value.str.len := strlen(__s);
+  St := UTF8String(StW);
+  sc := PUtf8Char(St);
+  z^.value.str.len := Length(St);
   if duplicate then
-
-   z^.value.str.val := estrndup(__s, z^.value.str.len)
+    z^.value.str.val := estrndup(sc, z^.value.str.len)
   else
-    z^.value.str.val := __s;
-  {$IFDEF PHP7} z^.u1.v._type {$ELSE} z^._type {$ENDIF} := IS_STRING;
-end;
+    z^.value.str.val := sc;
 
+  z^._type := IS_STRING;
+end;
+procedure ZVAL_STRINGA(z: pzval; s: AnsiString; duplicate: boolean);
+begin
+  ZVAL_STRINGU(z, UTF8String(s), duplicate);
+end;
 procedure ZVAL_STRINGL(z: pzval; s: zend_pchar; l: integer; duplicate: boolean);
 var
   __s  : zend_pchar;
@@ -1479,27 +1434,28 @@ procedure ZVAL_STRINGLW(z: pzval; s: PWideChar; l: integer; duplicate: boolean);
 procedure ZVAL_EMPTY_STRING(z: pzval);
 begin
   z^.value.str.len := 0;
- // {$IFDEF PHP510}
   z^.value.str.val := STR_EMPTY_ALLOC;
-  (*{$ELSE}
-  z^.value.str.val := '';
-  {$ENDIF}*)
   {$IFDEF PHP7} z^.u1.v._type {$ELSE} z^._type {$ENDIF} := IS_STRING;
 end;
 
-function ToStrA(V: Variant): zend_ustr;
+function ToStrA(V: Variant): AnsiString;
 begin
   Result := V;
 end;
 
-function ToStr(V: Variant): String;
+function ToStr(V: Variant): zend_ustr;
+begin
+  Result := V;
+end;
+
+function ToStrW(V: Variant): WideString;
 begin
   Result := V;
 end;
 
 function ToPChar(V: Variant): zend_pchar;
 begin
-  Result := zend_pchar(ToStr(V));
+  Result := zend_pchar(zend_ustr(V));
 end;
 
 function toWChar(s: zend_pchar): PWideChar;
@@ -1541,8 +1497,6 @@ procedure VarArrayToHash(var HT: pzval;Value: Variant);
 end;
 function ZendToVariant(const Value: pzval;
 cobj: TObjectBConvertMethod=nil): Variant; overload;
-  Var
-  S: String;
 begin
  case {$IFDEF PHP7} Value^.u1.v._type {$ELSE}Value^._type{$ENDIF} of
  0: Result := Null;                           //Null
@@ -1558,11 +1512,11 @@ function ZendToVariant(const Value: pzval;
   if Assigned(cobj) then
     Result := cobj(Value)
   else
-    Result := Null;                           //String
- 6: begin S := Value^.value.str.val; Result := S; end;
+    Result := Null;
+ 6: Result := Z_STRVAL(Value);                 //String
  7: Result := Value^.value.lval;              //Resource
                                               //Constant
- 8: begin S := Value^.value.str.val; Result := S; end;
+ 8: Result := Z_STRVAL(Value);
  {$IFDEF PHP7}
   9: Result := HashToVarArray(Value^.value.arr) //Constant Array
  {$ELSE}
@@ -1586,9 +1540,10 @@ procedure VariantToZend(const Value:Variant;z:pzval;
   case TVarData(Value).VType of
   varString    : //Peter Enz
          begin
+         // ShowMessage('h_e');
            if Assigned ( TVarData(Value).VString ) then
              begin
-               ZVAL_STRING(z, TVarData(Value).VString , true);
+               ZVAL_STRINGA(z, AnsiString(PAnsiChar(TVarData(Value).VString)), true);
              end
                else
                  begin
@@ -1663,9 +1618,10 @@ procedure VariantToZend(const Value:Variant;z:pzval;
      end;
      varStrArg    : //Peter Enz
          begin
+          //ShowMessage('h_e_e');
            if Assigned ( TVarData(Value).VString ) then
              begin
-               ZVAL_STRING(z, TVarData(Value).VString , true);
+               ZVAL_STRINGA(z, AnsiString(PAnsiChar(TVarData(Value).VString)), true);
              end
                else
                  begin
@@ -1843,7 +1799,7 @@ procedure ZVAL_ARRAY(z: pzval; arr:  TASDate); overload;
 
    for i := 0 to Length(arr)-1 do
     begin
-       add_next_index_string(z, zend_pchar(arr[i]), 1);
+       add_next_index_string(z, zend_pchar(zend_ustr(arr[i])), 1);
     end;
     Exit;
 end;
@@ -2002,7 +1958,7 @@ procedure ZVAL_ARRAYAC(z: pzval; keynames: Array of ansichar; keyvals: Array of
   if Length(keynames) = Length(keyvals) then
    begin
    for i := 0 to Length(keynames)-1 do
-      add_assoc_string_ex(z, zend_pchar(zend_uchar(keynames[i])), StrLen(PAnsiChar(keynames[i])) + 1, zend_pchar(zend_uchar(keyvals[i])), 1);
+      add_assoc_string_ex(z, zend_pchar(zend_ustr(keynames[i])), Length(zend_ustr(keynames[i])) + 1, zend_pchar(zend_ustr(keyvals[i])), 1);
    end
    else
    begin
@@ -2033,7 +1989,7 @@ procedure ZVAL_ARRAYWC(z: pzval; keynames: Array of PWideChar; keyvals: Array of
    begin
    for i := 0 to Length(keynames)-1 do
     begin
-      add_assoc_string_ex(z, zend_pchar(keynames[i]), StrLen(zend_pchar(keynames[i])) + 1, zend_pchar(keyvals[i]), 1);
+      add_assoc_string_ex(z, zend_pchar(zend_ustr(keynames[i])), Length(zend_ustr(keynames[i])) + 1, zend_pchar(zend_ustr(keyvals[i])), 1);
     end;
     Exit;
    end
@@ -2070,7 +2026,7 @@ procedure ZVAL_ARRAYWS(z: pzval; keynames:  TWSDate; keyvals:  TWSDate); overloa
     begin
                     //������ ������ � ������� ������� ������
                     //������ ���������� ������ � ������ ������� ������
-      add_assoc_string_ex(z, zend_pchar(zend_ustr(keynames[i])), StrLen(zend_pchar(zend_ustr(keynames[i]))) + 1,
+      add_assoc_string_ex(z, zend_pchar(zend_ustr(keynames[i])), Length(zend_ustr(keynames[i])) + 1,
       zend_pchar(zend_ustr(keyvals[i])), 1);
 
                     //���������� ����
@@ -2108,7 +2064,7 @@ procedure ZVAL_ARRAYWS(z: pzval; keynames:  array of string; keyvals:  array of
    begin
    for i := 0 to Length(keynames)-1 do
     begin
-      add_assoc_string_ex(z, zend_pchar(zend_ustr(keynames[i])), StrLen(zend_pchar(zend_ustr(keynames[i]))) + 1,
+      add_assoc_string_ex(z, zend_pchar(zend_ustr(keynames[i])), Length(zend_ustr(keynames[i])) + 1,
       zend_pchar(zend_ustr(keyvals[i])), 1);
     end;
     Exit;
@@ -2144,7 +2100,7 @@ procedure ZVAL_ARRAYAS(z: pzval; keynames: TASDate; keyvals: TASDate); overload;
    begin
    for i := 0 to Length(keynames)-1 do
     begin
-      add_assoc_string_ex(z, zend_pchar(keynames[i]), StrLen(zend_pchar(keynames[i])) + 1, zend_pchar(keyvals[i]), 1);
+      add_assoc_string_ex(z, zend_pchar(zend_ustr(keynames[i])), Length(zend_ustr(keynames[i])) + 1, zend_pchar(zend_ustr(keyvals[i])), 1);
     end;
     Exit;
    end
@@ -2179,7 +2135,7 @@ procedure ZVAL_ARRAYAS(z: pzval; keynames: Array of AnsiString; keyvals: Array o
    begin
    for i := 0 to Length(keynames)-1 do
     begin
-      add_assoc_string_ex(z, zend_pchar(zend_ustr(keynames[i])), StrLen(PAnsiChar(keynames[i])) + 1, zend_pchar(zend_ustr(keyvals[i])), 1);
+      add_assoc_string_ex(z, zend_pchar(zend_ustr(keynames[i])), Length(zend_ustr(keynames[i])) + 1, zend_pchar(zend_ustr(keyvals[i])), 1);
     end;
     Exit;
    end
@@ -3202,7 +3158,7 @@ function zend_unregister_functions(functions : {$IFDEF PHP7}P_zend_function_entr
 var
  i : integer;
  {$IFDEF PHP7}
- pzs: pzend_string;
+ pzs: zend_pchar;
  {$ENDIF}
  ptr : {$IFDEF PHP7}P_zend_function_entry{$ELSE}pzend_function_entry{$ENDIF};
 begin
@@ -3481,8 +3437,6 @@ function Z_DVAL(z : pzval) : double;
 end;
 
 function Z_VARREC(z: pzval): TVarRec;
-  Var
-  P: zend_ustr;
 begin
   if z = nil then
   begin
@@ -3506,16 +3460,8 @@ function Z_VARREC(z: pzval): TVarRec;
             Result.VExtended^ := z.value.dval;
         end;
         IS_STRING: begin
-            Result.VType := {$IFDEF PHP_UNICE}vtString{$ELSE}vtAnsiString{$ENDIF};
-
-            SetLength(P, z.value.str.len);
-            Move(z.value.str.val^, P[1], z.value.str.len);
-
-            {$IFDEF PHP_UNICE}
-              Result.VUnicodeString := Pointer(p);
-            {$ELSE}
-              Result.VAnsiString := Pointer(P);
-            {$ENDIF}
+            Result.VType   := vtWideString;
+            Result.VWideString := PWideChar(Z_STRVAL(z));
         end;
         else
         begin
@@ -3524,71 +3470,56 @@ function Z_VARREC(z: pzval): TVarRec;
         end;
     end;
 end;
-
-function Z_STRUVAL(z : pzval) : UTF8String;
+function Z_RawStr(z: pzval): RawByteString;
+{$ifdef fpc}
+var
+  s_len: SizeInt;
+{$endif}
 begin
-  if z = nil then
-  begin
-      Result := '';
-      exit;
-  end;
-
-  if {$IFDEF PHP7}z.u1.v._type{$ELSE}z._type{$ENDIF} = IS_STRING then
-  begin
-     SetLength(Result, z.value.str.len);
-     Move(z.value.str.val^, Result[1], z.value.str.len);
-  end else
-    case {$IFDEF PHP7}z.u1.v._type{$ELSE}z._type{$ENDIF} of
-       IS_LONG: Result := IntToStr(z.value.lval);
-       IS_DOUBLE: Result := FloatToStr(z.value.dval);
-       IS_BOOL: if z.value.lval = 0 then Result := '' else Result := '1';
-       else
-        Result := '';
+  Result := '';
+  case z^._type of
+    IS_BOOL:
+    begin
+      if z^.value.lval = 1 then
+        Result := RawByteString('True')
+      Else
+        Result := RawByteString('False');
     end;
+    IS_LONG:
+      Result := RawByteString(inttostr(z^.value.lval));
+    IS_DOUBLE:
+      Result := RawByteString(FloatToStr(z^.value.dval));
+    IS_STRING:
+      begin
+          SetString(Result, PAnsiChar(z^.value.str.val), z^.value.str.len);
+          SetCodePage(Result, CP_UTF8, not IsUTF8String(Result));
+      end;
+    IS_ARRAY:
+       Result := RawByteString('(array)');
+    IS_OBJECT:
+       Result := RawByteString('[object]');
+    IS_RESOURCE:
+       Result := RawByteString('#resource#id:' + IntToStr(z^.value.lval));
+  end;
 end;
-
-function Z_STRVAL(z : pzval) : zend_ustr;
+function Z_STRUVAL(z : pzval) : UTF8String;
 begin
-  if z = nil then
-  begin
-      Result := '';
-      exit;
-  end;
+  Result := UTf8String(Z_RawStr(z));
+end;
 
-  if {$IFDEF PHP7}z.u1.v._type{$ELSE}z._type{$ENDIF} = IS_STRING then
-  begin
-     SetLength(Result, z.value.str.len);
-     Move(z.value.str.val^, Result[1], z.value.str.len);
-  end else
-    case {$IFDEF PHP7}z.u1.v._type{$ELSE}z._type{$ENDIF} of
-       IS_LONG: Result := IntToStr(z.value.lval);
-       IS_DOUBLE: Result := FloatToStr(z.value.dval);
-       IS_BOOL: if z.value.lval = 0 then Result := '' else Result := '1';
-       else
-        Result := '';
-    end;
+function Z_STRVAL(z : pzval) : WideString;
+begin
+  Result := WideString(Z_RawStr(z));
 end;
 
-function Z_STRWVAL(z : pzval) : String;
+function Z_ASTRVAL(z : pzval) : AnsiString;
 begin
-  if z = nil then
-  begin
-      Result := '';
-      exit;
-  end;
+  Result := AnsiString(Z_RawStr(z));
+end;
 
-  if {$IFDEF PHP7}z.u1.v._type{$ELSE}z._type{$ENDIF} = IS_STRING then
-  begin
-     SetLength(Result, z.value.str.len);
-     Move(z.value.str.val^, Result[1], z.value.str.len);
-  end else
-    case {$IFDEF PHP7}z.u1.v._type{$ELSE}z._type{$ENDIF} of
-       IS_LONG: Result := IntToStr(z.value.lval);
-       IS_DOUBLE: Result := FloatToStr(z.value.dval);
-       IS_BOOL: if z.value.lval = 0 then Result := '' else Result := '1';
-       else
-        Result := '';
-    end;
+function Z_WSTRVAL(z : pzval) : String;
+begin
+  Result := String(Z_RawStr(z));
 end;
 
 function Z_CHAR(z: PZval) : zend_uchar;
@@ -3627,6 +3558,7 @@ function Z_ACHAR(z: PZVAL): AnsiChar;
   SetLength(S,1);
   Result := AnsiChar(S[1]);
 end;
+
 function Z_WCHAR(z: PZVAL): WideChar;
 var S: WideString;
 begin
@@ -3679,12 +3611,12 @@ function Z_OBJ_HANDLE(z :pzval) : {$IFDEF PHP7} P_zend_object_handlers {$ELSE} z
   Result := {$IFDEF PHP7}z.value.obj.handlers{$ELSE}z.value.obj.handle{$ENDIF};
 end;
 
-function Z_OBJ_HT(z : pzval) : {$IFDEF PHP7}hzend_types.P_zend_object_handlers{$ELSE}pzend_object_handlers{$ENDIF};
+function Z_OBJ_HT(z : pzval) : pzend_object_handlers;
 begin
   Result := z.value.obj.handlers;
 end;
 
-function Z_OBJPROP(z : pzval;TSRMLS_DC:pointer=nil) : {$IFDEF PHP7}hzend_types.PHashTable{$ELSE}PHashTable{$ENDIF};
+function Z_OBJPROP(z : pzval;TSRMLS_DC:pointer=nil) : {$IFDEF PHP7} PZend_Array {$ELSE} PHashTable {$ENDIF};
 {$IFDEF PHP7}
 begin
   Result := Z_OBJ_HT(z)^.get_properties(z);
@@ -3726,7 +3658,7 @@ function zend_hash_add_or_update(ht : {$IFDEF PHP7}Pzend_array{$ELSE}PHashTable{
     nKeyLength : uint; pData : {$IFDEF PHP7}pzval{$ELSE}pointer{$ENDIF}; nDataSize : uint; pDes : pointer;
     flag : integer) : integer;
 {$IFDEF PHP7}
-var pz: Pzend_string;
+var pz: zend_pchar;
 {$ENDIF}
 begin
   {$IFDEF PHP7}
@@ -3750,7 +3682,7 @@ function zend_hash_init_ex (ht : {$IFDEF PHP7}Pzend_array{$ELSE}PHashTable{$ENDI
 
 {$ENDIF}
 
-{$IFNDEF PHP_UNICE}
+{$IFNDEF PHP_UNICODE}
 function AnsiFormat(const Format: AnsiString; const Args: array of const): AnsiString;
 begin
    Result := Sysutils.Format(Format, Args);
diff --git a/Source/ZendTypes.pas b/Source/ZendTypes.pas
index 0de67d3..a9c2d43 100644
--- a/Source/ZendTypes.pas
+++ b/Source/ZendTypes.pas
@@ -495,12 +495,12 @@ interface
   {$ENDIF}
   zend_uint   = UIntPtr;
   zend_bool   = boolean;
-  zend_uchar  = {$IFDEF PHP_UNICE}Utf8Char{$ELSE}AnsiChar{$ENDIF};
-  zend_ustr   = {$IFDEF PHP_UNICE}Utf8String{$ELSE}AnsiString{$ENDIF};
+  zend_uchar  = {$IF Defined(PHP_UNICODE)}Utf8Char{$ELSE}AnsiChar{$ENDIF};
+  zend_ustr   = {$IF Defined(PHP_UNICODE)}UTF8String{$ELSE}AnsiString{$ENDIF};
   zend_ulong  = ULongPtr;
   zend_long   = IntPtr;
-  zend_pchar  = {$IFDEF PHP_UNICE}PUtf8Char{$ELSE}PAnsiChar{$ENDIF};
-  zend_pstr   = {$IFDEF PHP_UNICE}PUtf8String{$ELSE}PAnsiString{$ENDIF};
+  zend_pchar  = {$IF Defined(PHP_UNICODE)}PUtf8Char{$ELSE}PAnsiChar{$ENDIF};
+  zend_pstr   = {$IF Defined(PHP_UNICODE)}PUtf8String{$ELSE}PAnsiString{$ENDIF};
   {$IFDEF PHP7}
   _zend_refcounted_h = record
       refcount : cardinal;
@@ -529,14 +529,13 @@   _zend_string = record
   P_zend_refcounted = ^_zend_refcounted;
     zend_string = _zend_string;
     P_zend_string = ^_zend_string;
+    pzend_string = ^_zend_string;
+  {$ELSE}
+   pzend_string = zend_pchar;
   {$ENDIF}
   zend_ushort = word;
   unsigned_char = byte;
 { Common Types }
-{$IFNDEF PHP7}
-type
-  pzend_string = {$IFDEF PHP_UNICE}PUTF8Char{$ELSE}PAnsiChar{$ENDIF};
-{$ENDIF}
 type
   uint = longword;
   PINT = ^Integer;
@@ -965,7 +964,7 @@   zvalue_value = record
       0: (lval: zend_long);
       1: (dval: double);
       2: (str: record
-          val: zend_pchar;
+          val: PUTF8Char;// zend_pchar;
           len: integer;
         end);
       3: (ht: PHashTable);
diff --git a/Source/hzend_types.pas b/Source/hzend_types.pas
index e079681..573b976 100644
--- a/Source/hzend_types.pas
+++ b/Source/hzend_types.pas
@@ -205,11 +205,11 @@ interface
    uint32_t = CARDINAL;
 
 
-  zend_pchar  = {$IFDEF PHP_UNICE}PUtf8Char{$ELSE}PAnsiChar{$ENDIF};
-  zend_pstr   = {$IFDEF PHP_UNICE}PUtf8String{$ELSE}PAnsiString{$ENDIF};
+  zend_pchar  = {$IFDEF PHP_UNICODE}PUtf8Char{$ELSE}PAnsiChar{$ENDIF};
+  zend_pstr   = {$IFDEF PHP_UNICODE}PUtf8String{$ELSE}PAnsiString{$ENDIF};
 
-  //zend_uchar  = {$IFDEF PHP_UNICE}Utf8Char{$ELSE}AnsiChar{$ENDIF};
-  zend_ustr   = {$IFDEF PHP_UNICE}Utf8String{$ELSE}AnsiString{$ENDIF};
+  //zend_uchar  = {$IFDEF PHP_UNICODE}Utf8Char{$ELSE}AnsiChar{$ENDIF};
+  zend_ustr   = {$IFDEF PHP_UNICODE}Utf8String{$ELSE}AnsiString{$ENDIF};
 
 
 
diff --git a/Source/php4AppIntf.pas b/Source/php4AppIntf.pas
index ffb1b2b..ef7a952 100644
--- a/Source/php4AppIntf.pas
+++ b/Source/php4AppIntf.pas
@@ -12,8 +12,7 @@
 unit php4AppIntf;
 
 interface
-type
-zend_pchar = {$IF DEFINED(Unicode)} PUTF8Char {$ELSE} PAnsiChar {$ENDIF};
+uses ZendTypes;
 function  InitRequest : integer; stdcall;
 procedure DoneRequest(RequestID : integer); stdcall;
 procedure RegisterVariable(RequestID : integer; AName : zend_pchar; AValue : zend_pchar); stdcall;
diff --git a/Source/php4AppUnit.pas b/Source/php4AppUnit.pas
index 459d395..b2b78c1 100644
--- a/Source/php4AppUnit.pas
+++ b/Source/php4AppUnit.pas
@@ -234,7 +234,7 @@ procedure PrepareResult(RequestID : integer; TSRMLS_D : pointer);
           if zend_hash_find(ht, zend_pchar(InfoBlock.VarList.Names[cnt]),
           strlen(zend_pchar(InfoBlock.VarList.Names[cnt])) + 1, data) = SUCCESS then
           case data^^^._type of
-            IS_STRING : InfoBlock.VarList.Values[InfoBlock.VarList.Names[cnt]] := data^^^.value.str.val;
+            IS_STRING : InfoBlock.VarList.Values[InfoBlock.VarList.Names[cnt]] := Z_STRVAL(data^^);
             IS_LONG,
             IS_RESOURCE,
             IS_BOOL   : InfoBlock.VarList.Values[InfoBlock.VarList.Names[cnt]] := IntToStr(data^^^.value.lval);
diff --git a/Source/php4delphi.pas b/Source/php4delphi.pas
index 33ffd04..98bfd2b 100644
--- a/Source/php4delphi.pas
+++ b/Source/php4delphi.pas
@@ -38,9 +38,9 @@ interface
 uses
   Windows, Messages, SysUtils, System.Types, Classes, VCL.Graphics,
   PHPCommon, WinApi.WinSock,
-  {$IFDEF PHP7} hzend_types, {$ELSE} ZendTypes, {$ENDIF} PHPTypes, PHPAPI, ZENDAPI,
+  ZendTypes, PHPTypes, PHPAPI, ZENDAPI,
   DelphiFunctions, phpFunctions, strUtils, varUtils,
-  {$IFDEF PHP_UNICE}WideStrUtils, {$ENDIF}
+  {$IFDEF PHP_UNICODE}WideStrUtils, {$ENDIF}
   {$IFDEF soulengine_build} VCL.Dialogs, {$ENDIF}
   System.UITypes;
 
@@ -868,11 +868,11 @@ procedure delphi_error_cb(_type : integer; const error_filename : zend_pchar;
                end;
               {$IFDEF CUTTED_PHP7dll}
                ShowMessage(
-                {$IFDEF PHP_UNICE}Format{$ELSE}AnsiFormat{$ENDIF}
+                Format
                 ('PHP4DELPHI %s:  %s in %s on line %d', [error_type_str, buffer, error_filename, error_lineno]));
               {$ELSE}
                 php_log_err(zend_pchar(
-               {$IFDEF PHP_UNICE}Format{$ELSE}AnsiFormat{$ENDIF}
+               {$IFDEF PHP_UNICODE}Format{$ELSE}AnsiFormat{$ENDIF}
                ('PHP4DELPHI %s:  %s in %s on line %d', [error_type_str, buffer, error_filename, error_lineno])), p);
               {$ENDIF}
              end;
@@ -1253,7 +1253,7 @@ procedure TpsvCustomPHP.PrepareResult;
           begin
             variable := data^^;
             convert_to_string(variable);
-            FVariables[cnt].Value := variable^.value.str.val;
+            FVariables[cnt].Value := Z_STRVAL(variable);
           end;
         finally
           freemem(data);
@@ -1423,10 +1423,11 @@ procedure TpsvCustomPHP.CloseVirtualFile;
 end;
 
 function TpsvCustomPHP.CreateVirtualFile(A_code : zend_ustr): boolean;
-{$IFDEF PHP4}
 var
- _handles : array[0..1] of THandle;
+{$IFDEF PHP4}
+_handles : array[0..1] of THandle;
 {$ENDIF}
+sc:PUTF8Char;
 begin
 
   Result := false;
@@ -1580,7 +1581,7 @@ procedure TPHPEngine.HandleRequest(ht: integer; return_value: pzval;
                    if not IsParamTypeCorrect(FParameters[j].ParamType, Params[j]^) then
                      begin
                        zend_error(E_WARNING, zend_pchar(
-                       {$IFDEF PHP_UNICE}Format{$ELSE}AnsiFormat{$ENDIF}
+                       {$IFDEF PHP_UNICODE}Format{$ELSE}AnsiFormat{$ENDIF}
                        ('Wrong parameter type for %s()', [FActiveFunctionName])));
                        Exit;
                      end;
@@ -1671,7 +1672,7 @@ procedure TPHPEngine.PrepareEngine;
   delphi_sapi_module.register_server_variables := @php_delphi_register_variables;
   delphi_sapi_module.log_message := @php_delphi_log_message;
   if FIniPath <> '' then
-     delphi_sapi_module.php_ini_path_override := PAnsiChar(FIniPath)
+     delphi_sapi_module.php_ini_path_override := zend_pchar(FIniPath)
   else
      delphi_sapi_module.php_ini_path_override :=  nil;
   delphi_sapi_module.block_interruptions := nil;
@@ -1720,7 +1721,7 @@ procedure TPHPEngine.RegisterConstants;
       strlen(zend_pchar(ConstantName)) + 1,
       zend_pchar(ConstantValue), CONST_PERSISTENT or CONST_CS, 0, TSRMLS_D);
   end;
-  zend_register_bool_constant( zend_pchar('UTF8_SUPPORT'), 13, {$IFDEF PHP_UNICE}TRUE{$ELSE}FALSE{$ENDIF},
+  zend_register_bool_constant( zend_pchar('UTF8_SUPPORT'), 13, {$IFDEF PHP_UNICODE}TRUE{$ELSE}FALSE{$ENDIF},
     CONST_PERSISTENT or CONST_CS, 0, TSRMLS_D);
   RegisterInternalConstants(TSRMLS_D);
 end;
@@ -1796,7 +1797,7 @@ procedure TPHPEngine.RegisterLibrary(ALib : TCustomPHPLibrary);
   for cnt := 0 to ALib.Functions.Count - 1 do
    begin
       FN :=
-      {$IFDEF PHP_UNICE}UTF8LowerCase{$ELSE}AnsiLowerCase{$ENDIF}
+      {$IFDEF PHP_UNICODE}UTF8LowerCase{$ELSE}AnsiLowerCase{$ENDIF}
       (ALib.Functions[cnt].FunctionName);
       if FHash.IndexOf(FN) > -1 then
       begin
@@ -1809,7 +1810,7 @@ procedure TPHPEngine.RegisterLibrary(ALib : TCustomPHPLibrary);
    begin
       for cnt := 0 to ALib.Functions.Count - 1 do
        begin
-         FN := {$IFDEF PHP_UNICE}UTF8LowerCase{$ELSE}AnsiLowerCase{$ENDIF}
+         FN := {$IFDEF PHP_UNICODE}UTF8LowerCase{$ELSE}AnsiLowerCase{$ENDIF}
          (ALib.Functions[cnt].FunctionName);
          FHash.AddObject(FN, ALib.Functions[cnt]);
        end;
diff --git a/Source/phpClass.pas b/Source/phpClass.pas
index 8e3f286..1074d34 100644
--- a/Source/phpClass.pas
+++ b/Source/phpClass.pas
@@ -18,7 +18,7 @@ interface
 
 uses
   Windows, SysUtils, Classes, PHPCommon,
-  {$IFDEF PHP_UNICE}WideStrUtils, {$ENDIF}
+  {$IFDEF PHP_UNICODE}WideStrUtils, {$ENDIF}
   ZendTypes, ZendAPI, phpTypes, PHPAPI,
   phpFunctions;
 
@@ -234,7 +234,7 @@ function class_get_property_handler(_object : pzval; member : pzval; _type : int
 begin
   retval := emalloc(sizeof(zval));
   ZeroMemory(retval, sizeof(zval));
-  propname := member^.value.str.val;
+  propname := Z_STRVAL(member);
   new(data);
     try
      object_properties := Z_OBJPROP(_object);
@@ -271,7 +271,7 @@ procedure class_set_property_handler(_object : pzval; member : pzval; value : pz
  object_properties : PHashTable;
  param : TClassProperty;
 begin
-  propname := member^.value.str.val;
+  propname := Z_STRVAL(member);
   new(data);
     try
      object_properties := Z_OBJPROP(_object);
@@ -288,7 +288,7 @@ procedure class_set_property_handler(_object : pzval; member : pzval; value : pz
     convert_to_string(value);
     param := Obj.Properties.ByName(propname);
     if Assigned(param) then
-     param.Value := value.value.str.val;
+     param.Value := Z_STRVAL(value);
    end;
 
 end;
@@ -567,7 +567,7 @@ procedure TPHPClass.ProduceInstance(AValue: pzval);
 
 procedure TPHPClass.SetClassName(const Value: zend_ustr);
 begin
-  FClassName := {$IFDEF PHP_UNICE}UTF8LowerCase(Value){$ELSE}LowerCase(Value){$ENDIF};
+  FClassName := {$IFDEF PHP_UNICODE}UTF8LowerCase(Value){$ELSE}LowerCase(Value){$ENDIF};
 end;
 
 procedure TPHPClass.SetMethods(const Value: TPHPClassmethods);
@@ -875,17 +875,17 @@ procedure TPHPClassMethod.SetDisplayName(const Value: string);
   F: TPHPClassMethod;
 begin
   if
-  {$IFDEF PHP_UNICE}CompareText{$ELSE}AnsiCompareText{$ENDIF}(Value, FName) <> 0 then
+  {$IFDEF PHP_UNICODE}CompareText{$ELSE}AnsiCompareText{$ENDIF}(Value, FName) <> 0 then
   begin
     if Collection <> nil then
       for I := 0 to Collection.Count - 1 do
       begin
         F := TPHPClassMethods(Collection).Items[I];
         if (F <> Self) and (F is TPHPClassMethod) and
-          ({$IFDEF PHP_UNICE}CompareText{$ELSE}AnsiCompareText{$ENDIF}(Value, F.Name) = 0) then
+          ({$IFDEF PHP_UNICODE}CompareText{$ELSE}AnsiCompareText{$ENDIF}(Value, F.Name) = 0) then
           raise Exception.Create('Duplicate method name');
       end;
-    FName :=  {$IFDEF PHP_UNICE}LowerCase(Value){$ELSE}AnsiLowerCase(Value){$ENDIF};
+    FName :=  {$IFDEF PHP_UNICODE}LowerCase(Value){$ELSE}AnsiLowerCase(Value){$ENDIF};
     Changed(False);
   end;
 end;

From fd245b246a56e81dd7cc077a0bde79a15ac914d7 Mon Sep 17 00:00:00 2001
From: Lev Zenin <ZeLev@pm.me>
Date: Wed, 12 Feb 2020 14:38:02 +0200
Subject: [PATCH 19/35] Fixes

---
 Source/ZENDAPI.pas   | 13 +++++++++++--
 Source/ZendTypes.pas |  2 +-
 Source/phpClass.pas  |  2 +-
 3 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/Source/ZENDAPI.pas b/Source/ZENDAPI.pas
index 2a965f2..2c50f1f 100644
--- a/Source/ZENDAPI.pas
+++ b/Source/ZENDAPI.pas
@@ -3437,6 +3437,7 @@ function Z_DVAL(z : pzval) : double;
 end;
 
 function Z_VARREC(z: pzval): TVarRec;
+var P: zend_ustr;
 begin
   if z = nil then
   begin
@@ -3460,8 +3461,16 @@ function Z_VARREC(z: pzval): TVarRec;
             Result.VExtended^ := z.value.dval;
         end;
         IS_STRING: begin
-            Result.VType   := vtWideString;
-            Result.VWideString := PWideChar(Z_STRVAL(z));
+            Result.VType := {$IFDEF PHP_UNICODE}vtString{$ELSE}vtAnsiString{$ENDIF};
+
+            SetLength(P, z.value.str.len);
+            Move(z.value.str.val^, P[1], z.value.str.len);
+
+            {$IFDEF PHP_UNICODE}
+              Result.VUnicodeString := Pointer(P);
+            {$ELSE}
+              Result.VAnsiString := Pointer(P);
+            {$ENDIF}
         end;
         else
         begin
diff --git a/Source/ZendTypes.pas b/Source/ZendTypes.pas
index a9c2d43..252446a 100644
--- a/Source/ZendTypes.pas
+++ b/Source/ZendTypes.pas
@@ -964,7 +964,7 @@   zvalue_value = record
       0: (lval: zend_long);
       1: (dval: double);
       2: (str: record
-          val: PUTF8Char;// zend_pchar;
+          val: zend_pchar;
           len: integer;
         end);
       3: (ht: PHashTable);
diff --git a/Source/phpClass.pas b/Source/phpClass.pas
index 1074d34..a51fceb 100644
--- a/Source/phpClass.pas
+++ b/Source/phpClass.pas
@@ -885,7 +885,7 @@ procedure TPHPClassMethod.SetDisplayName(const Value: string);
           ({$IFDEF PHP_UNICODE}CompareText{$ELSE}AnsiCompareText{$ENDIF}(Value, F.Name) = 0) then
           raise Exception.Create('Duplicate method name');
       end;
-    FName :=  {$IFDEF PHP_UNICODE}LowerCase(Value){$ELSE}AnsiLowerCase(Value){$ENDIF};
+    FName :=  {$IFDEF PHP_UNICODE}UTF8LowerCase(Value){$ELSE}AnsiLowerCase(Value){$ENDIF};
     Changed(False);
   end;
 end;

From 93920a67e7941078c521c974bfb8bb80265acd10 Mon Sep 17 00:00:00 2001
From: Lev Zenin <ZeLev@pm.me>
Date: Wed, 12 Feb 2020 15:30:36 +0200
Subject: [PATCH 20/35] Fixes #2

---
 Source/PHPFunctions.pas |  9 ++++++++-
 Source/ZENDAPI.pas      | 13 ++-----------
 2 files changed, 10 insertions(+), 12 deletions(-)

diff --git a/Source/PHPFunctions.pas b/Source/PHPFunctions.pas
index 07abf5b..eef5c76 100644
--- a/Source/PHPFunctions.pas
+++ b/Source/PHPFunctions.pas
@@ -611,7 +611,14 @@ function TZendVariable.GetAsString: zend_ustr;
    end;
 
   case {$IFDEF PHP7}FValue^.u1.v._type{$ELSE} FValue^._type{$ENDIF} of
-   IS_STRING : result := Z_STRVAL(FValue);
+   IS_STRING : begin
+                 try
+                   SetLength(Result, FValue^.value.str.len);
+                   Move(FValue^.value.str.val^, Result[1], FValue^.value.str.len);
+                 except
+                   Result := '';
+                 end;
+               end;
    IS_DOUBLE : result := FloatToStr(FValue^.value.dval);
    IS_LONG   : result := IntToStr(FValue^.value.lval);
    IS_NULL   : result := '';
diff --git a/Source/ZENDAPI.pas b/Source/ZENDAPI.pas
index 2c50f1f..5ecb63b 100644
--- a/Source/ZENDAPI.pas
+++ b/Source/ZENDAPI.pas
@@ -1552,11 +1552,7 @@ procedure VariantToZend(const Value:Variant;z:pzval;
          end;
 
   varUString    : //Peter Enz
-         begin
-            S := string(TVarData(Value).VUString);
-
-             ZVAL_STRING(z, zend_pchar(zend_ustr(S)), true);
-         end;
+             ZVAL_RawStr(z, RawByteString(TVarData(Value).VUString), true);
 
      varOleStr    : //Peter Enz
          begin
@@ -1629,12 +1625,7 @@ procedure VariantToZend(const Value:Variant;z:pzval;
                  end;
          end;
 
-     varUStrArg    : //Peter Enz
-         begin
-            S := string(TVarData(Value).VUString);
-
-             ZVAL_STRING(z, zend_pchar(zend_ustr(S)), true);
-         end;
+     varUStrArg  : ZVAL_RawStr(z, RawByteString(TVarData(Value).VUString), true);
      varInt64    : ZVALVAL(z, TVarData(Value).VInt64);
      varUInt64   : ZVALVAL(z, TVarData(Value).VUInt64);
      varShortInt : ZVALVAL(z, Integer(TVarData(Value).VShortInt));

From a5a7b69b7a3a81740fc2b59f72ae191ee374d3a6 Mon Sep 17 00:00:00 2001
From: Lev Zenin <ZeLev@pm.me>
Date: Wed, 12 Feb 2020 16:52:29 +0200
Subject: [PATCH 21/35] zend_ustr

---
 Source/ZENDAPI.pas    | 10 ++++------
 Source/php4delphi.pas |  4 ++--
 2 files changed, 6 insertions(+), 8 deletions(-)

diff --git a/Source/ZENDAPI.pas b/Source/ZENDAPI.pas
index 5ecb63b..43948b9 100644
--- a/Source/ZENDAPI.pas
+++ b/Source/ZENDAPI.pas
@@ -1538,9 +1538,8 @@ procedure VariantToZend(const Value:Variant;z:pzval;
      Exit;
    end;
   case TVarData(Value).VType of
-  varString    : //Peter Enz
+  varString    :
          begin
-         // ShowMessage('h_e');
            if Assigned ( TVarData(Value).VString ) then
              begin
                ZVAL_STRINGA(z, AnsiString(PAnsiChar(TVarData(Value).VString)), true);
@@ -1551,10 +1550,10 @@ procedure VariantToZend(const Value:Variant;z:pzval;
                  end;
          end;
 
-  varUString    : //Peter Enz
+  varUString    :
              ZVAL_RawStr(z, RawByteString(TVarData(Value).VUString), true);
 
-     varOleStr    : //Peter Enz
+     varOleStr    :
          begin
            if Assigned ( TVarData(Value).VOleStr ) then
              begin
@@ -1612,9 +1611,8 @@ procedure VariantToZend(const Value:Variant;z:pzval;
        else
         ZVALVAL(z, integer(TObject(TVarData(Value).VPointer^)));
      end;
-     varStrArg    : //Peter Enz
+     varStrArg    :
          begin
-          //ShowMessage('h_e_e');
            if Assigned ( TVarData(Value).VString ) then
              begin
                ZVAL_STRINGA(z, AnsiString(PAnsiChar(TVarData(Value).VString)), true);
diff --git a/Source/php4delphi.pas b/Source/php4delphi.pas
index 98bfd2b..d5e6a95 100644
--- a/Source/php4delphi.pas
+++ b/Source/php4delphi.pas
@@ -198,7 +198,7 @@   TCustomPHPLibrary = class(TPHPComponent)
   TPHPEngineInitEvent =  procedure(Sender:TObject;TSRMLS_DC:Pointer) of object;
   TPHPEngine = class(TPHPComponent, IUnknown, IPHPEngine)
   private
-    FINIPath : AnsiString;
+    FINIPath : zend_ustr;
     FOnEngineStartup  : TNotifyEvent;
     FAddMods          : TArray<Pzend_module_entry>;
     FOnEngineShutdown : TNotifyEvent;
@@ -264,7 +264,7 @@   TPHPEngine = class(TPHPComponent, IUnknown, IPHPEngine)
     property  OnEngineShutdown : TNotifyEvent read FOnEngineShutdown write FOnEngineShutdown;
     property  OnScriptError : TPHPErrorEvent read FOnScriptError write FOnScriptError;
     property  OnLogMessage : TPHPLogMessage read FOnLogMessage write FOnLogMessage;
-    property  IniPath : AnsiString read FIniPath write FIniPath;
+    property  IniPath : zend_ustr read FIniPath write FIniPath;
     {$IFNDEF PHP540}
     property  SafeMode : boolean read FSafeMode write FSafeMode default false;
     property  SafeModeGid : boolean read FSafeModeGid write FSafeModeGid default false;

From 978b112c9c283e3a1acb28dd998d2ff45e957984 Mon Sep 17 00:00:00 2001
From: Lev Zenin <ZeLev@pm.me>
Date: Wed, 12 Feb 2020 17:57:41 +0200
Subject: [PATCH 22/35] Some small fixes

One more step #7 to remove assembler
---
 Source/Demos/psvPHP/console/phpcon.dpr | 2 +-
 Source/ZENDAPI.pas                     | 1 -
 Source/php4delphi.pas                  | 5 +----
 3 files changed, 2 insertions(+), 6 deletions(-)

diff --git a/Source/Demos/psvPHP/console/phpcon.dpr b/Source/Demos/psvPHP/console/phpcon.dpr
index afe658b..e6ab66e 100644
--- a/Source/Demos/psvPHP/console/phpcon.dpr
+++ b/Source/Demos/psvPHP/console/phpcon.dpr
@@ -42,7 +42,7 @@ var
 begin
   if zend_parse_method_parameters(1, TSRMLS_DC, this_ptr, 'z', @p) = 0 then
   begin
-      ZVAL_STRING(z,'🐆🐆🐆 .-=WPD=-. 🐆🐆🐆',true);
+      ZVAL_STRINGW(p,'🐆🐆🐆 .-=WPD=-. 🐆🐆🐆',true);
   end;
 end;
 begin
diff --git a/Source/ZENDAPI.pas b/Source/ZENDAPI.pas
index 43948b9..531519b 100644
--- a/Source/ZENDAPI.pas
+++ b/Source/ZENDAPI.pas
@@ -1530,7 +1530,6 @@ procedure VariantToZend(const Value:Variant;z:pzval;
 cobj: TObjectAConvertMethod=nil);
 var
  W : WideString;
- S: String;
 begin
   if VarIsEmpty(value) or VarIsNull(Value) then
    begin
diff --git a/Source/php4delphi.pas b/Source/php4delphi.pas
index d5e6a95..e55b8ae 100644
--- a/Source/php4delphi.pas
+++ b/Source/php4delphi.pas
@@ -1616,10 +1616,7 @@ procedure TPHPEngine.PrepareIniEntry;
 
    if FHandleErrors then
    begin
-    // p := integer(GetProcAddress(PHPLib, 'zend_do_print'));
-     p := GetProcAddress(PHPLib, 'zend_error_cb');
-     p2 := @delphi_error_cb;
-     Move(p, p2, 1);
+     ppointer(GetProcAddress(PHPLib, 'zend_error_cb'))^ := @delphi_error_cb;
    end;
     {$IFNDEF PHP540}
   if FSafeMode then

From 75337d1711d0d88e58adad2ad84dedd576d02e3a Mon Sep 17 00:00:00 2001
From: Lev Zenin <ZeLev@pm.me>
Date: Sat, 15 Feb 2020 05:04:34 +0200
Subject: [PATCH 23/35] Update ZENDAPI.pas

---
 Source/ZENDAPI.pas | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Source/ZENDAPI.pas b/Source/ZENDAPI.pas
index 531519b..2b82542 100644
--- a/Source/ZENDAPI.pas
+++ b/Source/ZENDAPI.pas
@@ -1058,7 +1058,7 @@ procedure ZvalVAL(z:pzval; v:Double);
   z^.u1.v._type
   {$ELSE}
   z^._type
-  {$ENDIF} := IS_LONG;
+  {$ENDIF} := IS_DOUBLE;
   z.value.dval := v;
 End;
 

From 14d9e47e7a4d5b02e531cc2dc9a0e23519fd6478 Mon Sep 17 00:00:00 2001
From: Lev Zenin <ZeLev@pm.me>
Date: Sat, 15 Feb 2020 07:22:18 +0200
Subject: [PATCH 24/35] actualized calls

---
 Source/phpClass.pas   |  2 +-
 Source/phpModules.pas | 13 +++++++++++--
 2 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/Source/phpClass.pas b/Source/phpClass.pas
index a51fceb..3770112 100644
--- a/Source/phpClass.pas
+++ b/Source/phpClass.pas
@@ -367,7 +367,7 @@ function class_call_method(method : zend_pchar; ht : integer; return_value : pzv
              M.ZendVar.AsZendVariable := return_value; //direct access to zend variable
              M.FOnExecute(Obj, M.Parameters, M.ReturnValue, M.FZendVar.AsZendVariable, this_ptr, TSRMLS_DC);
              if M.ZendVar.ISNull then   //perform variant conversion
-              variant2zval(M.ReturnValue, return_value);
+              VariantToZend(M.ReturnValue, return_value);
 
           end;
        end;
diff --git a/Source/phpModules.pas b/Source/phpModules.pas
index 04dcf0a..6c12fa1 100644
--- a/Source/phpModules.pas
+++ b/Source/phpModules.pas
@@ -265,7 +265,7 @@ function rshutdown (_type : integer; module_number : integer; TSRMLS_DC : pointe
 procedure DispatchRequest(ht : integer; return_value : pzval; return_value_ptr : ppzval;
             this_ptr : pzval; return_value_used : integer; TSRMLS_DC : pointer); cdecl;
 begin
-  ZVAL(return_value);
+  ZvalVal(return_value);
   if Assigned(Application) then
    try
      Application.HandleRequest(ht, return_value, return_value_ptr, this_ptr,  return_value_used, TSRMLS_DC);
@@ -407,22 +407,30 @@ function TCustomPHPExtension.FunctionByName(
 
 procedure TCustomPHPExtension.phpwrite(str: zend_pchar; str_len: integer);
 begin
+{$IFNDEF PHP550}
   php_body_write(str, str_len, FTSRMLS);
+{$ENDIF}
 end;
 
 procedure TCustomPHPExtension.phpwrite_h(str: zend_pchar; str_len: integer);
 begin
+{$IFNDEF PHP550}
   php_header_write(str, str_len, FTSRMLS);
+{$ENDIF}
 end;
 
 procedure TCustomPHPExtension.puts(str: zend_pchar);
 begin
+{$IFNDEF PHP550}
   php_body_write(str, strlen(str), FTSRMLS);
+{$ENDIF}
 end;
 
 procedure TCustomPHPExtension.puts_h(str: zend_pchar);
 begin
+{$IFNDEF PHP550}
   php_header_write(str, strlen(str), FTSRMLS);
+{$ENDIF}
 end;
 
 procedure TCustomPHPExtension.ReportError(ErrType: integer;
@@ -466,6 +474,7 @@ procedure DoneVCLApplication;
    VCL.Forms.Application.ShowHint := False;
    VCL.Forms.Application.Destroying;
    VCL.Forms.Application.DestroyComponents;
+   {$ENDIF}
   except
   end; 
 end;
@@ -702,7 +711,7 @@ procedure TPHPApplication.HandleRequest(ht: integer;  return_value : pzval; retu
                      FZendVar.AsZendVariable := return_value;
                      AFunction.OnExecute(DataModule, FParameters, ReturnValue, FZendVar, TSRMLS_DC);
                      if FZendVar.ISNull then
-                      variant2zval(ReturnValue, return_value);
+                      VariantToZend(ReturnValue, return_value);
                     finally
                       FZendVar.Free;
                     end;

From d30902d424ec8d8c18f9e0498595040ed390e0ea Mon Sep 17 00:00:00 2001
From: Lev Zenin <ZeLev@pm.me>
Date: Tue, 18 Feb 2020 08:24:33 +0200
Subject: [PATCH 25/35] some changes

---
 .../MultithreadSample.dproj                   | 275 +++++++++++-------
 .../MultithreadSample.otares                  | Bin 0 -> 96 bytes
 .../Multithread simple/MultithreadSample.res  | Bin 1860 -> 4172 bytes
 .../MultithreadSample_Icon.ico                | Bin 0 -> 1718 bytes
 .../MultithreadSample_Icon1.ico               | Bin 0 -> 1718 bytes
 .../MultithreadSample_Icon2.ico               | Bin 0 -> 1718 bytes
 .../MultithreadSample_Icon3.ico               | Bin 0 -> 1718 bytes
 .../MultithreadSample_Icon4.ico               | Bin 0 -> 1718 bytes
 Source/Demos/psvPHP/console/phpcon.dpr        |   1 +
 Source/Demos/psvPHP/console/phpcon.dproj      |  51 ++--
 Source/PHPAPI.pas                             |   8 +-
 Source/ZENDAPI.pas                            |  86 +++---
 Source/hzend_types.pas                        |   1 -
 ...4delphi Delphi 10.1 Berlin.groupproj.local |   2 +-
 .../packages/php4delphi Delphi 10.tvsconfig   |   2 +
 Source/php4DelphiD2010.identcache             | Bin 1252 -> 1204 bytes
 Source/php4DelphiD2010.stat                   |   6 +-
 Source/php4DelphiR2010.identcache             | Bin 856 -> 823 bytes
 Source/php4DelphiR2010.stat                   |   6 +-
 Source/php4delphi.pas                         | 122 ++------
 Source/phpAbout.dfm                           |   2 +-
 readme.txt                                    |   8 +-
 22 files changed, 293 insertions(+), 277 deletions(-)
 create mode 100644 Source/Demos Delphi 2009 (WideString support)/psvPHP/Multithread simple/MultithreadSample.otares
 create mode 100644 Source/Demos Delphi 2009 (WideString support)/psvPHP/Multithread simple/MultithreadSample_Icon.ico
 create mode 100644 Source/Demos Delphi 2009 (WideString support)/psvPHP/Multithread simple/MultithreadSample_Icon1.ico
 create mode 100644 Source/Demos Delphi 2009 (WideString support)/psvPHP/Multithread simple/MultithreadSample_Icon2.ico
 create mode 100644 Source/Demos Delphi 2009 (WideString support)/psvPHP/Multithread simple/MultithreadSample_Icon3.ico
 create mode 100644 Source/Demos Delphi 2009 (WideString support)/psvPHP/Multithread simple/MultithreadSample_Icon4.ico
 create mode 100644 Source/packages/php4delphi Delphi 10.tvsconfig

diff --git a/Source/Demos Delphi 2009 (WideString support)/psvPHP/Multithread simple/MultithreadSample.dproj b/Source/Demos Delphi 2009 (WideString support)/psvPHP/Multithread simple/MultithreadSample.dproj
index 4d406d5..8e2a16e 100644
--- a/Source/Demos Delphi 2009 (WideString support)/psvPHP/Multithread simple/MultithreadSample.dproj	
+++ b/Source/Demos Delphi 2009 (WideString support)/psvPHP/Multithread simple/MultithreadSample.dproj	
@@ -1,106 +1,169 @@
-﻿	<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-		<PropertyGroup>
-			<ProjectGuid>{94D8351C-D7FA-4AB4-B4FA-8A463EB52A65}</ProjectGuid>
-			<MainSource>MultithreadSample.dpr</MainSource>
-			<Config Condition="'$(Config)'==''">Debug</Config>
-			<DCC_DCCCompiler>DCC32</DCC_DCCCompiler>
-			<ProjectVersion>12.0</ProjectVersion>
-		</PropertyGroup>
-		<PropertyGroup Condition="'$(Config)'=='Base' or '$(Base)'!=''">
-			<Base>true</Base>
-		</PropertyGroup>
-		<PropertyGroup Condition="'$(Config)'=='Release' or '$(Cfg_1)'!=''">
-			<Cfg_1>true</Cfg_1>
-			<CfgParent>Base</CfgParent>
-			<Base>true</Base>
-		</PropertyGroup>
-		<PropertyGroup Condition="'$(Config)'=='Debug' or '$(Cfg_2)'!=''">
-			<Cfg_2>true</Cfg_2>
-			<CfgParent>Base</CfgParent>
-			<Base>true</Base>
-		</PropertyGroup>
-		<PropertyGroup Condition="'$(Base)'!=''">
-			<DCC_ImageBase>00400000</DCC_ImageBase>
-			<DCC_E>false</DCC_E>
-			<DCC_Platform>x86</DCC_Platform>
-			<DCC_DependencyCheckOutputName>MultithreadSample.exe</DCC_DependencyCheckOutputName>
-			<DCC_N>false</DCC_N>
-			<DCC_S>false</DCC_S>
-			<DCC_F>false</DCC_F>
-			<DCC_K>false</DCC_K>
-		</PropertyGroup>
-		<PropertyGroup Condition="'$(Cfg_1)'!=''">
-			<DCC_LocalDebugSymbols>false</DCC_LocalDebugSymbols>
-			<DCC_Define>RELEASE;$(DCC_Define)</DCC_Define>
-			<DCC_SymbolReferenceInfo>0</DCC_SymbolReferenceInfo>
-			<DCC_DebugInformation>false</DCC_DebugInformation>
-		</PropertyGroup>
-		<PropertyGroup Condition="'$(Cfg_2)'!=''">
-			<DCC_Define>DEBUG;$(DCC_Define)</DCC_Define>
-		</PropertyGroup>
-		<ItemGroup>
-			<DelphiCompile Include="MultithreadSample.dpr">
-				<MainSource>MainSource</MainSource>
-			</DelphiCompile>
-			<DCCReference Include="frm_main.pas">
-				<Form>frmMain</Form>
-			</DCCReference>
-			<DCCReference Include="php_thread.pas"/>
-			<BuildConfiguration Include="Base">
-				<Key>Base</Key>
-			</BuildConfiguration>
-			<BuildConfiguration Include="Debug">
-				<Key>Cfg_2</Key>
-				<CfgParent>Base</CfgParent>
-			</BuildConfiguration>
-			<BuildConfiguration Include="Release">
-				<Key>Cfg_1</Key>
-				<CfgParent>Base</CfgParent>
-			</BuildConfiguration>
-		</ItemGroup>
-		<Import Project="$(BDS)\Bin\CodeGear.Delphi.Targets" Condition="Exists('$(BDS)\Bin\CodeGear.Delphi.Targets')"/>
-		<ProjectExtensions>
-			<Borland.Personality>Delphi.Personality.12</Borland.Personality>
-			<Borland.ProjectType>VCLApplication</Borland.ProjectType>
-			<BorlandProject>
-				<Delphi.Personality>
-					<Source>
-						<Source Name="MainSource">MultithreadSample.dpr</Source>
-					</Source>
-					<Parameters>
-						<Parameters Name="UseLauncher">False</Parameters>
-						<Parameters Name="LoadAllSymbols">True</Parameters>
-						<Parameters Name="LoadUnspecifiedSymbols">False</Parameters>
-					</Parameters>
-					<VersionInfo>
-						<VersionInfo Name="IncludeVerInfo">False</VersionInfo>
-						<VersionInfo Name="AutoIncBuild">False</VersionInfo>
-						<VersionInfo Name="MajorVer">1</VersionInfo>
-						<VersionInfo Name="MinorVer">0</VersionInfo>
-						<VersionInfo Name="Release">0</VersionInfo>
-						<VersionInfo Name="Build">0</VersionInfo>
-						<VersionInfo Name="Debug">False</VersionInfo>
-						<VersionInfo Name="PreRelease">False</VersionInfo>
-						<VersionInfo Name="Special">False</VersionInfo>
-						<VersionInfo Name="Private">False</VersionInfo>
-						<VersionInfo Name="DLL">False</VersionInfo>
-						<VersionInfo Name="Locale">2057</VersionInfo>
-						<VersionInfo Name="CodePage">1252</VersionInfo>
-					</VersionInfo>
-					<VersionInfoKeys>
-						<VersionInfoKeys Name="CompanyName"/>
-						<VersionInfoKeys Name="FileDescription"/>
-						<VersionInfoKeys Name="FileVersion">1.0.0.0</VersionInfoKeys>
-						<VersionInfoKeys Name="InternalName"/>
-						<VersionInfoKeys Name="LegalCopyright"/>
-						<VersionInfoKeys Name="LegalTrademarks"/>
-						<VersionInfoKeys Name="OriginalFilename"/>
-						<VersionInfoKeys Name="ProductName"/>
-						<VersionInfoKeys Name="ProductVersion">1.0.0.0</VersionInfoKeys>
-						<VersionInfoKeys Name="Comments"/>
-					</VersionInfoKeys>
-				</Delphi.Personality>
-			</BorlandProject>
-			<ProjectFileVersion>12</ProjectFileVersion>
-		</ProjectExtensions>
-	</Project>
+﻿<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+    <PropertyGroup>
+        <ProjectGuid>{94D8351C-D7FA-4AB4-B4FA-8A463EB52A65}</ProjectGuid>
+        <MainSource>MultithreadSample.dpr</MainSource>
+        <Config Condition="'$(Config)'==''">Debug</Config>
+        <DCC_DCCCompiler>DCC32</DCC_DCCCompiler>
+        <ProjectVersion>18.2</ProjectVersion>
+        <FrameworkType>VCL</FrameworkType>
+        <Base>True</Base>
+        <Platform Condition="'$(Platform)'==''">Win32</Platform>
+        <TargetedPlatforms>1</TargetedPlatforms>
+        <AppType>Application</AppType>
+    </PropertyGroup>
+    <PropertyGroup Condition="'$(Config)'=='Base' or '$(Base)'!=''">
+        <Base>true</Base>
+    </PropertyGroup>
+    <PropertyGroup Condition="('$(Platform)'=='Win32' and '$(Base)'=='true') or '$(Base_Win32)'!=''">
+        <Base_Win32>true</Base_Win32>
+        <CfgParent>Base</CfgParent>
+        <Base>true</Base>
+    </PropertyGroup>
+    <PropertyGroup Condition="('$(Platform)'=='Win64' and '$(Base)'=='true') or '$(Base_Win64)'!=''">
+        <Base_Win64>true</Base_Win64>
+        <CfgParent>Base</CfgParent>
+        <Base>true</Base>
+    </PropertyGroup>
+    <PropertyGroup Condition="'$(Config)'=='Release' or '$(Cfg_1)'!=''">
+        <Cfg_1>true</Cfg_1>
+        <CfgParent>Base</CfgParent>
+        <Base>true</Base>
+    </PropertyGroup>
+    <PropertyGroup Condition="('$(Platform)'=='Win32' and '$(Cfg_1)'=='true') or '$(Cfg_1_Win32)'!=''">
+        <Cfg_1_Win32>true</Cfg_1_Win32>
+        <CfgParent>Cfg_1</CfgParent>
+        <Cfg_1>true</Cfg_1>
+        <Base>true</Base>
+    </PropertyGroup>
+    <PropertyGroup Condition="'$(Config)'=='Debug' or '$(Cfg_2)'!=''">
+        <Cfg_2>true</Cfg_2>
+        <CfgParent>Base</CfgParent>
+        <Base>true</Base>
+    </PropertyGroup>
+    <PropertyGroup Condition="('$(Platform)'=='Win32' and '$(Cfg_2)'=='true') or '$(Cfg_2_Win32)'!=''">
+        <Cfg_2_Win32>true</Cfg_2_Win32>
+        <CfgParent>Cfg_2</CfgParent>
+        <Cfg_2>true</Cfg_2>
+        <Base>true</Base>
+    </PropertyGroup>
+    <PropertyGroup Condition="'$(Base)'!=''">
+        <VerInfo_Keys>CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments=</VerInfo_Keys>
+        <DCC_Namespace>Vcl;Vcl.Imaging;Vcl.Touch;Vcl.Samples;Vcl.Shell;System;Xml;Data;Datasnap;Web;Soap;Winapi;$(DCC_Namespace)</DCC_Namespace>
+        <SanitizedProjectName>MultithreadSample</SanitizedProjectName>
+        <VerInfo_Locale>2057</VerInfo_Locale>
+        <DCC_ImageBase>00400000</DCC_ImageBase>
+        <DCC_E>false</DCC_E>
+        <DCC_Platform>x86</DCC_Platform>
+        <DCC_DependencyCheckOutputName>MultithreadSample.exe</DCC_DependencyCheckOutputName>
+        <DCC_N>false</DCC_N>
+        <DCC_S>false</DCC_S>
+        <DCC_F>false</DCC_F>
+        <DCC_K>false</DCC_K>
+    </PropertyGroup>
+    <PropertyGroup Condition="'$(Base_Win32)'!=''">
+        <DCC_Namespace>Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace)</DCC_Namespace>
+        <AppEnableRuntimeThemes>true</AppEnableRuntimeThemes>
+        <Manifest_File>$(BDS)\bin\default_app.manifest</Manifest_File>
+        <Icon_MainIcon>MultithreadSample_Icon4.ico</Icon_MainIcon>
+        <UWP_DelphiLogo150>$(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_150.png</UWP_DelphiLogo150>
+        <VerInfo_Locale>1033</VerInfo_Locale>
+        <VerInfo_IncludeVerInfo>true</VerInfo_IncludeVerInfo>
+        <UWP_DelphiLogo44>$(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_44.png</UWP_DelphiLogo44>
+        <VerInfo_Keys>CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments=;ProgramID=com.embarcadero.$(ModuleName)</VerInfo_Keys>
+        <BT_BuildType>Debug</BT_BuildType>
+    </PropertyGroup>
+    <PropertyGroup Condition="'$(Base_Win64)'!=''">
+        <UWP_DelphiLogo150>$(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_150.png</UWP_DelphiLogo150>
+        <Icon_MainIcon>MultithreadSample_Icon4.ico</Icon_MainIcon>
+        <Manifest_File>$(BDS)\bin\default_app.manifest</Manifest_File>
+        <UWP_DelphiLogo44>$(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_44.png</UWP_DelphiLogo44>
+        <AppEnableRuntimeThemes>true</AppEnableRuntimeThemes>
+    </PropertyGroup>
+    <PropertyGroup Condition="'$(Cfg_1)'!=''">
+        <DCC_LocalDebugSymbols>false</DCC_LocalDebugSymbols>
+        <DCC_Define>RELEASE;$(DCC_Define)</DCC_Define>
+        <DCC_SymbolReferenceInfo>0</DCC_SymbolReferenceInfo>
+        <DCC_DebugInformation>0</DCC_DebugInformation>
+    </PropertyGroup>
+    <PropertyGroup Condition="'$(Cfg_1_Win32)'!=''">
+        <AppEnableHighDPI>true</AppEnableHighDPI>
+        <AppEnableRuntimeThemes>true</AppEnableRuntimeThemes>
+    </PropertyGroup>
+    <PropertyGroup Condition="'$(Cfg_2)'!=''">
+        <DCC_Define>DEBUG;$(DCC_Define)</DCC_Define>
+    </PropertyGroup>
+    <PropertyGroup Condition="'$(Cfg_2_Win32)'!=''">
+        <AppEnableHighDPI>true</AppEnableHighDPI>
+        <AppEnableRuntimeThemes>true</AppEnableRuntimeThemes>
+    </PropertyGroup>
+    <ItemGroup>
+        <DelphiCompile Include="$(MainSource)">
+            <MainSource>MainSource</MainSource>
+        </DelphiCompile>
+        <DCCReference Include="frm_main.pas">
+            <Form>frmMain</Form>
+        </DCCReference>
+        <DCCReference Include="php_thread.pas"/>
+        <BuildConfiguration Include="Debug">
+            <Key>Cfg_2</Key>
+            <CfgParent>Base</CfgParent>
+        </BuildConfiguration>
+        <BuildConfiguration Include="Base">
+            <Key>Base</Key>
+        </BuildConfiguration>
+        <BuildConfiguration Include="Release">
+            <Key>Cfg_1</Key>
+            <CfgParent>Base</CfgParent>
+        </BuildConfiguration>
+    </ItemGroup>
+    <Import Project="$(BDS)\Bin\CodeGear.Delphi.Targets" Condition="Exists('$(BDS)\Bin\CodeGear.Delphi.Targets')"/>
+    <ProjectExtensions>
+        <Borland.Personality>Delphi.Personality.12</Borland.Personality>
+        <Borland.ProjectType>VCLApplication</Borland.ProjectType>
+        <BorlandProject>
+            <Delphi.Personality>
+                <Source>
+                    <Source Name="MainSource">MultithreadSample.dpr</Source>
+                </Source>
+                <Parameters>
+                    <Parameters Name="UseLauncher">False</Parameters>
+                    <Parameters Name="LoadAllSymbols">True</Parameters>
+                    <Parameters Name="LoadUnspecifiedSymbols">False</Parameters>
+                </Parameters>
+                <VersionInfo>
+                    <VersionInfo Name="IncludeVerInfo">False</VersionInfo>
+                    <VersionInfo Name="AutoIncBuild">False</VersionInfo>
+                    <VersionInfo Name="MajorVer">1</VersionInfo>
+                    <VersionInfo Name="MinorVer">0</VersionInfo>
+                    <VersionInfo Name="Release">0</VersionInfo>
+                    <VersionInfo Name="Build">0</VersionInfo>
+                    <VersionInfo Name="Debug">False</VersionInfo>
+                    <VersionInfo Name="PreRelease">False</VersionInfo>
+                    <VersionInfo Name="Special">False</VersionInfo>
+                    <VersionInfo Name="Private">False</VersionInfo>
+                    <VersionInfo Name="DLL">False</VersionInfo>
+                    <VersionInfo Name="Locale">2057</VersionInfo>
+                    <VersionInfo Name="CodePage">1252</VersionInfo>
+                </VersionInfo>
+                <VersionInfoKeys>
+                    <VersionInfoKeys Name="CompanyName"/>
+                    <VersionInfoKeys Name="FileDescription"/>
+                    <VersionInfoKeys Name="FileVersion">1.0.0.0</VersionInfoKeys>
+                    <VersionInfoKeys Name="InternalName"/>
+                    <VersionInfoKeys Name="LegalCopyright"/>
+                    <VersionInfoKeys Name="LegalTrademarks"/>
+                    <VersionInfoKeys Name="OriginalFilename"/>
+                    <VersionInfoKeys Name="ProductName"/>
+                    <VersionInfoKeys Name="ProductVersion">1.0.0.0</VersionInfoKeys>
+                    <VersionInfoKeys Name="Comments"/>
+                </VersionInfoKeys>
+            </Delphi.Personality>
+            <Platforms>
+                <Platform value="Win32">True</Platform>
+                <Platform value="Win64">False</Platform>
+            </Platforms>
+        </BorlandProject>
+        <ProjectFileVersion>12</ProjectFileVersion>
+    </ProjectExtensions>
+    <Import Project="$(APPDATA)\Embarcadero\$(BDSAPPDATABASEDIR)\$(PRODUCTVERSION)\UserTools.proj" Condition="Exists('$(APPDATA)\Embarcadero\$(BDSAPPDATABASEDIR)\$(PRODUCTVERSION)\UserTools.proj')"/>
+</Project>
diff --git a/Source/Demos Delphi 2009 (WideString support)/psvPHP/Multithread simple/MultithreadSample.otares b/Source/Demos Delphi 2009 (WideString support)/psvPHP/Multithread simple/MultithreadSample.otares
new file mode 100644
index 0000000000000000000000000000000000000000..743599575b02e97248bade49ed2e3eabafe25a0a
GIT binary patch
diff --git a/Source/Demos Delphi 2009 (WideString support)/psvPHP/Multithread simple/MultithreadSample.res b/Source/Demos Delphi 2009 (WideString support)/psvPHP/Multithread simple/MultithreadSample.res
index c791b86b17d95defb4193c5c4f343c6fc35628c0..8afa5b2c3cd86b7e1c5d983078f9c252305bac54 100644
GIT binary patch
diff --git a/Source/Demos Delphi 2009 (WideString support)/psvPHP/Multithread simple/MultithreadSample_Icon.ico b/Source/Demos Delphi 2009 (WideString support)/psvPHP/Multithread simple/MultithreadSample_Icon.ico
new file mode 100644
index 0000000000000000000000000000000000000000..43bf0027de8e8ca4a91dc7cc72d11c86ba4bbbf9
GIT binary patch
diff --git a/Source/Demos Delphi 2009 (WideString support)/psvPHP/Multithread simple/MultithreadSample_Icon1.ico b/Source/Demos Delphi 2009 (WideString support)/psvPHP/Multithread simple/MultithreadSample_Icon1.ico
new file mode 100644
index 0000000000000000000000000000000000000000..43bf0027de8e8ca4a91dc7cc72d11c86ba4bbbf9
GIT binary patch
diff --git a/Source/Demos Delphi 2009 (WideString support)/psvPHP/Multithread simple/MultithreadSample_Icon2.ico b/Source/Demos Delphi 2009 (WideString support)/psvPHP/Multithread simple/MultithreadSample_Icon2.ico
new file mode 100644
index 0000000000000000000000000000000000000000..43bf0027de8e8ca4a91dc7cc72d11c86ba4bbbf9
GIT binary patch
diff --git a/Source/Demos Delphi 2009 (WideString support)/psvPHP/Multithread simple/MultithreadSample_Icon3.ico b/Source/Demos Delphi 2009 (WideString support)/psvPHP/Multithread simple/MultithreadSample_Icon3.ico
new file mode 100644
index 0000000000000000000000000000000000000000..43bf0027de8e8ca4a91dc7cc72d11c86ba4bbbf9
GIT binary patch
diff --git a/Source/Demos Delphi 2009 (WideString support)/psvPHP/Multithread simple/MultithreadSample_Icon4.ico b/Source/Demos Delphi 2009 (WideString support)/psvPHP/Multithread simple/MultithreadSample_Icon4.ico
new file mode 100644
index 0000000000000000000000000000000000000000..43bf0027de8e8ca4a91dc7cc72d11c86ba4bbbf9
GIT binary patch
diff --git a/Source/Demos/psvPHP/console/phpcon.dpr b/Source/Demos/psvPHP/console/phpcon.dpr
index e6ab66e..1ba3210 100644
--- a/Source/Demos/psvPHP/console/phpcon.dpr
+++ b/Source/Demos/psvPHP/console/phpcon.dpr
@@ -19,6 +19,7 @@ uses
   php4delphi,
   zendAPI,
   ZENDTypes;
+
 var
  php    : TpsvPHP;
  Engine : TPHPEngine;
diff --git a/Source/Demos/psvPHP/console/phpcon.dproj b/Source/Demos/psvPHP/console/phpcon.dproj
index 06928a9..f329cbf 100644
--- a/Source/Demos/psvPHP/console/phpcon.dproj
+++ b/Source/Demos/psvPHP/console/phpcon.dproj
@@ -8,7 +8,7 @@
         <AppType>Console</AppType>
         <FrameworkType>None</FrameworkType>
         <ProjectVersion>18.2</ProjectVersion>
-        <Platform Condition="'$(Platform)'==''">Win32</Platform>
+        <Platform Condition="'$(Platform)'==''">Win64</Platform>
     </PropertyGroup>
     <PropertyGroup Condition="'$(Config)'=='Base' or '$(Base)'!=''">
         <Base>true</Base>
@@ -39,11 +39,23 @@
         <Cfg_1>true</Cfg_1>
         <Base>true</Base>
     </PropertyGroup>
+    <PropertyGroup Condition="('$(Platform)'=='Win64' and '$(Cfg_1)'=='true') or '$(Cfg_1_Win64)'!=''">
+        <Cfg_1_Win64>true</Cfg_1_Win64>
+        <CfgParent>Cfg_1</CfgParent>
+        <Cfg_1>true</Cfg_1>
+        <Base>true</Base>
+    </PropertyGroup>
     <PropertyGroup Condition="'$(Config)'=='Debug' or '$(Cfg_2)'!=''">
         <Cfg_2>true</Cfg_2>
         <CfgParent>Base</CfgParent>
         <Base>true</Base>
     </PropertyGroup>
+    <PropertyGroup Condition="('$(Platform)'=='Win32' and '$(Cfg_2)'=='true') or '$(Cfg_2_Win32)'!=''">
+        <Cfg_2_Win32>true</Cfg_2_Win32>
+        <CfgParent>Cfg_2</CfgParent>
+        <Cfg_2>true</Cfg_2>
+        <Base>true</Base>
+    </PropertyGroup>
     <PropertyGroup Condition="('$(Platform)'=='Win64' and '$(Cfg_2)'=='true') or '$(Cfg_2_Win64)'!=''">
         <Cfg_2_Win64>true</Cfg_2_Win64>
         <CfgParent>Cfg_2</CfgParent>
@@ -116,12 +128,20 @@
         <VerInfo_Locale>1033</VerInfo_Locale>
         <VerInfo_Keys>CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments=;ProgramID=com.embarcadero.$(MSBuildProjectName)</VerInfo_Keys>
     </PropertyGroup>
+    <PropertyGroup Condition="'$(Cfg_1_Win64)'!=''">
+        <VerInfo_Locale>1033</VerInfo_Locale>
+        <VerInfo_Keys>CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments=</VerInfo_Keys>
+    </PropertyGroup>
     <PropertyGroup Condition="'$(Cfg_2)'!=''">
         <DCC_GenerateStackFrames>true</DCC_GenerateStackFrames>
         <DCC_Define>DEBUG;$(DCC_Define)</DCC_Define>
         <DCC_Optimize>false</DCC_Optimize>
     </PropertyGroup>
+    <PropertyGroup Condition="'$(Cfg_2_Win32)'!=''">
+        <Debugger_RunParams>info.php</Debugger_RunParams>
+    </PropertyGroup>
     <PropertyGroup Condition="'$(Cfg_2_Win64)'!=''">
+        <Debugger_RunParams>info.php</Debugger_RunParams>
         <VerInfo_Locale>1033</VerInfo_Locale>
         <VerInfo_Keys>CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments=</VerInfo_Keys>
     </PropertyGroup>
@@ -150,14 +170,9 @@
                     <Source Name="MainSource">phpcon.dpr</Source>
                 </Source>
                 <Excluded_Packages>
-                    <Excluded_Packages Name="C:\Program Files (x86)\FastReports\LibD24\dclfrx24.bpl">File C:\Program Files (x86)\FastReports\LibD24\dclfrx24.bpl not found</Excluded_Packages>
-                    <Excluded_Packages Name="C:\Program Files (x86)\FastReports\LibD24\dclfrxDB24.bpl">File C:\Program Files (x86)\FastReports\LibD24\dclfrxDB24.bpl not found</Excluded_Packages>
-                    <Excluded_Packages Name="C:\Program Files (x86)\FastReports\LibD24\dclfrxe24.bpl">File C:\Program Files (x86)\FastReports\LibD24\dclfrxe24.bpl not found</Excluded_Packages>
-                    <Excluded_Packages Name="C:\Program Files (x86)\FastReports\LibD24\dclfrxtee24.bpl">File C:\Program Files (x86)\FastReports\LibD24\dclfrxtee24.bpl not found</Excluded_Packages>
                     <Excluded_Packages Name="$(BDSBIN)\bcboffice2k240.bpl">Embarcadero C++Builder Office 2000 Servers Package</Excluded_Packages>
                     <Excluded_Packages Name="$(BDSBIN)\dcloffice2k240.bpl">Microsoft Office 2000 Sample Automation Server Wrapper Components</Excluded_Packages>
                     <Excluded_Packages Name="$(BDSBIN)\dclofficexp240.bpl">Microsoft Office XP Sample Automation Server Wrapper Components</Excluded_Packages>
-                    <Excluded_Packages Name="C:\Users\Lev\Documents\Embarcadero\Studio\18.0\Projects\Bpl\BCEditor.Delphi.Designtime.bpl">BCEditor Components</Excluded_Packages>
                 </Excluded_Packages>
             </Delphi.Personality>
             <Platforms>
@@ -186,22 +201,13 @@
                         <Overwrite>true</Overwrite>
                     </Platform>
                 </DeployFile>
-                <DeployFile LocalName="C:\elsewere\phpcon.exe" Configuration="Debug" Class="ProjectOutput">
+                <DeployFile LocalName="C:\elsewere\x32\phpcon.exe" Configuration="Debug" Class="ProjectOutput">
                     <Platform Name="Win32">
                         <RemoteName>phpcon.exe</RemoteName>
                         <Overwrite>true</Overwrite>
                     </Platform>
                 </DeployFile>
-                <DeployClass Name="DependencyModule">
-                    <Platform Name="Win32">
-                        <Operation>0</Operation>
-                        <Extensions>.dll;.bpl</Extensions>
-                    </Platform>
-                    <Platform Name="OSX32">
-                        <Operation>1</Operation>
-                        <Extensions>.dylib</Extensions>
-                    </Platform>
-                </DeployClass>
+                <DeployClass Name="ProjectiOSDeviceResourceRules"/>
                 <DeployClass Name="ProjectOSXResource">
                     <Platform Name="OSX32">
                         <RemoteDir>Contents\Resources</RemoteDir>
@@ -540,7 +546,16 @@
                         <Operation>1</Operation>
                     </Platform>
                 </DeployClass>
-                <DeployClass Name="ProjectiOSDeviceResourceRules"/>
+                <DeployClass Name="DependencyModule">
+                    <Platform Name="Win32">
+                        <Operation>0</Operation>
+                        <Extensions>.dll;.bpl</Extensions>
+                    </Platform>
+                    <Platform Name="OSX32">
+                        <Operation>1</Operation>
+                        <Extensions>.dylib</Extensions>
+                    </Platform>
+                </DeployClass>
                 <ProjectRoot Platform="iOSDevice64" Name="$(PROJECTNAME).app"/>
                 <ProjectRoot Platform="Win64" Name="$(PROJECTNAME)"/>
                 <ProjectRoot Platform="iOSDevice32" Name="$(PROJECTNAME).app"/>
diff --git a/Source/PHPAPI.pas b/Source/PHPAPI.pas
index 28b154e..186c619 100644
--- a/Source/PHPAPI.pas
+++ b/Source/PHPAPI.pas
@@ -66,7 +66,7 @@ interface
 
  sapi_add_header_ex: function(header_line : zend_pchar; header_line_len : uint; duplicated : zend_bool; replace : zend_bool; TSRMLS_DC : pointer) : integer; cdecl;
 
- php_execute_script : function (primary_file: PZendFileHandle; TSRMLS_D : pointer) : {$IFDEF CPUX64} Int64 {$ELSE} Integer{$ENDIF}; cdecl;
+ php_execute_script : function (primary_file: PZendFileHandle; TSRMLS_D : pointer) : longint; cdecl;
 
  php_handle_aborted_connection:  procedure; cdecl;
 
@@ -345,7 +345,7 @@ function GetSAPIGlobals : Psapi_globals_struct;
 begin
   Result := nil;
   if Assigned(sapi_globals_id) then
-     Result := __asm_fetchval(IntPtr(sapi_globals_id^), tsrmls_fetch);
+     Result := __fgsapi(pointer(sapi_globals_id^), tsrmls_fetch);
 end;
 function GetSAPIGlobals(TSRMLS_DC : pointer) : Psapi_globals_struct;
 var
@@ -354,7 +354,7 @@ function GetSAPIGlobals(TSRMLS_DC : pointer) : Psapi_globals_struct;
   Result := nil;
   sapi_global_id := GetProcAddress(PHPLib, 'sapi_globals_id');
   if Assigned(sapi_global_id) then
-     Result := __asm_fetchval(IntPtr(sapi_globals_id^), TSRMLS_DC);
+     Result := __fgsapi(pointer(sapi_globals_id^), TSRMLS_DC);
 end;
 
 function GetStringOf(const V: TVarData): string;
@@ -407,7 +407,7 @@ function GetPHPGlobals(TSRMLS_DC : pointer) : Pphp_Core_Globals;
 begin
   Result := nil;
   if Assigned(core_globals_id) then
-     Result := Pphp_Core_Globals(__asm_fetchval(IntPtr(core_globals_id^), TSRMLS_DC));
+     Result := Pphp_Core_Globals(__fgsapi(pointer(core_globals_id^), TSRMLS_DC));
 end;
 
 
diff --git a/Source/ZENDAPI.pas b/Source/ZENDAPI.pas
index 2b82542..6415459 100644
--- a/Source/ZENDAPI.pas
+++ b/Source/ZENDAPI.pas
@@ -69,6 +69,9 @@ interface
   EPHP4DelphiException = class(Exception)
    constructor Create(const Msg: zend_ustr);
   end;
+  EPHP4DelphiHookException = class(Exception)
+   constructor Create(const Msg: zend_ustr);
+  end;
 
   align_test = record
   case Integer of
@@ -82,14 +85,9 @@   align_test = record
 function AnsiFormat(const Format: AnsiString; const Args: array of const): AnsiString;
 {$ENDIF}
 function Lfunc(var Func: Pointer; addr: LPCWSTR): Bool;
+function HFunc(const Func: Pointer; addr: LPCWSTR): Bool;
 function  LoadZEND(const DllFilename: zend_ustr = PHPWin) : boolean;
-function __asm_fetchval
-{$IFDEF CPUX64}
-(val_id: int64; tsrmls_dc_p: pointer)
-{$ELSE}
-(val_id: integer; tsrmls_dc_p: pointer)
-{$ENDIF}
-: pointer;
+function __fgsapi(sapi_globals_value:pointer; tsrmls_dc:pointer): Pointer;
 
 procedure UnloadZEND;
 function  ZENDLoaded: boolean;
@@ -294,38 +292,38 @@ procedure zend_hash_internal_pointer_reset(ht: {$IFDEF PHP7} Pzend_array {$ELSE}
 // zend_constants.h
 var
   zend_get_constant                               : function(name: zend_pchar; name_len: uint; var result: zval;
-    TSRMLS_DC: Pointer): IntPtr; cdecl;
+    TSRMLS_DC: Pointer): integer; cdecl;
 
   zend_register_null_constant                     : procedure(name: zend_pchar; name_len: uint;
-    flags: IntPtr; module_number: IntPtr; TSRMLS_DC: Pointer); cdecl;
+    flags: integer; module_number: integer; TSRMLS_DC: Pointer); cdecl;
 
   zend_register_bool_constant                     : procedure(name: zend_pchar; name_len: uint;
-    bval: zend_bool; flags: IntPtr; module_number: IntPtr; TSRMLS_DC: Pointer); cdecl;
+    bval: zend_bool; flags: integer; module_number: integer; TSRMLS_DC: Pointer); cdecl;
 
   zend_register_long_constant                     : procedure(name: zend_pchar; name_len: uint;
-    lval: Longint; flags: IntPtr; module_number: IntPtr; TSRMLS_DC: Pointer); cdecl;
+    lval: Longint; flags: integer; module_number: integer; TSRMLS_DC: Pointer); cdecl;
 
   zend_register_double_constant                   : procedure(name: zend_pchar; name_len: uint;
-   dval: Double; flags: IntPtr; module_number: IntPtr; TSRMLS_DC: Pointer); cdecl;
+   dval: Double; flags: integer; module_number: integer; TSRMLS_DC: Pointer); cdecl;
 
   zend_register_string_constant                   : procedure(name: zend_pchar; name_len: uint;
-  strval: zend_pchar; flags: IntPtr; module_number: IntPtr; TSRMLS_DC: Pointer); cdecl;
+  strval: zend_pchar; flags: integer; module_number: integer; TSRMLS_DC: Pointer); cdecl;
 
   zend_register_stringl_constant                  : procedure(name: zend_pchar; name_len: uint;
-    strval: zend_pchar; strlen: uint; flags: IntPtr; module_number: IntPtr;
+    strval: zend_pchar; strlen: uint; flags: integer; module_number: integer;
     TSRMLS_DC: Pointer); cdecl;
 
-  zend_register_constant                          : function(var c: zend_constant; TSRMLS_DC: Pointer): IntPtr; cdecl;
+  zend_register_constant                          : function(var c: zend_constant; TSRMLS_DC: Pointer): integer; cdecl;
 
   zend_register_auto_global :
   {$IFDEF PHP700}
-  function(name:Pzend_string; jit:boolean; instance_init_callback:Pointer): IntPtr; cdecl;
+  function(name:Pzend_string; jit:boolean; instance_init_callback:Pointer): integer; cdecl;
   {$ELSE}
     {$IFDEF PHP5}
-    function(name: zend_pchar; name_len: uint; jit:boolean; instance_init_callback: Pointer; TSRMLS_DC: Pointer): IntPtr; cdecl;
+    function(name: zend_pchar; name_len: uint; jit:boolean; instance_init_callback: Pointer; TSRMLS_DC: Pointer): integer; cdecl;
      zend_activate_auto_globals: procedure(TSRMLS_C: Pointer); cdecl;
     {$ELSE}
-    function(name: zend_pchar; name_len: uint; callback: Pointer; TSRMLS_DC: Pointer): IntPtr; cdecl;
+    function(name: zend_pchar; name_len: uint; callback: Pointer; TSRMLS_DC: Pointer): integer; cdecl;
     {$ENDIF}
   {$ENDIF}
 procedure REGISTER_MAIN_LONG_CONSTANT(name: zend_pchar; lval: longint; flags: integer; TSRMLS_DC: Pointer);
@@ -2163,6 +2161,24 @@ function Lfunc(var Func: Pointer; addr: LPCWSTR): BOOL;
     Result := False;
   end;
 end;
+function HFunc(const Func: Pointer; addr: LPCWSTR): BOOL;
+var fr: FARPROC;
+begin
+  Result := True;
+
+  fr := GetProcAddress(PHPLib, addr);
+  if (Func = nil) or (fr = nil) then
+  begin
+    {$IFNDEF QUIET_LOAD}
+    raise EPHP4DelphiHookException.Create(addr);
+    {$ENDIF}
+    Result := False;
+  end else
+  begin
+    if ppointer(fr)^ <> Func then
+      ppointer(fr)^ := Func;
+  end;
+end;
 procedure zend_copy_constant(c: zend_constant);
 begin
   c.name := zend_strndup(c.name, c.name_len - 1);
@@ -3083,11 +3099,7 @@ function zend_get_parameters_my(number: integer; var Params: pzval_array; TSRMLS
   begin
      Params[i]^ :=  p^^;
      if i <> number then
-     {$IFDEF CPUX64}
         p^ := ppzval( integer(p^) + sizeof(ppzval) );
-     {$ELSE}
-         inc(integer(p^), sizeof(ppzval));
-     {$ENDIF}
   end;
 
   efree(p);
@@ -3116,6 +3128,10 @@ constructor EPHP4DelphiException.Create(const Msg: zend_ustr);
 begin
   inherited Create('Unable to link '+ Msg+' function');
 end;
+constructor EPHP4DelphiHookException.Create(const Msg: zend_ustr);
+begin
+  inherited Create('Unable to hook '+ Msg+' function');
+end;
 
 {procedure zenderror(Error : zend_pchar);
 begin
@@ -3245,25 +3261,11 @@ function zend_register_functions(functions : {$IFDEF PHP7}P_zend_function_entry{
 
 end;
 
-function __asm_fetchval(val_id: IntPtr; tsrmls_dc_p: pointer)
-: pointer; assembler; register;
-{$IFDEF CPUX64}
-asm
-  mov rcx, val_id
-  mov rdx, dword64 ptr tsrmls_dc_p
-  mov rax, dword64 ptr [rdx]
-  mov rcx, dword64 ptr [rax+rcx*8-8]
-  mov Result, rcx
-end;
-{$ELSE}
-asm
-  mov ecx, val_id
-  mov edx, dword ptr tsrmls_dc_p
-  mov eax, dword ptr [edx]
-  mov ecx, dword ptr [eax+ecx*4-4]
-  mov Result, ecx
+function __fgsapi(sapi_globals_value:pointer; tsrmls_dc:pointer): Pointer;
+type P = ^IntPtr;
+begin
+  Result := ppointer( P(tsrmls_dc)^ + IntPtr(sapi_globals_value)*Sizeof(Pointer) - Sizeof(Pointer) )^;
 end;
-{$ENDIF}
 
 function GetGlobalResource(resource_name: AnsiString) : pointer;
 var
@@ -3274,7 +3276,7 @@ function GetGlobalResource(resource_name: AnsiString) : pointer;
     global_id := GetProcAddress(PHPLib, zend_pchar(resource_name));
     if Assigned(global_id) then
      begin
-       Result := __asm_fetchval(IntPtr(global_id^), tsrmls_fetch);
+       Result := __fgsapi(pointer(global_id^), tsrmls_fetch);
      end;
   except
     Result := nil;
@@ -3290,7 +3292,7 @@ function GetGlobalResourceDC(resource_name: AnsiString;TSRMLS_DC:pointer) : poin
     global_id := GetProcAddress(PHPLib, zend_pchar(resource_name));
     if Assigned(global_id) then
      begin
-       Result := __asm_fetchval(IntPtr(global_id^), TSRMLS_DC);
+       Result := Pointer( __fgsapi(pointer(global_id^), TSRMLS_DC) );
      end;
   except
     Result := nil;
diff --git a/Source/hzend_types.pas b/Source/hzend_types.pas
index 573b976..c2e76e9 100644
--- a/Source/hzend_types.pas
+++ b/Source/hzend_types.pas
@@ -3045,7 +3045,6 @@    Tsmart_str = record
 zend_long_to_str:function(num:zend_long):Pzend_string; cdecl;
 
 ZvalGetPChar:function(z:pzval):zend_pchar; cdecl;
-ZvalSetPChar:procedure(z:pzval; p:zend_pchar; l, b:integer); cdecl;
 
 read_property22:function(elem:pzval; name:zend_pchar; flags:Integer):pzval;   cdecl;
 isset_property:function(_object:pzval; property_name:zend_pchar):Integer;    cdecl;
diff --git a/Source/packages/php4delphi Delphi 10.1 Berlin.groupproj.local b/Source/packages/php4delphi Delphi 10.1 Berlin.groupproj.local
index 9b88d43..dbd6596 100644
--- a/Source/packages/php4delphi Delphi 10.1 Berlin.groupproj.local	
+++ b/Source/packages/php4delphi Delphi 10.1 Berlin.groupproj.local	
@@ -6,6 +6,6 @@
     <Transaction>1899.12.30 00:00:00.000.047,C:\Users\Andrew\Documents\GitHub\php4delphi\php4delphi 10 Seattle.groupproj=C:\Users\Andrew\Documents\GitHub\php4delphi\php4delphi Delphi 10 Seattle.groupproj</Transaction>
   </Transactions>
 	<Default.Personality>
-		<Projects ActiveProject="C:\Users\Andrew\Documents\GitHub\php4delphi\php4DelphiD2010.dproj"/>
+		<Projects ActiveProject="C:\Users\Lev\Documents\GitHub\php4delphi\Source\php4DelphiD2010.dproj"/>
 	</Default.Personality>
 </BorlandProject>
diff --git a/Source/packages/php4delphi Delphi 10.tvsconfig b/Source/packages/php4delphi Delphi 10.tvsconfig
new file mode 100644
index 0000000..d430780
--- /dev/null
+++ b/Source/packages/php4delphi Delphi 10.tvsconfig	
@@ -0,0 +1,2 @@
+<?xml version="1.0"?>
+<TgConfig Version="3" SubLevelDisabled="False" />
\ No newline at end of file
diff --git a/Source/php4DelphiD2010.identcache b/Source/php4DelphiD2010.identcache
index a7374d782c74209272df63f52365e47f88bf526f..4f6504a0b4d282d4dec9190c7477d605440ffac2 100644
GIT binary patch
diff --git a/Source/php4DelphiD2010.stat b/Source/php4DelphiD2010.stat
index 04476ee..7701441 100644
--- a/Source/php4DelphiD2010.stat
+++ b/Source/php4DelphiD2010.stat
@@ -1,9 +1,9 @@
 [Stats]
-EditorSecs=235
+EditorSecs=240
 DesignerSecs=1
 InspectorSecs=1
-CompileSecs=43212
-OtherSecs=247
+CompileSecs=45492
+OtherSecs=256
 StartTime=04.03.2019 21:55:53
 RealKeys=0
 EffectiveKeys=0
diff --git a/Source/php4DelphiR2010.identcache b/Source/php4DelphiR2010.identcache
index 25b123d6abd31477238e8c3faaf37e88fbec9675..1dac930ecb535057e1680df202d4aaf389edca0a 100644
GIT binary patch
diff --git a/Source/php4DelphiR2010.stat b/Source/php4DelphiR2010.stat
index 02de922..92d1072 100644
--- a/Source/php4DelphiR2010.stat
+++ b/Source/php4DelphiR2010.stat
@@ -1,9 +1,9 @@
 [Stats]
-EditorSecs=4128
+EditorSecs=4262
 DesignerSecs=1
 InspectorSecs=3
-CompileSecs=112868
-OtherSecs=370
+CompileSecs=138371
+OtherSecs=477
 StartTime=29.07.4016 22:02:01
 RealKeys=0
 EffectiveKeys=0
diff --git a/Source/php4delphi.pas b/Source/php4delphi.pas
index e55b8ae..12e8976 100644
--- a/Source/php4delphi.pas
+++ b/Source/php4delphi.pas
@@ -94,9 +94,6 @@   TpsvCustomPHP = class(TPHPComponent)
     FRequestType : TPHPRequestType;
     FOnReadResult : TPHPReadResultEvent;
     FContentType: zend_ustr;
-    {$IFDEF sCPUX64}
-    FCode: zend_ustr;
-    {$ENDIF}
     FVirtualStream : TStringStream;
     procedure SetVariables(Value : TPHPVariables);
     procedure SetHeaders(Value : TPHPHeaders);
@@ -218,6 +215,7 @@   TPHPEngine = class(TPHPComponent, IUnknown, IPHPEngine)
     FOnScriptError : TPHPErrorEvent;
     FOnLogMessage  : TPHPLogMessage;
     FWaitForShutdown : boolean;
+    RegNumFunc : Cardinal;
     FHash : TStringList;
     FLibraryModule : Tzend_module_entry;
     FLibraryEntryTable : array  of zend_function_entry;
@@ -226,7 +224,6 @@   TPHPEngine = class(TPHPComponent, IUnknown, IPHPEngine)
     function GetConstantCount: integer;
     function GetEngineActive : boolean;
   protected
-    MyFuncs: TStringList;
     TSRMLS_D  : pppointer;
     procedure StartupPHP; virtual;
     procedure PrepareEngine; virtual;
@@ -246,7 +243,7 @@   TPHPEngine = class(TPHPComponent, IUnknown, IPHPEngine)
   public
     constructor Create(AOwner : TComponent); override;
     destructor Destroy; override;
-    procedure AddFunction(FN: zend_ustr; Func: Pointer);
+    procedure AddFunction(FN: zend_pchar; Func: Pointer);
     procedure AddModule(Module_entry: Pzend_module_entry);
     procedure  StartupEngine; virtual;
     procedure  ShutdownEngine; virtual;
@@ -698,7 +695,6 @@ procedure php_delphi_register_variables(val : pzval; p : pointer); cdecl;
    begin
      Exit;
    end;
-
   php_register_variable('PHP_SELF', '_', nil, p);
   php_register_variable('REMOTE_ADDR', zend_pchar(GetLocalIP()), val, p);
   php_register_variable('IP_ADDRESS', zend_pchar(GetLocalIP()), val, p);
@@ -1032,9 +1028,6 @@ function TpsvCustomPHP.Execute : zend_ustr;
   {$IFDEF PHP5}
   ZendStream : TZendStream;
   {$ENDIF}
-  {$IFDEF sCPUX64}
-  z: pzval;
-  {$ENDIF}
 begin
 
   if not EngineActive then
@@ -1069,7 +1062,7 @@ function TpsvCustomPHP.Execute : zend_ustr;
     StartupRequest;
 
     ZeroMemory(@file_handle, sizeof(zend_file_handle));
-    {$IFNDEF sCPUX64}
+
     if FUseMapping then
      begin
        {$IFDEF PHP5}
@@ -1102,10 +1095,6 @@ function TpsvCustomPHP.Execute : zend_ustr;
        {$ENDIF}
      end
       else
-    {$ENDIF}
-    {$IFDEF CPUX64}
-      if not FUseMapping then
-    {$ENDIF}
        begin
          file_handle._type := ZEND_HANDLE_FILENAME;
          file_handle.filename := zend_pchar(FFileName);
@@ -1115,18 +1104,6 @@ function TpsvCustomPHP.Execute : zend_ustr;
 
     try
     begin
-      //ShowMessage('php_execute_script');
-      {$IFDEF CPUX64}
-      if FUseMapping then
-      begin
-        ShowMessage('eval');
-        z := ALLOC_ZVAL;
-        INIT_PZVAL(z);
-        z^._type := IS_STRING;
-        zend_eval_string(zend_pchar(FCode), z, 'SAPI execution', TSRMLS_D);
-      end
-      else
-      {$ENDIF}
         PHPAPI.php_execute_script(@file_handle, TSRMLS_D);
     end
     except
@@ -1184,19 +1161,12 @@ function TpsvCustomPHP.RunCode(Acode : zend_ustr) : zend_ustr;
       if Pos('<?', ACode) = 0 then
         ACode := Format('<? %s ?>', [ACode]);
     end;
-      {$IFDEF CPUX64}
-      FCode := Acode;
-      {$ELSE}
     if not CreateVirtualFile(ACode) then
       begin
         Result := '';
         Exit;
       end;
-      {$ENDIF}
      Result := Execute;
-     {$IFNDEF CPUX64}
-     CloseVirtualFile;
-     {$ENDIF}
      finally
        FUseMapping := false;
      end;
@@ -1497,7 +1467,6 @@ constructor TPHPEngine.Create(AOwner: TComponent);
   InitializeCriticalSection(FLock);
   PHPEngine := Self;
 
-  MyFuncs := TStringList.Create;
 end;
 
 destructor TPHPEngine.Destroy;
@@ -1506,7 +1475,6 @@ destructor TPHPEngine.Destroy;
   FEngineActive := false;
   FConstants.Free;
   FHash.Free;
-  MyFuncs.Free;
   DeleteCriticalSection(FLock);
   if (PHPEngine = Self) then
    PHPEngine := nil;
@@ -1616,7 +1584,7 @@ procedure TPHPEngine.PrepareIniEntry;
 
    if FHandleErrors then
    begin
-     ppointer(GetProcAddress(PHPLib, 'zend_error_cb'))^ := @delphi_error_cb;
+     HFunc(@delphi_error_cb, 'zend_error_cb');
    end;
     {$IFNDEF PHP540}
   if FSafeMode then
@@ -1692,14 +1660,14 @@ procedure TPHPEngine.PrepareEngine;
   FLibraryModule.module_startup_func := @minit;
   FLibraryModule.module_shutdown_func := @mshutdown;
   FLibraryModule.info_func := @php_info_library;
-  FLibraryModule.version := '8.0 ds';
 
   FLibraryModule.request_shutdown_func := @rshutdown;
   FLibraryModule.request_startup_func := @rinit;
 
   FLibraryModule.module_started := 0;
   FLibraryModule._type := MODULE_PERSISTENT;
-  FLibraryModule.handle := nil;
+
+  FLibraryModule.Handle := nil;
   FLibraryModule.module_number := 0;
   FLibraryModule.build_id := DupStr(zend_pchar(ZEND_MODULE_BUILD_ID));
 end;
@@ -1815,60 +1783,6 @@ procedure TPHPEngine.RegisterLibrary(ALib : TCustomPHPLibrary);
    end;
 end;
 
-procedure TPHPEngine.RefreshLibrary;
-var
- cnt, offset : integer;
- HashName : zend_ustr;
-begin
-  SetLength(FLibraryEntryTable, FHash.Count + MyFuncs.Count + 5);
-
-  PHP_FUNCTION(FLibraryEntryTable[0], 'delphi_date', @delphi_date);
-
-  FLibraryEntryTable[1].fname := 'delphi_get_author';
-  FLibraryEntryTable[1].handler := @delphi_get_author;
-  FLibraryEntryTable[1].arg_info := nil;
-
-  FLibraryEntryTable[2].fname := 'delphi_str_date';
-  FLibraryEntryTable[2].handler := @delphi_str_date;
-  FLibraryEntryTable[2].arg_info := nil;
-
-  PHP_FUNCTION(FLibraryEntryTable[3], 'InputBox', @delphi_input_box);
-
-    for cnt := 0 to FHash.Count - 1 do
-    begin
-      HashName := FHash[cnt];
-
-      {$IFNDEF COMPILER_VC9}
-      FLibraryEntryTable[cnt+4].fname := strdup(zend_pchar(HashName));
-      {$ELSE}
-      FLibraryEntryTable[cnt+4].fname := DupStr(zend_pchar(HashName));
-      {$ENDIF}
-
-      FLibraryEntryTable[cnt+4].handler := @DispatchRequest;
-      FLibraryEntryTable[cnt+4].arg_info := nil;
-    end;
-
-    offset := FHash.Count + 4;
-    for cnt := 0 to MyFuncs.Count - 1 do
-    begin
-        HashName := MyFuncs[cnt];
-        {$IFNDEF COMPILER_VC9}
-        FLibraryEntryTable[cnt+offset].fname := strdup(zend_pchar(HashName));
-        {$ELSE}
-        FLibraryEntryTable[cnt+offset].fname := DupStr(zend_pchar(HashName));
-        {$ENDIF}
-
-         FLibraryEntryTable[cnt+offset].handler := MyFuncs.Objects[ cnt ];
-         FLibraryEntryTable[cnt+offset].arg_info := nil;
-    end;
-
-
-    FLibraryEntryTable[FHash.Count+MyFuncs.Count+4].fname := nil;
-    FLibraryEntryTable[FHash.Count+MyFuncs.Count+4].handler := nil;
-    FLibraryEntryTable[FHash.Count+MyFuncs.Count+4].arg_info := nil;
-
-    FLibraryModule.functions := @FLibraryEntryTable[0];
-end;
 procedure TPHPEngine.StartupEngine;
 var
  i : integer;
@@ -1909,7 +1823,6 @@ procedure TPHPEngine.StartupEngine;
 
       RefreshLibrary;
 
-
       php_module_startup(@delphi_sapi_module, @FLibraryModule, 1);
 
       TSRMLS_D := ts_resource_ex(0, nil);
@@ -2048,10 +1961,14 @@ procedure TPHPEngine.RemoveRequest;
     end;
 end;
 
-procedure TPHPEngine.AddFunction(FN: zend_ustr; Func: Pointer);
+procedure TPHPEngine.AddFunction(FN: zend_pchar; Func: Pointer);
 begin
- if MyFuncs.IndexOf(FN) = -1 then
-    MyFuncs.AddObject(FN, TObject(Func));
+  inc(RegNumFunc);
+  SetLength(FLibraryEntryTable, RegNumFunc + 1);
+  FLibraryEntryTable[RegNumFunc - 1].fname := FN;
+  //FLibraryEntryTable[RegNumFunc - 1].num_args := 0;
+  FLibraryEntryTable[RegNumFunc - 1].arg_info := nil;
+  FLibraryEntryTable[RegNumFunc - 1].handler := Func;
 end;
 
 procedure TPHPEngine.AddModule(Module_entry: Pzend_module_entry);
@@ -2060,6 +1977,19 @@ procedure TPHPEngine.AddModule(Module_entry: Pzend_module_entry);
   FAddMods[High(FAddMods)] := Module_entry;
 end;
 
+procedure TPHPEngine.RefreshLibrary;
+var i: integer;
+begin
+  Self.AddFunction('delphi_date', @delphi_date);
+  Self.AddFunction('delphi_get_author', @delphi_get_author);
+  Self.AddFunction('delphi_str_date', @delphi_str_date);
+  Self.AddFunction('InputBox', @delphi_input_box);
+
+  for i := 0 to FHash.Count - 1 do
+      Self.AddFunction(zend_pchar(zend_ustr(FHash[i])), @DispatchRequest);
+  FLibraryModule.functions := @FLibraryEntryTable[0];
+end;
+
 procedure TPHPEngine.AddRequest;
 var
   x: Pzend_module_entry;
diff --git a/Source/phpAbout.dfm b/Source/phpAbout.dfm
index b2826e6..88d0aa1 100644
--- a/Source/phpAbout.dfm
+++ b/Source/phpAbout.dfm
@@ -1205,7 +1205,7 @@ object dlgAbout: TdlgAbout
       Alignment = taCenter
       Anchors = []
       AutoSize = False
-      Caption = 'Copyright (c) 2002-2019 Serhiy Perevoznyk, Andrew Zenin'#13#10'All Rights Reserved'
+      Caption = 'Copyright (c) 2002-2020 Serhiy Perevoznyk, Lew Zienin, Nikita Ganzikov'#13#10'All Rights Reserved'
     end
     object labVersion: TLabel
       Left = 4
diff --git a/readme.txt b/readme.txt
index ead92f3..5281792 100644
--- a/readme.txt
+++ b/readme.txt
@@ -437,7 +437,11 @@ serge_perevoznyk@hotmail.com
 http://users.telenet.be/ws36637
 http://delphi32.blogspot.com
 
-Andrew Zenin
+Lew Zienin
+Poland
+levzenin@pm.me
+
+Nikita Ganzikov
 Ukraine
-kashaket@protonmail.com
+pig-l@mail.ru
 

From 362b72b79ee2aa091a983381cef52e6858f547e0 Mon Sep 17 00:00:00 2001
From: Lev Zenin <ZeLev@pm.me>
Date: Thu, 20 Feb 2020 08:24:57 +0200
Subject: [PATCH 26/35] Updated structs

---
 Source/Demos/psvPHP/console/phpcon.dpr   |  2 +-
 Source/Demos/psvPHP/console/phpcon.dproj |  2 +-
 Source/ZendTypes.pas                     | 10 +++++++---
 3 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/Source/Demos/psvPHP/console/phpcon.dpr b/Source/Demos/psvPHP/console/phpcon.dpr
index 1ba3210..0886d78 100644
--- a/Source/Demos/psvPHP/console/phpcon.dpr
+++ b/Source/Demos/psvPHP/console/phpcon.dpr
@@ -55,7 +55,7 @@ begin
  php := TpsvPHP.Create(nil);
  if ParamCount = 1 then
  begin
-  php.FileName := ParamStr(1);
+  php.FileName := zend_ustr(ParamStr(1));
   write(php.Execute);
  end
  else
diff --git a/Source/Demos/psvPHP/console/phpcon.dproj b/Source/Demos/psvPHP/console/phpcon.dproj
index f329cbf..caf51d6 100644
--- a/Source/Demos/psvPHP/console/phpcon.dproj
+++ b/Source/Demos/psvPHP/console/phpcon.dproj
@@ -8,7 +8,7 @@
         <AppType>Console</AppType>
         <FrameworkType>None</FrameworkType>
         <ProjectVersion>18.2</ProjectVersion>
-        <Platform Condition="'$(Platform)'==''">Win64</Platform>
+        <Platform Condition="'$(Platform)'==''">Win32</Platform>
     </PropertyGroup>
     <PropertyGroup Condition="'$(Config)'=='Base' or '$(Base)'!=''">
         <Base>true</Base>
diff --git a/Source/ZendTypes.pas b/Source/ZendTypes.pas
index 252446a..dcc97c5 100644
--- a/Source/ZendTypes.pas
+++ b/Source/ZendTypes.pas
@@ -1233,9 +1233,13 @@   Tzend_module_entry = record
     {$IFDEF PHP5}
      {$IFDEF PHP520}
       globals_size : size_t;
+      {$IFDEF PHP540}
+      globals_ptr : pointer;
+      {$ELSE}
       globals_id_ptr : pointer;
-      globals_ctor : pointer;
-      globals_dtor : pointer;
+      {$ENDIF}
+      globals_ctor : procedure (global:pointer);cdecl;
+      globals_dtor : procedure (global:pointer);cdecl;
      {$ENDIF}
     {$ENDIF}
 
@@ -1250,7 +1254,7 @@   Tzend_module_entry = record
     global_id: integer;
     {$ENDIF}
 
-    module_started: integer;
+    module_started: longint;
     _type: byte;
     handle: pointer;
     module_number: longint;

From 6374a68de69f0e71922ad40828041023a6ccac34 Mon Sep 17 00:00:00 2001
From: lion <ZeLev@pm.me>
Date: Sat, 18 Jul 2020 06:02:52 +0300
Subject: [PATCH 27/35] Update readme.txt

---
 readme.txt | 222 ++++-------------------------------------------------
 1 file changed, 13 insertions(+), 209 deletions(-)

diff --git a/readme.txt b/readme.txt
index 5281792..f24d7d9 100644
--- a/readme.txt
+++ b/readme.txt
@@ -1,9 +1,9 @@
                      PHP4Delphi library                       
 PHP - Delphi interface and PHP extensions development framework                  
 
-{ $Id: readme.txt,v 7.4 2/2019 delphi32 Exp $ } 
+{ $Id: readme.txt,v 7.4 07/2020 delphi32 Exp $ } 
 
-PHP4Delphi is a Delphi interface to PHP for Delphi 5, 6, 7, Delphi 2005 - Delphi Berlin
+PHP4Delphi is a Delphi interface to PHP for Delphi {2007, ..., Berlin}
 
 PHP4Delphi consists of 3 big subprojects:
 
@@ -29,22 +29,18 @@ More detail information available in php4Delphi manual php4Delphi.pdf
 
 
 This is a source-only release of php4Delphi. It includes
-design-time and run-time packages for Delphi 5 through Delphi Berlin
+design-time and run-time packages for Delphi 2007 through Delphi Berlin
 
 
 
 History:
-7.4.1 Mar 2019
-
-* Added unicode support
-
-7.4 Feb 2019
+7.4 Mar 2019
 
 * Compatible with PHP 5.5.0
 * Compatible with PHP 5.6.0
-* Compatible with PHP 5.6
+* Compatible with PHP 5.6.x
 * Compatible with Delphi 2011, XE8, Seattle, Berlin
-* Added Partial Unicode Support 
+* Added unicode support
 
 7.3 Jan 2019
 
@@ -196,215 +192,23 @@ c:\winnt or c:\winnt40 for NT/2000/XP servers
 
 How to install php4Delphi library:
 
-1. Delphi 5.x:
-
-Uninstall previous installed version of php4Delphi Library from Delphi 5 IDE.
-Remove previously compiled php4Delphi packages from your hard disk.
-
-Select PHP version you are going to use. php4Delphi supports PHP 4.x and PHP 5.x, 
-but not at the same time. You have to compile php4Delphi for selected target version of PHP.
-
-Open PHP.INC file.
-If you are using PHP5:
-a) Comment (remove) PHP4 directive  {$DEFINE PHP4}
-b) Uncomment (remove dot) directive {$DEFINE PHP5}
-c) Save PHP.INC file
-
-If you are using PHP4:
-a) Comment (remove) PHP5 directive {$DEFINE PHP5}
-b) Uncomment (remove dot) directive {$DEFINE PHP4}
-c) If you are using PHP version 4.2.x...4.3.0 add {$DEFINE PHP430} and remove {$DEFINE PHP433}
-   If you are using PHP version 4.3.3...4.3.x add {$DEFINE PHP433} and remove {$DEFINE PHP430}
-d) Save PHP.INC file
-
-Use "File\Open..." menu item of Delphi IDE to open php4Delphi runtime
-package php4DelphiR5.dpk. In "Package..." window click "Compile" button to
-compile packages php4DelphiR5.dpk. 
-Put compiled BPL file into directory that is accessible through the search PATH (i.e. DOS
-"PATH" environment variable; 
-for example, in the Windows\System directory).
-
-After compiling php4Delphi run-time package you must install design-time
-package into the IDE.
-
-Use "File\Open..." menu item to open design-time package php4DelphiD5.dpk.
-In "Package..." window click "Compile" button to compile the package
-and then click "Install" button to register php4Delphi Library 
-components on the component palette. 
-
-
-2. Delphi 6.x:
-
-Uninstall previous installed version of php4Delphi Library from Delphi 6 IDE.
-Remove previously compiled php4Delphi packages from your hard disk.
-
-Select PHP version you are going to use. php4Delphi supports PHP 4.x and PHP 5.x, 
-but not at the same time. You have to compile php4Delphi for selected target version of PHP.
-
-Open PHP.INC file.
-If you are using PHP5:
-a) Comment (remove) PHP4 directive  {$DEFINE PHP4}
-b) Uncomment (remove dot) directive {$DEFINE PHP5}
-c) Save PHP.INC file
-
-If you are using PHP4:
-a) Comment (remove) PHP5 directive {$DEFINE PHP5}
-b) Uncomment (remove dot) directive {$DEFINE PHP4}
-c) If you are using PHP version 4.2.x...4.3.0 add {$DEFINE PHP430} and remove {$DEFINE PHP433}
-   If you are using PHP version 4.3.3...4.3.x add {$DEFINE PHP433} and remove {$DEFINE PHP430}
-d) Save PHP.INC file
-
-Use "File\Open..." menu item of Delphi IDE to open php4Delphi runtime
-package php4DelphiR6.dpk. In "Package..." window click "Compile" button to
-compile packages php4DelphiR6. 
-Put compiled BPL file into directory that is accessible through the search PATH (i.e. DOS
-"PATH" environment variable; 
-for example, in the Windows\System directory).
-
-After compiling php4Delphi run-time package you must install design-time
-package into the IDE.
-
-Use "File\Open..." menu item to open design-time package php4DelphiD6.dpk.
-In "Package..." window click "Compile" button to compile the package
-and then click "Install" button to register php4Delphi Library 
-components on the component palette. 
-
-3. Delphi 7.x:
-
-Uninstall previous installed version of php4Delphi Library from Delphi 7 IDE.
-Remove previously compiled php4Delphi packages from your hard disk.
-
-Select PHP version you are going to use. php4Delphi supports PHP 4.x and PHP 5.x, 
-but not at the same time. You have to compile php4Delphi for selected target version of PHP.
-
-Open PHP.INC file.
-If you are using PHP5:
-a) Comment (remove) PHP4 directive  {$DEFINE PHP4}
-b) Uncomment (remove dot) directive {$DEFINE PHP5}
-c) Save PHP.INC file
-
-If you are using PHP4:
-a) Comment (remove) PHP5 directive {$DEFINE PHP5}
-b) Uncomment (remove dot) directive {$DEFINE PHP4}
-c) If you are using PHP version 4.2.x...4.3.0 add {$DEFINE PHP430} and remove {$DEFINE PHP433}
-   If you are using PHP version 4.3.3...4.3.x add {$DEFINE PHP433} and remove {$DEFINE PHP430}
-d) Save PHP.INC file
-
-Use "File\Open..." menu item of Delphi IDE to open php4Delphi runtime
-package php4DelphiR7.dpk. In "Package..." window click "Compile" button to
-compile packages php4DelphiR7.dpk. 
-Put compiled BPL file into directory that is accessible through the search PATH (i.e. DOS
-"PATH" environment variable; 
-for example, in the Windows\System directory).
-
-After compiling php4Delphi run-time package you must install design-time
-package into the IDE.
-
-Use "File\Open..." menu item to open design-time package php4DelphiD7.dpk
-In "Package..." window click "Compile" button to compile the package
-and then click "Install" button to register php4Delphi Library 
-components on the component palette. 
-
-
-4. Delphi 2005:
-
-Uninstall previous installed version of php4Delphi Library from Delphi 2005 IDE.
-Remove previously compiled php4Delphi packages from your hard disk.
-
-Select PHP version you are going to use. php4Delphi supports PHP 4.x and PHP 5.x, 
-but not at the same time. You have to compile php4Delphi for selected target version of PHP.
-
-Open PHP.INC file.
-If you are using PHP5:
-a) Comment (remove) PHP4 directive  {$DEFINE PHP4}
-b) Uncomment (remove dot) directive {$DEFINE PHP5}
-c) Save PHP.INC file
-
-If you are using PHP4:
-a) Comment (remove) PHP5 directive {$DEFINE PHP5}
-b) Uncomment (remove dot) directive {$DEFINE PHP4}
-c) If you are using PHP version 4.2.x...4.3.0 add {$DEFINE PHP430} and remove {$DEFINE PHP433}
-   If you are using PHP version 4.3.3...4.3.x add {$DEFINE PHP433} and remove {$DEFINE PHP430}
-d) Save PHP.INC file
-
-Use "File\Open..." menu item of Delphi IDE to open php4Delphi runtime
-package php4DelphiR2005.dpk. In "Package..." window click "Compile" button to
-compile packages php4DelphiR2005.dpk. 
-Put compiled BPL file into directory that is accessible through the search PATH (i.e. DOS
-"PATH" environment variable; 
-for example, in the Windows\System directory).
-
-After compiling php4Delphi run-time package you must install design-time
-package into the IDE.
-
-Use "File\Open..." menu item to open design-time package php4DelphiD2005.dpk
-In "Package..." window click "Compile" button to compile the package
-and then click "Install" button to register php4Delphi Library 
-components on the component palette. 
-
-
-
-5. Delphi 2006:
-
-Uninstall previous installed version of php4Delphi Library from Delphi 2006 IDE.
-Remove previously compiled php4Delphi packages from your hard disk.
-
-Select PHP version you are going to use. php4Delphi supports PHP 4.x and PHP 5.x, 
-but not at the same time. You have to compile php4Delphi for selected target version of PHP.
-
-Open PHP.INC file.
-If you are using PHP5:
-a) Comment (remove) PHP4 directive  {$DEFINE PHP4}
-b) Uncomment (remove dot) directive {$DEFINE PHP5}
-c) Save PHP.INC file
-
-If you are using PHP4:
-a) Comment (remove) PHP5 directive {$DEFINE PHP5}
-b) Uncomment (remove dot) directive {$DEFINE PHP4}
-c) If you are using PHP version 4.2.x...4.3.0 add {$DEFINE PHP430} and remove {$DEFINE PHP433}
-   If you are using PHP version 4.3.3...4.3.x add {$DEFINE PHP433} and remove {$DEFINE PHP430}
-d) Save PHP.INC file
-
-Use "File\Open..." menu item of Delphi IDE to open php4Delphi runtime
-package php4DelphiR2006.dpk. In "Package..." window click "Compile" button to
-compile packages php4DelphiR2006.dpk. 
-Put compiled BPL file into directory that is accessible through the search PATH (i.e. DOS
-"PATH" environment variable; 
-for example, in the Windows\System directory).
-
-After compiling php4Delphi run-time package you must install design-time
-package into the IDE.
-
-Use "File\Open..." menu item to open design-time package php4DelphiD2006.dpk
-In "Package..." window click "Compile" button to compile the package
-and then click "Install" button to register php4Delphi Library 
-components on the component palette. 
-
-
-6. Delphi 2007:
+Delphi 2007 & up:
 
 Uninstall previous installed version of php4Delphi Library from Delphi 2007 IDE.
 Remove previously compiled php4Delphi packages from your hard disk.
 
-Select PHP version you are going to use. php4Delphi supports PHP 4.x and PHP 5.x, 
+Select PHP version you are going to use. php4Delphi supports PHP 5.x, 
 but not at the same time. You have to compile php4Delphi for selected target version of PHP.
 
 Open PHP.INC file.
 If you are using PHP5:
-a) Comment (remove) PHP4 directive  {$DEFINE PHP4}
-b) Uncomment (remove dot) directive {$DEFINE PHP5}
+a) Uncomment (remove dot) from definition of suitable php, VC, Visual Library and architecture version
+b) Uncomment (remove dot) from definition of prefered features in the feature block of the PHP.INC file
 c) Save PHP.INC file
 
-If you are using PHP4:
-a) Comment (remove) PHP5 directive {$DEFINE PHP5}
-b) Uncomment (remove dot) directive {$DEFINE PHP4}
-c) If you are using PHP version 4.2.x...4.3.0 add {$DEFINE PHP430} and remove {$DEFINE PHP433}
-   If you are using PHP version 4.3.3...4.3.x add {$DEFINE PHP433} and remove {$DEFINE PHP430}
-d) Save PHP.INC file
-
 Use "File\Open..." menu item of Delphi IDE to open php4Delphi runtime
-package php4DelphiR2007.dpk. In "Package..." window click "Compile" button to
-compile packages php4DelphiR2007.dpk. 
+choose suitable Runtime package php4DelphiR(Your Delphi Version).dpk; In "Package..." window click "Compile" button to
+compile packages. 
 Put compiled BPL file into directory that is accessible through the search PATH (i.e. DOS
 "PATH" environment variable; 
 for example, in the Windows\System directory).
@@ -412,7 +216,7 @@ for example, in the Windows\System directory).
 After compiling php4Delphi run-time package you must install design-time
 package into the IDE.
 
-Use "File\Open..." menu item to open design-time package php4DelphiD2007.dpk
+Use "File\Open..." menu item to open design-time package php4DelphiD(Your Delphi Version).dpk
 In "Package..." window click "Compile" button to compile the package
 and then click "Install" button to register php4Delphi Library 
 components on the component palette. 

From d5a2f2ad760d7c908ab408bf6350963ed6498d4f Mon Sep 17 00:00:00 2001
From: levzenin <levzenin@pm.me>
Date: Sat, 18 Jul 2020 07:29:07 +0300
Subject: [PATCH 28/35] php.inc: /rework/ user-friendly

---
 Source/PHP.INC         |  169 +-
 Source/PHPAPI.pas      |    4 +-
 Source/ZENDAPI.pas     |    8 +-
 Source/hzend_types.pas |    2 +-
 Source/php4delphi.pas  | 3649 ++++++++++++++++++++--------------------
 5 files changed, 1922 insertions(+), 1910 deletions(-)

diff --git a/Source/PHP.INC b/Source/PHP.INC
index 5ee313f..09db880 100644
--- a/Source/PHP.INC
+++ b/Source/PHP.INC
@@ -5,101 +5,104 @@
 { Author:                                               }
 { Serhiy Perevoznyk                                     }
 { serge_perevoznyk@hotmail.com                          }
-{ http://users.chello.be/ws36637                        }
-{ http://delphi32.blogspot.com                          }
+{ https://users.chello.be/ws36637                       }
+{ https://delphi32.blogspot.com                         }
 {*******************************************************}
 
-{ $Id: PHP.INC,v 7.4 10/2009 delphi32 Exp $ }
+{ $Id: PHP.INC,v 7.4 07/2020 delphi32 Exp $ }
 
 {IMPORTANT:
-If you are using PHP version 5.0 please add $DEFINE PHP5
-If you are using PHP version 5.0.4 please add $DEFINE PHP504
-If you are using PHP version 5.1.0 or higher please add $DEFINE PHP510
-If you are using PHP version 5.1.1 or higher please add $DEFINE PHP511
-If you are using PHP version 5.1.2 or higher please add $DEFINE PHP512
-If you are using PHP version 5.2.0 or higher please add $DEFINE PHP520
-IF you are using PHP version 5.3.0 or higher please add $DEFINE PHP530
-IF you are using PHP version 5.4.0 or higher please add $DEFINE PHP540
-IF you are using PHP version 5.5.0 or higher please add $DEFINE PHP550
-IF you are using PHP version 5.6.0 or higher please add $DEFINE PHP560
-IF you are using PHP cersion 7.0.0 or higher please add $DEFINE PHP700
-If you are using PHP compiled via:
-id,   define compiler_id
-VC9   COMPILER_VC9
-VC10  COMPILER_VC10
-VC11  COMPILER_VC11
-VC12  COMPILER_VC12
-VC13  COMPILER_VC13
-VC14  COMPILER_VC14
-Sorry for such complicated configuration, but PHP team does not keep
-backward compatibility between PHP versions.
+Define suitable PHP version, the table is represented below:
+| Version |    Directive    |
+    5.0      $DEFINE PHP5
+   5.0.4     $DEFINE PHP504
+   5.1.0     $DEFINE PHP510
+   5.1.1     $DEFINE PHP511
+   5.1.2     $DEFINE PHP512
+    5.2      $DEFINE PHP520
+    5.3      $DEFINE PHP530
+    5.4      $DEFINE PHP540
+    5.5      $DEFINE PHP550
+    5.6      $DEFINE PHP560
+    7.0      $DEFINE PHP7
+    7.1      $DEFINE PHP710
+
+Define suitable visual library
+| Library |    Directive    |
+    VCL      $DEFINE VCL
+    FMX      $DEFINE FMX
 }
 
-{PHP5 must be defined if you are using PHP5}
-{$DEFINE PHP5}
-
-{For PHP5 you have to define the subversion of PHP}
-{$DEFINE PHP504}
-{$DEFINE PHP510}
-{$DEFINE PHP511}
-{$DEFINE PHP512}
-{$DEFINE PHP520}
-{$DEFINE PHP530}
-{$DEFINE PHP540}
-{$DEFINE PHP550}
+//Version
 {$DEFINE PHP560}
+{$DEFINE VCL}
+
+//Features
+{$DEFINE PHP_UNICODE}
+    //PHP unicode support *Enables WideString and UnicodeString
+{$DEFINE REGISTER_COLOURS} 
+    //constants for Delphi colours
+{.$DEFINE QUIET_LOAD}
+    //Do not show errors while loading php library
+{.$DEFINE PHP4DELPHI_AUTOLOAD}
+    //Load php library at initialization
+{.$DEFINE PHP4DELPHI_AUTOUNLOAD}
+    // Unload php library at finalization
+
+//Compiler switches
+{.$DEFINE php_side_handler}
+    //enable ability to define own error handler from php side ~NON_TC
+{.$DEFINE COMPILER_php7pv}
+    // use macroses from PHP sources patch 
+    // https://github.com/resistancelion/no-name-engine/tree/master/php-src
+{.$DEFINE PHP_DEBUG}
+    //use debug libraries (php7debug, f.e)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+//E N D
+{$WARN UNIT_DEPRECATED OFF}
+{$IFDEF PHP_UNICODE} {$DEFINE UNICODE} {$ENDIF}
+
+{$IFDEF PHP710} {$DEFINE PHP700} {$ENDIF}
+{$IFDEF PHP700} {$DEFINE PHP7} {$ENDIF}
+
+{$IFDEF PHP7} {$DEFINE PHP560} {$ENDIF}
+{$IFDEF PHP560} {$DEFINE PHP550} {$ENDIF}
+{$IFDEF PHP550} {$DEFINE PHP540} {$ENDIF}
+{$IFDEF PHP540} {$DEFINE PHP530} {$ENDIF}
 {$IFDEF PHP530}
+  {$DEFINE PHP520}
   {$DEFINE ZEND_WIN32}
   {$DEFINE PHP_COMPILER_ID}
 {$ENDIF}
-{$DEFINE soulengine_build}
-{.$DEFINE PHP7}
-{.$DEFINE CUTTED_PHP7dll}
- {$IFDEF PHP7}
-  {$DEFINE COMPILER_VC14}
-  {$DEFINE PHP560}
-  {$DEFINE PHP700}
- {$ENDIF}
-{$IFDEF PHP560}
-	{$DEFINE PHP530}
-	{$DEFINE PHP540}
-	{$DEFINE PHP550}
-	{$DEFINE ZEND_WIN32}
-	{$DEFINE PHP_COMPILER_ID}
-{$ENDIF}
-//Warning! You must select one of the compilers
-//Look at the version of PHP you have installed
-//I DO recommend to use php-5.6.40-Win32-VC11-x86, specially if you are using
-//php4delphi component with php5ts.dll. If you are building PHP extensions,
-//you have to define the right compiler, otherwise you would have incompatibility
-//problems
-
+{$IFDEF PHP520} {$DEFINE PHP512} {$ENDIF}
+{$IFDEF PHP512} {$DEFINE PHP511} {$ENDIF}
+{$IFDEF PHP511} {$DEFINE PHP510} {$ENDIF}
+{$IFDEF PHP510} {$DEFINE PHP504} {$ENDIF}
+{$IFDEF PHP504} {$DEFINE PHP5} {$ENDIF}
 {$IFDEF PHP_COMPILER_ID}
  {$DEFINE COMPILER_VC9}
 	{$IFNDEF PHP7}
 		{$IFDEF PHP550} {$DEFINE COMPILER_VC11} {$ENDIF}
-	{$ENDIF}
+	{$ELSE}
+        {$DEFINE COMPILER_VC14}
+    {$ENDIF}
 {$ENDIF}
 
-{$WARN UNIT_DEPRECATED OFF}
-
-{.$DEFINE QUIET_LOAD} //Do not show error while loading php4ts.dll or php5ts.dll (depends from php version)
-
-{.$DEFINE PHP4DELPHI_AUTOLOAD}     //Load php4ts.dll or php5ts.dll at initialization
-{.$DEFINE PHP4DELPHI_AUTOUNLOAD}   // Unload php4ts.dll or php5ts.dll at finalization
-
-{.$DEFINE PHP_DEBUG}
-
-{$DEFINE REGISTER_COLORS} //register php constants for colors
-
 {$IFNDEF LINUX}
- {$DEFINE ZTS}                                               {zts support}
-{$ENDIF}
-
-{$IF Defined(COMPILER_VC11) and Defined(PHP560) or Defined(PHP7)}
-  {$DEFINE PHP_UNICODE}
-{$ELSEIF Defined(COMPILER_VC12) or Defined(COMPILER_VC13) or Defined(COMPILER_VC14) or Defined(COMPILER_VC15)}
-  {$DEFINE PHP_UNICODE}
+ {$DEFINE ZTS}                                               {zend thread safety support}
 {$ENDIF}
 
 {$IFNDEF VER80}                                             {Delphi 1.0}
@@ -205,6 +208,14 @@ backward compatibility between PHP versions.
 {$WARNINGS OFF}
 {$ENDIF}
 
-{$IFDEF MSWINDOWS}
-{$DEFINE WINDOWS}
+{$IFDEF MSWINDOWS} {$DEFINE WINDOWS} {$ENDIF}
+{$IFDEF FPC}
+    {$IFDEF FMX} {$UNDEF FMX} {$ENDIF}
+    {$IFDEF VCL} {$UNDEF VCL} {$ENDIF}
+    {$DEFINE LCL}
+{$ELSE}
+    {$IFDEF LCL}
+        {$UNDEF LCL}
+        {$DEFINE VCL}
+    {$ENDIF}
 {$ENDIF}
diff --git a/Source/PHPAPI.pas b/Source/PHPAPI.pas
index 186c619..23b8426 100644
--- a/Source/PHPAPI.pas
+++ b/Source/PHPAPI.pas
@@ -177,7 +177,7 @@ function GetSAPIGlobals(TSRMLS_DC : pointer) : Psapi_globals_struct; overload;
 
 
 
-{$IFNDEF CUTTED_PHP7dll}
+{$IFNDEF COMPILER_php7pv}
 php_log_err: procedure (err_msg : zend_pchar; TSRMLS_DC : pointer); cdecl;
 {$ENDIF}
 php_html_puts: procedure (str : zend_pchar; str_len : integer; TSRMLS_DC : pointer); cdecl;
@@ -587,7 +587,7 @@ function LoadPHP(const DllFileName: zend_ustr = PHPWin) : boolean;
   LFunc(@php_body_write, 'php_body_write' );
   LFunc(@php_header_write, 'php_header_write');
   {$ENDIF}
-  {$IFNDEF CUTTED_PHP7dll}
+  {$IFNDEF COMPILER_php7pv}
   LFunc(@php_log_err, 'php_log_err');
   {$ENDIF}
   LFunc(@php_html_puts, 'php_html_puts');
diff --git a/Source/ZENDAPI.pas b/Source/ZENDAPI.pas
index 6415459..192f6ff 100644
--- a/Source/ZENDAPI.pas
+++ b/Source/ZENDAPI.pas
@@ -592,7 +592,7 @@ procedure dispose_pzval_array(Params: pzval_array);
   add_property_stringl_ex                         : function(arg: pzval; key: zend_pchar; key_len: uint; str: zend_pchar; len: uint; duplicate: integer; TSRMLS_DC: Pointer): integer; cdecl;
   add_property_zval_ex                            : function(arg: pzval; key: zend_pchar; key_len: uint; value: pzval; TSRMLS_DC: Pointer): integer; cdecl;
 
-  {$IFDEF CUTTED_PHP7dll}
+  {$IFDEF COMPILER_php7pv}
   call_user_function : procedure(func:pzval; argv:pzval; argc:integer);cdecl;
   {$ELSE}
    call_user_function : function(function_table: PHashTable; object_pp: pzval;
@@ -2399,7 +2399,7 @@ function LoadZEND(const DllFilename: zend_ustr = PHPWin) : boolean;
   {$IFDEF PHP7}
   LFunc(@_zend_hash_add_or_update, '_zend_hash_add_or_update@@16');
   LFunc(@_zend_hash_add, '_zend_hash_add@@12');
-  {$IFDEF CUTTED_PHP7dll}
+  {$IFDEF COMPILER_php7pv}
   LFunc(@zend_hash_index_findZval,'zend_hash_index_findZval');
   LFunc(@zend_symtable_findTest,'zend_symtable_findTest');
   LFunc(@zend_hash_index_existsZval,'zend_hash_index_existsZval');
@@ -2809,8 +2809,8 @@ function LoadZEND(const DllFilename: zend_ustr = PHPWin) : boolean;
   // -- add_property_zval_ex
   LFunc(@add_property_zval_ex, 'add_property_zval_ex');
 
-  LFunc(@call_user_function, {$IFDEF CUTTED_PHP7dll}'__call_function'{$ELSE}'call_user_function'{$ENDIF});
-  {$IFNDEF CUTTED_PHP7dll}
+  LFunc(@call_user_function, {$IFDEF COMPILER_php7pv}'__call_function'{$ELSE}'call_user_function'{$ENDIF});
+  {$IFNDEF COMPILER_php7pv}
   LFunc(@call_user_function_ex, 'call_user_function_ex');
   {$ENDIF}
   // -- add_assoc_long_ex
diff --git a/Source/hzend_types.pas b/Source/hzend_types.pas
index c2e76e9..325f3a6 100644
--- a/Source/hzend_types.pas
+++ b/Source/hzend_types.pas
@@ -2,7 +2,7 @@
 
 interface
 
-uses Winapi.Windows;
+uses {$IFDEF FPC}Winapi.Windows{$ELSE}Windows{$ENDIF};
 
 var
  _TestCreate:Pointer;
diff --git a/Source/php4delphi.pas b/Source/php4delphi.pas
index 12e8976..d1fa8cf 100644
--- a/Source/php4delphi.pas
+++ b/Source/php4delphi.pas
@@ -1,386 +1,386 @@
-{*******************************************************}
-{                     PHP4Delphi                        }
-{               PHP - Delphi interface                  }
-{                                                       }
-{ Developers:                                           }
-{ Serhiy Perevoznyk                                     }
-{ serge_perevoznyk@hotmail.com                          }
-{                                                       }
-{ Toby Allen (Documentation)                            }
-{ tobyphp@toflidium.com                                 }
-{                                                       }
-{ http://users.telenet.be/ws36637                       }
-{ http://delphi32.blogspot.com                          }
-{*******************************************************}
-{$I PHP.INC}
-{$ifdef fpc}
-      {$mode delphi}
-{$endif}
-{ $Id: php4delphi.pas,v 7.4  02/2019 delphi32 Exp $ }
-
-//  Important:
-//  Please check PHP version you are using and change php.inc file
-//  See php.inc for more details
-
-{
-You can download the latest version of PHP from
-http://www.php.net/downloads.php
-You have to download and install PHP separately.
-It is not included in the package.
-
-For more information on the PHP Group and the PHP project,
-please see <http://www.php.net>.
-}
-unit php4delphi;
-
-interface
-
-uses
-  Windows, Messages, SysUtils, System.Types, Classes, VCL.Graphics,
-  PHPCommon, WinApi.WinSock,
-  ZendTypes, PHPTypes, PHPAPI, ZENDAPI,
-  DelphiFunctions, phpFunctions, strUtils, varUtils,
-  {$IFDEF PHP_UNICODE}WideStrUtils, {$ENDIF}
-  {$IFDEF soulengine_build} VCL.Dialogs, {$ENDIF}
-  System.UITypes;
-
-type
-
-  IPHPEngine = interface (IUnknown)
-  ['{484AE2CA-755A-437C-9B60-E3735973D0A9}']
-    procedure HandleRequest(ht : integer; return_value : pzval; return_value_ptr : ppzval; this_ptr : pzval;
-      return_value_used : integer; TSRMLS_DC : pointer);
-    function GetEngineActive : boolean;
-   end;
-     TPHPMemoryStream = class(TMemoryStream)
-  public
-    constructor Create;
-    procedure SetInitialSize(ASize : integer);
-  end;
-  {-- PHP Events --}
-  TPHPLogMessage = procedure (Sender : TObject; AText : zend_ustr) of object;
-  TPHPErrorEvent = procedure (Sender: TObject; AText: zend_ustr;
-  AType: integer; AFileName: zend_ustr; ALineNo: integer) of object;
-  TPHPReadPostEvent = procedure(Sender : TObject; Stream : TStream) of object;
-  TPHPReadResultEvent = procedure(Sender : TObject; Stream : TStream) of object;
-
-  { TpsvCustomPHP }
-  TpsvCustomPHP = class(TPHPComponent)
-  private
-    FHeaders : TPHPHeaders;
-    FMaxExecutionTime : integer;
-    FExecuteMethod : TPHPExecuteMethod;
-    FSessionActive : boolean;
-    FOnRequestStartup : TNotifyEvent;
-    FOnRequestShutdown : TNotifyEvent;
-    FAfterExecute : TNotifyEvent;
-    FBeforeExecute : TNotifyEvent;
-    FTerminated : boolean;
-    FVariables : TPHPVariables;
-    FBuffer : TPHPMemoryStream;
-    FOnLogMessage : TPHPLogMessage;
-    FOnScriptError : TPHPErrorEvent;
-    FFileName : zend_ustr;
-    {$IFDEF PHP4}
-    FWriterHandle : THandle;
-    FVirtualReadHandle : THandle;
-    FVirtualWriteHandle : THandle;
-    FVirtualCode : zend_ustr;
-    {$ENDIF}
-    FUseDelimiters : boolean;
-    FUseMapping : boolean;
-    FPostStream : TMemoryStream;
-    FOnReadPost : TPHPReadPostEvent;
-    FRequestType : TPHPRequestType;
-    FOnReadResult : TPHPReadResultEvent;
-    FContentType: zend_ustr;
-    FVirtualStream : TStringStream;
-    procedure SetVariables(Value : TPHPVariables);
-    procedure SetHeaders(Value : TPHPHeaders);
-    function GetVariableCount: integer;
-  protected
-
-    procedure ClearBuffer;
-    procedure ClearHeaders;
-    procedure PrepareResult; virtual;
-    procedure PrepareVariables; virtual;
-    function RunTime : boolean;
-    function GetThreadSafeResourceManager : pointer;
-    function  CreateVirtualFile(A_code: zend_ustr) : boolean;
-    procedure CloseVirtualFile;
-    {$IFDEF PHP4}
-    property  VirtualCode : string read FVirtualCode;
-    {$ENDIF}
-    function GetEngine : IPHPEngine;
-  public
-     TSRMLS_D : pointer;
-     Thread: TThread;
-    {fixed}
-    procedure StartupRequest; virtual;
-    procedure ShutdownRequest; virtual;
-    {/fixed}
-
-    constructor Create(AOwner : TComponent); override;
-    destructor Destroy; override;
-    function  EngineActive : boolean;
-    function  Execute : zend_ustr; overload;
-    function  Execute(AFileName : zend_ustr) : zend_ustr; overload;
-    function  RunCode(ACode : zend_ustr) : zend_ustr; overload;
-    function  RunCode(ACode : TStrings) : string; overload;
-    function  VariableByName(AName : zend_ustr) : TPHPVariable;
-    property  PostStream : TMemoryStream read FPostStream;
-    property  ExecuteMethod : TPHPExecuteMethod read FExecuteMethod write FExecuteMethod default emServer;
-    property  FileName  : zend_ustr read FFileName write FFileName;
-    property  Variables : TPHPVariables read FVariables write SetVariables;
-    property  VariableCount : integer read GetVariableCount;
-    property  OnLogMessage : TPHPLogMessage read FOnLogMessage write FOnLogMessage;
-    property  OnScriptError : TPHPErrorEvent read FOnScriptError write FOnScriptError;
-    property  OnRequestStartup : TNotifyEvent read FOnRequestStartup write FOnRequestStartup;
-    property  OnRequestShutdown : TNotifyEvent read FOnRequestShutdown write FOnRequestShutdown;
-    property  BeforeExecute : TNotifyEvent read FBeforeExecute write FBeforeExecute;
-    property  AfterExecute : TNotifyEvent read FAfterExecute write FAfterExecute;
-    property  ThreadSafeResourceManager : pointer read GetThreadSafeResourceManager;
-    property  SessionActive : boolean read FSessionActive;
-    property  UseDelimiters : boolean read FUseDelimiters write FUseDelimiters default true;
-    property  MaxExecutionTime : integer read FMaxExecutionTime write FMaxExecutionTime default 0;
-    property  Headers : TPHPHeaders read FHeaders write SetHeaders;
-    property  OnReadPost : TPHPReadPostEvent read FOnReadPost write FOnReadPost;
-    property  RequestType : TPHPRequestType read FRequestType write FRequestType default prtGet;
-    property  ResultBuffer : TPHPMemoryStream read FBuffer;
-    property  OnReadResult : TPHPReadResultEvent read FOnReadResult write FOnReadResult;
-    property  ContentType : zend_ustr read FContentType write FContentType;
-  end;
-
-  TpsvPHP = class(TpsvCustomPHP)
-  published
-    property About;
-    property FileName;
-    property Variables;
-    property OnLogMessage;
-    property OnScriptError;
-    property OnRequestStartup;
-    property OnRequestShutdown;
-    property OnReadPost;
-    property BeforeExecute;
-    property AfterExecute;
-    property UseDelimiters;
-    property MaxExecutionTime;
-    property RequestType;
-    property OnReadResult;
-    property ContentType;
-  end;
-
-  TCustomPHPLibrary = class(TPHPComponent)
-  private
-    FExecutor : TpsvCustomPHP;
-    FLibraryName : zend_ustr;
-    FFunctions  : TPHPFunctions;
-    FLocked: boolean;
-    procedure SetFunctions(const Value : TPHPFunctions);
-    procedure SetExecutor(AValue : TpsvCustomPHP);
-    procedure SetLibraryName(AValue : zend_ustr);
-  protected
-    procedure RegisterLibrary; virtual;
-    procedure UnregisterLibrary; virtual;
-  public
-    constructor Create(AOwner : TComponent); override;
-    destructor  Destroy; override;
-    procedure Refresh; virtual;
-    property Executor : TpsvCustomPHP read FExecutor write SetExecutor;
-    property LibraryName : zend_ustr read FLibraryName write SetLibraryName;
-    property Functions  : TPHPFunctions read FFunctions write SetFunctions;
-    property Locked : boolean read FLocked write FLocked;
-  end;
-  { TPHPEngine }
-  TPHPEngineInitEvent =  procedure(Sender:TObject;TSRMLS_DC:Pointer) of object;
-  TPHPEngine = class(TPHPComponent, IUnknown, IPHPEngine)
-  private
-    FINIPath : zend_ustr;
-    FOnEngineStartup  : TNotifyEvent;
-    FAddMods          : TArray<Pzend_module_entry>;
-    FOnEngineShutdown : TNotifyEvent;
-    FEngineActive     : boolean;
-    FHandleErrors     : boolean;
-    {$IFNDEF PHP540}
-    FSafeMode         : boolean;
-    FSafeModeGid      : boolean;
-    {$ENDIF}
-    FRegisterGlobals  : boolean;
-    FHTMLErrors       : boolean;
-    FMaxInputTime     : integer;
-    FConstants        : TphpConstants;
-    FDLLFolder        : zend_ustr;
-    FReportDLLError   : boolean;
-    FLock: TRTLCriticalSection;
-    FOnScriptError : TPHPErrorEvent;
-    FOnLogMessage  : TPHPLogMessage;
-    FWaitForShutdown : boolean;
-    RegNumFunc : Cardinal;
-    FHash : TStringList;
-    FLibraryModule : Tzend_module_entry;
-    FLibraryEntryTable : array  of zend_function_entry;
-    FRequestCount : integer;
-    procedure SetConstants(Value : TPHPConstants);
-    function GetConstantCount: integer;
-    function GetEngineActive : boolean;
-  protected
-    TSRMLS_D  : pppointer;
-    procedure StartupPHP; virtual;
-    procedure PrepareEngine; virtual;
-    procedure PrepareIniEntry; virtual;
-    procedure RegisterConstants; virtual;
-    procedure RegisterInternalConstants(TSRMLS_DC : pointer); virtual;
-    procedure HandleRequest(ht : integer; return_value : pzval; return_value_ptr : ppzval; this_ptr : pzval;
-      return_value_used : integer; TSRMLS_DC : pointer); virtual;
-    property  RequestCount : integer read FRequestCount;
-    procedure HandleError (Sender : TObject; AText : string; AType : Integer; AFileName : string; ALineNo : integer);
-    procedure HandleLogMessage(Sender : TObject; AText : string);
-    procedure RegisterLibrary(ALib : TCustomPHPLibrary);
-    procedure RefreshLibrary;
-    procedure UnlockLibraries;
-    procedure RemoveRequest;
-    procedure AddRequest;
-  public
-    constructor Create(AOwner : TComponent); override;
-    destructor Destroy; override;
-    procedure AddFunction(FN: zend_pchar; Func: Pointer);
-    procedure AddModule(Module_entry: Pzend_module_entry);
-    procedure  StartupEngine; virtual;
-    procedure  ShutdownEngine; virtual;
-    procedure  LockEngine; virtual;
-    procedure  UnlockEngine; virtual;
-    procedure  PrepareForShutdown; virtual;
-    property   EngineActive : boolean read GetEngineActive;
-    property   ConstantCount : integer read GetConstantCount;
-    property   WaitForShutdown : boolean read FWaitForShutdown;
-    procedure  ShutdownAndWaitFor; virtual;
-    property   LibraryEntry : Tzend_module_entry read FLibraryModule;
-  published
-    property  HandleErrors : boolean read FHandleErrors write FHandleErrors default true;
-    property  OnEngineStartup  : TNotifyEvent read FOnEngineStartup write FOnEngineStartup;
-    property  OnEngineShutdown : TNotifyEvent read FOnEngineShutdown write FOnEngineShutdown;
-    property  OnScriptError : TPHPErrorEvent read FOnScriptError write FOnScriptError;
-    property  OnLogMessage : TPHPLogMessage read FOnLogMessage write FOnLogMessage;
-    property  IniPath : zend_ustr read FIniPath write FIniPath;
-    {$IFNDEF PHP540}
-    property  SafeMode : boolean read FSafeMode write FSafeMode default false;
-    property  SafeModeGid : boolean read FSafeModeGid write FSafeModeGid default false;
-    {$ENDIF}
-    property  RegisterGlobals : boolean read FRegisterGlobals write FRegisterGlobals default true;
-    property  HTMLErrors : boolean read FHTMLErrors write FHTMLErrors default false;
-    property  MaxInputTime : integer read FMaxInputTime write FMaxInputTime default 0;
-    property  Constants : TPHPConstants read FConstants write SetConstants;
-    property  DLLFolder : zend_ustr read FDLLFolder write FDLLFolder;
-    property  ReportDLLError : boolean read FReportDLLError write FReportDLLError;
-  end;
-
-  TPHPLibrarian = class
-  private
-    FLibraries : TList;
-  public
-    constructor Create; virtual;
-    destructor Destroy; override;
-    procedure AddLibrary(ALibrary : TCustomPHPLibrary);
-    procedure RemoveLibrary(ALibrary : TCustomPHPLibrary);
-    function Count : integer;
-    function GetLibrary(Index : integer) : TCustomPHPLibrary;
-    property Libraries : TList read FLibraries write FLibraries;
-  end;
-{$IFDEF REGISTER_COLORS}
-const
-  Colors: array[0..41] of TIdentMapEntry = (
-    (Value: clBlack; Name: 'clBlack'),
-    (Value: clMaroon; Name: 'clMaroon'),
-    (Value: clGreen; Name: 'clGreen'),
-    (Value: clOlive; Name: 'clOlive'),
-    (Value: clNavy; Name: 'clNavy'),
-    (Value: clPurple; Name: 'clPurple'),
-    (Value: clTeal; Name: 'clTeal'),
-    (Value: clGray; Name: 'clGray'),
-    (Value: clSilver; Name: 'clSilver'),
-    (Value: clRed; Name: 'clRed'),
-    (Value: clLime; Name: 'clLime'),
-    (Value: clYellow; Name: 'clYellow'),
-    (Value: clBlue; Name: 'clBlue'),
-    (Value: clFuchsia; Name: 'clFuchsia'),
-    (Value: clAqua; Name: 'clAqua'),
-    (Value: clWhite; Name: 'clWhite'),
-    (Value: clScrollBar; Name: 'clScrollBar'),
-    (Value: clBackground; Name: 'clBackground'),
-    (Value: clActiveCaption; Name: 'clActiveCaption'),
-    (Value: clInactiveCaption; Name: 'clInactiveCaption'),
-    (Value: clMenu; Name: 'clMenu'),
-    (Value: clWindow; Name: 'clWindow'),
-    (Value: clWindowFrame; Name: 'clWindowFrame'),
-    (Value: clMenuText; Name: 'clMenuText'),
-    (Value: clWindowText; Name: 'clWindowText'),
-    (Value: clCaptionText; Name: 'clCaptionText'),
-    (Value: clActiveBorder; Name: 'clActiveBorder'),
-    (Value: clInactiveBorder; Name: 'clInactiveBorder'),
-    (Value: clAppWorkSpace; Name: 'clAppWorkSpace'),
-    (Value: clHighlight; Name: 'clHighlight'),
-    (Value: clHighlightText; Name: 'clHighlightText'),
-    (Value: clBtnFace; Name: 'clBtnFace'),
-    (Value: clBtnShadow; Name: 'clBtnShadow'),
-    (Value: clGrayText; Name: 'clGrayText'),
-    (Value: clBtnText; Name: 'clBtnText'),
-    (Value: clInactiveCaptionText; Name: 'clInactiveCaptionText'),
-    (Value: clBtnHighlight; Name: 'clBtnHighlight'),
-    (Value: cl3DDkShadow; Name: 'cl3DDkShadow'),
-    (Value: cl3DLight; Name: 'cl3DLight'),
-    (Value: clInfoText; Name: 'clInfoText'),
-    (Value: clInfoBk; Name: 'clInfoBk'),
-    (Value: clNone; Name: 'clNone'));
-{$ENDIF}
-var
- Librarian : TPHPLibrarian = nil;
- delphi_sapi_module : sapi_module_struct;
- PHPEngine : TPHPEngine = nil;
- {$IFDEF soulengine_build}
-  log_handler_php: string;
-  fatal_handler_php: string;
-  phpmd: TpsvPHP;
- {$ENDIF}
-implementation
-
-function AddSlashes(const S: zend_ustr): zend_ustr;
-begin
-  Result := StringReplace(S, chr(8), '8', [rfReplaceAll]);
-  Result := StringReplace(S, '\', '\\', [rfReplaceAll]);
-  Result := StringReplace(Result, '''', '\''', [rfReplaceAll]);
-  Result := StringReplace(Result, '<?', '''."<".chr(' + IntToStr(Ord('?')) +
-    ').''', [rfReplaceAll]);
-end;
-
-{ TCustomPHPLibrary }
-
-constructor TCustomPHPLibrary.Create(AOwner: TComponent);
-begin
-  inherited;
-  FFunctions := TPHPFunctions.Create(Self, TPHPFunction);
-  RegisterLibrary;
-end;
-
-destructor TCustomPHPLibrary.Destroy;
-begin
-  UnregisterLibrary;
-  FFunctions.Free;
-  FFunctions := nil;
-  inherited;
-end;
-
-procedure TCustomPHPLibrary.Refresh;
-begin
-end;
-
-
-procedure TCustomPHPLibrary.RegisterLibrary;
-begin
-   if Assigned(Librarian) then
-    Librarian.AddLibrary(Self);
-end;
-
-procedure TCustomPHPLibrary.SetExecutor(AValue: TpsvCustomPHP);
+{*******************************************************}
+{                     PHP4Delphi                        }
+{               PHP - Delphi interface                  }
+{                                                       }
+{ Developers:                                           }
+{ Serhiy Perevoznyk                                     }
+{ serge_perevoznyk@hotmail.com                          }
+{                                                       }
+{ Toby Allen (Documentation)                            }
+{ tobyphp@toflidium.com                                 }
+{                                                       }
+{ http://users.telenet.be/ws36637                       }
+{ http://delphi32.blogspot.com                          }
+{*******************************************************}
+{$I PHP.INC}
+{$ifdef fpc}
+      {$mode delphi}
+{$endif}
+{ $Id: php4delphi.pas,v 7.4  02/2019 delphi32 Exp $ }
+
+//  Important:
+//  Please check PHP version you are using and change php.inc file
+//  See php.inc for more details
+
+{
+You can download the latest version of PHP from
+http://www.php.net/downloads.php
+You have to download and install PHP separately.
+It is not included in the package.
+
+For more information on the PHP Group and the PHP project,
+please see <http://www.php.net>.
+}
+unit php4delphi;
+
+interface
+
+uses
+  Windows, Messages, SysUtils, System.Types, Classes, VCL.Graphics,
+  PHPCommon, WinApi.WinSock,
+  ZendTypes, PHPTypes, PHPAPI, ZENDAPI,
+  DelphiFunctions, phpFunctions, strUtils, varUtils,
+  {$IFDEF PHP_UNICODE}WideStrUtils, {$ENDIF}
+  {$IFDEF php_side_handler} {$IFDEF FMX}FMX.Dialogs{$ELSE}VCL.Dialogs{$ENDIF}, {$ENDIF}
+  System.UITypes;
+
+type
+
+  IPHPEngine = interface (IUnknown)
+  ['{484AE2CA-755A-437C-9B60-E3735973D0A9}']
+    procedure HandleRequest(ht : integer; return_value : pzval; return_value_ptr : ppzval; this_ptr : pzval;
+      return_value_used : integer; TSRMLS_DC : pointer);
+    function GetEngineActive : boolean;
+   end;
+     TPHPMemoryStream = class(TMemoryStream)
+  public
+    constructor Create;
+    procedure SetInitialSize(ASize : integer);
+  end;
+  {-- PHP Events --}
+  TPHPLogMessage = procedure (Sender : TObject; AText : zend_ustr) of object;
+  TPHPErrorEvent = procedure (Sender: TObject; AText: zend_ustr;
+  AType: integer; AFileName: zend_ustr; ALineNo: integer) of object;
+  TPHPReadPostEvent = procedure(Sender : TObject; Stream : TStream) of object;
+  TPHPReadResultEvent = procedure(Sender : TObject; Stream : TStream) of object;
+
+  { TpsvCustomPHP }
+  TpsvCustomPHP = class(TPHPComponent)
+  private
+    FHeaders : TPHPHeaders;
+    FMaxExecutionTime : integer;
+    FExecuteMethod : TPHPExecuteMethod;
+    FSessionActive : boolean;
+    FOnRequestStartup : TNotifyEvent;
+    FOnRequestShutdown : TNotifyEvent;
+    FAfterExecute : TNotifyEvent;
+    FBeforeExecute : TNotifyEvent;
+    FTerminated : boolean;
+    FVariables : TPHPVariables;
+    FBuffer : TPHPMemoryStream;
+    FOnLogMessage : TPHPLogMessage;
+    FOnScriptError : TPHPErrorEvent;
+    FFileName : zend_ustr;
+    {$IFDEF PHP4}
+    FWriterHandle : THandle;
+    FVirtualReadHandle : THandle;
+    FVirtualWriteHandle : THandle;
+    FVirtualCode : zend_ustr;
+    {$ENDIF}
+    FUseDelimiters : boolean;
+    FUseMapping : boolean;
+    FPostStream : TMemoryStream;
+    FOnReadPost : TPHPReadPostEvent;
+    FRequestType : TPHPRequestType;
+    FOnReadResult : TPHPReadResultEvent;
+    FContentType: zend_ustr;
+    FVirtualStream : TStringStream;
+    procedure SetVariables(Value : TPHPVariables);
+    procedure SetHeaders(Value : TPHPHeaders);
+    function GetVariableCount: integer;
+  protected
+
+    procedure ClearBuffer;
+    procedure ClearHeaders;
+    procedure PrepareResult; virtual;
+    procedure PrepareVariables; virtual;
+    function RunTime : boolean;
+    function GetThreadSafeResourceManager : pointer;
+    function  CreateVirtualFile(A_code: zend_ustr) : boolean;
+    procedure CloseVirtualFile;
+    {$IFDEF PHP4}
+    property  VirtualCode : string read FVirtualCode;
+    {$ENDIF}
+    function GetEngine : IPHPEngine;
+  public
+     TSRMLS_D : pointer;
+     Thread: TThread;
+    {fixed}
+    procedure StartupRequest; virtual;
+    procedure ShutdownRequest; virtual;
+    {/fixed}
+
+    constructor Create(AOwner : TComponent); override;
+    destructor Destroy; override;
+    function  EngineActive : boolean;
+    function  Execute : zend_ustr; overload;
+    function  Execute(AFileName : zend_ustr) : zend_ustr; overload;
+    function  RunCode(ACode : zend_ustr) : zend_ustr; overload;
+    function  RunCode(ACode : TStrings) : string; overload;
+    function  VariableByName(AName : zend_ustr) : TPHPVariable;
+    property  PostStream : TMemoryStream read FPostStream;
+    property  ExecuteMethod : TPHPExecuteMethod read FExecuteMethod write FExecuteMethod default emServer;
+    property  FileName  : zend_ustr read FFileName write FFileName;
+    property  Variables : TPHPVariables read FVariables write SetVariables;
+    property  VariableCount : integer read GetVariableCount;
+    property  OnLogMessage : TPHPLogMessage read FOnLogMessage write FOnLogMessage;
+    property  OnScriptError : TPHPErrorEvent read FOnScriptError write FOnScriptError;
+    property  OnRequestStartup : TNotifyEvent read FOnRequestStartup write FOnRequestStartup;
+    property  OnRequestShutdown : TNotifyEvent read FOnRequestShutdown write FOnRequestShutdown;
+    property  BeforeExecute : TNotifyEvent read FBeforeExecute write FBeforeExecute;
+    property  AfterExecute : TNotifyEvent read FAfterExecute write FAfterExecute;
+    property  ThreadSafeResourceManager : pointer read GetThreadSafeResourceManager;
+    property  SessionActive : boolean read FSessionActive;
+    property  UseDelimiters : boolean read FUseDelimiters write FUseDelimiters default true;
+    property  MaxExecutionTime : integer read FMaxExecutionTime write FMaxExecutionTime default 0;
+    property  Headers : TPHPHeaders read FHeaders write SetHeaders;
+    property  OnReadPost : TPHPReadPostEvent read FOnReadPost write FOnReadPost;
+    property  RequestType : TPHPRequestType read FRequestType write FRequestType default prtGet;
+    property  ResultBuffer : TPHPMemoryStream read FBuffer;
+    property  OnReadResult : TPHPReadResultEvent read FOnReadResult write FOnReadResult;
+    property  ContentType : zend_ustr read FContentType write FContentType;
+  end;
+
+  TpsvPHP = class(TpsvCustomPHP)
+  published
+    property About;
+    property FileName;
+    property Variables;
+    property OnLogMessage;
+    property OnScriptError;
+    property OnRequestStartup;
+    property OnRequestShutdown;
+    property OnReadPost;
+    property BeforeExecute;
+    property AfterExecute;
+    property UseDelimiters;
+    property MaxExecutionTime;
+    property RequestType;
+    property OnReadResult;
+    property ContentType;
+  end;
+
+  TCustomPHPLibrary = class(TPHPComponent)
+  private
+    FExecutor : TpsvCustomPHP;
+    FLibraryName : zend_ustr;
+    FFunctions  : TPHPFunctions;
+    FLocked: boolean;
+    procedure SetFunctions(const Value : TPHPFunctions);
+    procedure SetExecutor(AValue : TpsvCustomPHP);
+    procedure SetLibraryName(AValue : zend_ustr);
+  protected
+    procedure RegisterLibrary; virtual;
+    procedure UnregisterLibrary; virtual;
+  public
+    constructor Create(AOwner : TComponent); override;
+    destructor  Destroy; override;
+    procedure Refresh; virtual;
+    property Executor : TpsvCustomPHP read FExecutor write SetExecutor;
+    property LibraryName : zend_ustr read FLibraryName write SetLibraryName;
+    property Functions  : TPHPFunctions read FFunctions write SetFunctions;
+    property Locked : boolean read FLocked write FLocked;
+  end;
+  { TPHPEngine }
+  TPHPEngineInitEvent =  procedure(Sender:TObject;TSRMLS_DC:Pointer) of object;
+  TPHPEngine = class(TPHPComponent, IUnknown, IPHPEngine)
+  private
+    FINIPath : zend_ustr;
+    FOnEngineStartup  : TNotifyEvent;
+    FAddMods          : TArray<Pzend_module_entry>;
+    FOnEngineShutdown : TNotifyEvent;
+    FEngineActive     : boolean;
+    FHandleErrors     : boolean;
+    {$IFNDEF PHP540}
+    FSafeMode         : boolean;
+    FSafeModeGid      : boolean;
+    {$ENDIF}
+    FRegisterGlobals  : boolean;
+    FHTMLErrors       : boolean;
+    FMaxInputTime     : integer;
+    FConstants        : TphpConstants;
+    FDLLFolder        : zend_ustr;
+    FReportDLLError   : boolean;
+    FLock: TRTLCriticalSection;
+    FOnScriptError : TPHPErrorEvent;
+    FOnLogMessage  : TPHPLogMessage;
+    FWaitForShutdown : boolean;
+    RegNumFunc : Cardinal;
+    FHash : TStringList;
+    FLibraryModule : Tzend_module_entry;
+    FLibraryEntryTable : array  of zend_function_entry;
+    FRequestCount : integer;
+    procedure SetConstants(Value : TPHPConstants);
+    function GetConstantCount: integer;
+    function GetEngineActive : boolean;
+  protected
+    TSRMLS_D  : pppointer;
+    procedure StartupPHP; virtual;
+    procedure PrepareEngine; virtual;
+    procedure PrepareIniEntry; virtual;
+    procedure RegisterConstants; virtual;
+    procedure RegisterInternalConstants(TSRMLS_DC : pointer); virtual;
+    procedure HandleRequest(ht : integer; return_value : pzval; return_value_ptr : ppzval; this_ptr : pzval;
+      return_value_used : integer; TSRMLS_DC : pointer); virtual;
+    property  RequestCount : integer read FRequestCount;
+    procedure HandleError (Sender : TObject; AText : string; AType : Integer; AFileName : string; ALineNo : integer);
+    procedure HandleLogMessage(Sender : TObject; AText : string);
+    procedure RegisterLibrary(ALib : TCustomPHPLibrary);
+    procedure RefreshLibrary;
+    procedure UnlockLibraries;
+    procedure RemoveRequest;
+    procedure AddRequest;
+  public
+    constructor Create(AOwner : TComponent); override;
+    destructor Destroy; override;
+    procedure AddFunction(FN: zend_pchar; Func: Pointer);
+    procedure AddModule(Module_entry: Pzend_module_entry);
+    procedure  StartupEngine; virtual;
+    procedure  ShutdownEngine; virtual;
+    procedure  LockEngine; virtual;
+    procedure  UnlockEngine; virtual;
+    procedure  PrepareForShutdown; virtual;
+    property   EngineActive : boolean read GetEngineActive;
+    property   ConstantCount : integer read GetConstantCount;
+    property   WaitForShutdown : boolean read FWaitForShutdown;
+    procedure  ShutdownAndWaitFor; virtual;
+    property   LibraryEntry : Tzend_module_entry read FLibraryModule;
+  published
+    property  HandleErrors : boolean read FHandleErrors write FHandleErrors default true;
+    property  OnEngineStartup  : TNotifyEvent read FOnEngineStartup write FOnEngineStartup;
+    property  OnEngineShutdown : TNotifyEvent read FOnEngineShutdown write FOnEngineShutdown;
+    property  OnScriptError : TPHPErrorEvent read FOnScriptError write FOnScriptError;
+    property  OnLogMessage : TPHPLogMessage read FOnLogMessage write FOnLogMessage;
+    property  IniPath : zend_ustr read FIniPath write FIniPath;
+    {$IFNDEF PHP540}
+    property  SafeMode : boolean read FSafeMode write FSafeMode default false;
+    property  SafeModeGid : boolean read FSafeModeGid write FSafeModeGid default false;
+    {$ENDIF}
+    property  RegisterGlobals : boolean read FRegisterGlobals write FRegisterGlobals default true;
+    property  HTMLErrors : boolean read FHTMLErrors write FHTMLErrors default false;
+    property  MaxInputTime : integer read FMaxInputTime write FMaxInputTime default 0;
+    property  Constants : TPHPConstants read FConstants write SetConstants;
+    property  DLLFolder : zend_ustr read FDLLFolder write FDLLFolder;
+    property  ReportDLLError : boolean read FReportDLLError write FReportDLLError;
+  end;
+
+  TPHPLibrarian = class
+  private
+    FLibraries : TList;
+  public
+    constructor Create; virtual;
+    destructor Destroy; override;
+    procedure AddLibrary(ALibrary : TCustomPHPLibrary);
+    procedure RemoveLibrary(ALibrary : TCustomPHPLibrary);
+    function Count : integer;
+    function GetLibrary(Index : integer) : TCustomPHPLibrary;
+    property Libraries : TList read FLibraries write FLibraries;
+  end;
+{$IFDEF REGISTER_COLOURS}
+const
+  Colors: array[0..41] of TIdentMapEntry = (
+    (Value: clBlack; Name: 'clBlack'),
+    (Value: clMaroon; Name: 'clMaroon'),
+    (Value: clGreen; Name: 'clGreen'),
+    (Value: clOlive; Name: 'clOlive'),
+    (Value: clNavy; Name: 'clNavy'),
+    (Value: clPurple; Name: 'clPurple'),
+    (Value: clTeal; Name: 'clTeal'),
+    (Value: clGray; Name: 'clGray'),
+    (Value: clSilver; Name: 'clSilver'),
+    (Value: clRed; Name: 'clRed'),
+    (Value: clLime; Name: 'clLime'),
+    (Value: clYellow; Name: 'clYellow'),
+    (Value: clBlue; Name: 'clBlue'),
+    (Value: clFuchsia; Name: 'clFuchsia'),
+    (Value: clAqua; Name: 'clAqua'),
+    (Value: clWhite; Name: 'clWhite'),
+    (Value: clScrollBar; Name: 'clScrollBar'),
+    (Value: clBackground; Name: 'clBackground'),
+    (Value: clActiveCaption; Name: 'clActiveCaption'),
+    (Value: clInactiveCaption; Name: 'clInactiveCaption'),
+    (Value: clMenu; Name: 'clMenu'),
+    (Value: clWindow; Name: 'clWindow'),
+    (Value: clWindowFrame; Name: 'clWindowFrame'),
+    (Value: clMenuText; Name: 'clMenuText'),
+    (Value: clWindowText; Name: 'clWindowText'),
+    (Value: clCaptionText; Name: 'clCaptionText'),
+    (Value: clActiveBorder; Name: 'clActiveBorder'),
+    (Value: clInactiveBorder; Name: 'clInactiveBorder'),
+    (Value: clAppWorkSpace; Name: 'clAppWorkSpace'),
+    (Value: clHighlight; Name: 'clHighlight'),
+    (Value: clHighlightText; Name: 'clHighlightText'),
+    (Value: clBtnFace; Name: 'clBtnFace'),
+    (Value: clBtnShadow; Name: 'clBtnShadow'),
+    (Value: clGrayText; Name: 'clGrayText'),
+    (Value: clBtnText; Name: 'clBtnText'),
+    (Value: clInactiveCaptionText; Name: 'clInactiveCaptionText'),
+    (Value: clBtnHighlight; Name: 'clBtnHighlight'),
+    (Value: cl3DDkShadow; Name: 'cl3DDkShadow'),
+    (Value: cl3DLight; Name: 'cl3DLight'),
+    (Value: clInfoText; Name: 'clInfoText'),
+    (Value: clInfoBk; Name: 'clInfoBk'),
+    (Value: clNone; Name: 'clNone'));
+{$ENDIF}
+var
+ Librarian : TPHPLibrarian = nil;
+ delphi_sapi_module : sapi_module_struct;
+ PHPEngine : TPHPEngine = nil;
+ {$IFDEF php_side_handler}
+  log_handler_php: string;
+  fatal_handler_php: string;
+  phpmd: TpsvPHP;
+ {$ENDIF}
+implementation
+
+function AddSlashes(const S: zend_ustr): zend_ustr;
+begin
+  Result := StringReplace(S, chr(8), '8', [rfReplaceAll]);
+  Result := StringReplace(S, '\', '\\', [rfReplaceAll]);
+  Result := StringReplace(Result, '''', '\''', [rfReplaceAll]);
+  Result := StringReplace(Result, '<?', '''."<".chr(' + IntToStr(Ord('?')) +
+    ').''', [rfReplaceAll]);
+end;
+
+{ TCustomPHPLibrary }
+
+constructor TCustomPHPLibrary.Create(AOwner: TComponent);
+begin
+  inherited;
+  FFunctions := TPHPFunctions.Create(Self, TPHPFunction);
+  RegisterLibrary;
+end;
+
+destructor TCustomPHPLibrary.Destroy;
+begin
+  UnregisterLibrary;
+  FFunctions.Free;
+  FFunctions := nil;
+  inherited;
+end;
+
+procedure TCustomPHPLibrary.Refresh;
+begin
+end;
+
+
+procedure TCustomPHPLibrary.RegisterLibrary;
+begin
+   if Assigned(Librarian) then
+    Librarian.AddLibrary(Self);
+end;
+
+procedure TCustomPHPLibrary.SetExecutor(AValue: TpsvCustomPHP);
 begin
   if FExecutor <> AValue then
   begin
@@ -394,357 +394,358 @@ procedure TCustomPHPLibrary.SetExecutor(AValue: TpsvCustomPHP);
      end;
   end;
 end;
-
-procedure TCustomPHPLibrary.SetFunctions(const Value: TPHPFunctions);
-begin
-  FFunctions.Assign(Value);
-end;
-
-procedure TCustomPHPLibrary.SetLibraryName(AValue: zend_ustr);
-begin
-  if FLibraryName <> AValue then
-   begin
-     FLibraryName := AValue;
-   end;  
-end;
-
-procedure TCustomPHPLibrary.UnregisterLibrary;
-begin
-  if Assigned(Librarian) then
-   Librarian.RemoveLibrary(Self);
-end;
-
-
-procedure InitLibrarian;
-begin
-  Librarian := TPHPLibrarian.Create;
-end;
-
-procedure UninitLibrarian;
-begin
-  if Assigned(Librarian) then
-   try
-     Librarian.Free;
-   finally
-     Librarian := nil;
-   end;
-end;
-
-{ TPHPLibrarian }
-
-procedure TPHPLibrarian.AddLibrary(ALibrary: TCustomPHPLibrary);
-begin
-  if FLibraries.IndexOf(ALibrary) = -1 then
-   FLibraries.Add(ALibrary);
-end;
-
-function TPHPLibrarian.Count: integer;
-begin
-  Result := FLibraries.Count;
-end;
-
-constructor TPHPLibrarian.Create;
-begin
-  inherited;
-  FLibraries := TList.Create;
-end;
-
-destructor TPHPLibrarian.Destroy;
-begin
-  FLibraries.Free;
-  inherited;
-end;
-
-function TPHPLibrarian.GetLibrary(Index: integer): TCustomPHPLibrary;
-begin
-  Result := TCustomPHPLibrary(FLibraries[Index]);
-end;
-
-procedure TPHPLibrarian.RemoveLibrary(ALibrary: TCustomPHPLibrary);
-begin
-  FLibraries.Remove(ALibrary);
-end;
-{ TPHPMemoryStream }
-
-constructor TPHPMemoryStream.Create;
-begin
-  inherited;
-end;
-
-procedure TPHPMemoryStream.SetInitialSize(ASize: integer);
-begin
-  Capacity := ASize;
-end;
-{ Startup functions }
-function minit (_type : integer; module_number : integer; TSRMLS_DC : pointer) : integer; cdecl;
-begin
-  RegisterInternalClasses(TSRMLS_DC);
-  RESULT := SUCCESS;
-end;
-
-function mshutdown (_type : integer; module_number : integer; TSRMLS_DC : pointer) : integer; cdecl;
-begin
-  RESULT := SUCCESS;
-end;
-
-{Request initialization}
-function rinit (_type : integer; module_number : integer; TSRMLS_DC : pointer) : integer; cdecl;
-begin
-  Result := SUCCESS;
-end;
-
-{Request shutdown}
-function rshutdown (_type : integer; module_number : integer; TSRMLS_DC : pointer) : integer; cdecl;
-begin
-  Result := SUCCESS;
-end;
-
-{$IFDEF PHP5}
-
-{PHP 5 only}
-function delphi_stream_reader (handle : pointer; buf : zend_pchar; len : size_t; TSRMLS_DC : pointer) : size_t; cdecl;
-var
- MS : TMemoryStream;
-begin
-  MS := TMemoryStream(handle);
-  if MS =  nil then
-    result := 0
-     else
-       try
-         result := MS.Read(buf^, len);
-       except
-          result := 0;
-       end;
-end;
-
-{PHP 5 only}
-procedure delphi_stream_closer(handle : pointer; TSRMLS_DC : pointer); cdecl;
-var
- MS : TMemoryStream;
-begin
-  MS := TMemoryStream(handle);
-  if MS <> nil then
-   try
-     MS.Clear;
-   except
-   end;
-end;
-
-{$IFDEF PHP530}
-function delphi_stream_fsizer(handle : pointer; TSRMLS_DC : pointer) : size_t; cdecl;
-var
-  MS : TMemoryStream;
-begin
-  MS := TMemoryStream(handle);
-  if MS <> nil then
-   try
-     result := MS.Size;
-   except
-     Result := 0;
-   end
-    else
-      Result := 0;
-end;
-{$ELSE}
-{$IFDEF PHP510}
-
-{ PHP 5.10 and higher }
-function delphi_stream_teller(handle : pointer; TSRMLS_DC : pointer) : longint; cdecl;
-var
-  MS : TMemoryStream;
-begin
-  MS := TMemoryStream(handle);
-  if MS <> nil then
-   try
-     result := MS.Size;
-   except
-     Result := 0;
-   end
-    else
-      Result := 0;
-end;
-{$ENDIF}
-{$ENDIF}
-{$ENDIF}
-{ PHP Info functions }
-procedure php_info_library(zend_module : Pointer; TSRMLS_DC : pointer); cdecl;
-begin
-end;
-
-function php_delphi_startup(sapi_module : Psapi_module_struct) : integer; cdecl;
-begin
-  Result := SUCCESS;
-end;
-
-function php_delphi_deactivate(p : pointer) : integer; cdecl;
-begin
-  result := SUCCESS;
-end;
-
-procedure php_delphi_flush(p : pointer); cdecl;
-begin
-end;
-
-function php_delphi_ub_write(str : pointer; len : uint; p : pointer) : integer; cdecl;
-var
- php : TpsvPHP;
- gl : psapi_globals_struct;
-begin
-  Result := 0;
-  gl := GetSAPIGlobals;
-  if Assigned(gl) then
-   begin
-     php := TpsvPHP(gl^.server_context);
-     if Assigned(php) then
-      begin
-        try
-         result := php.FBuffer.Write(str^, len);
-        except
-        end;
-      end;
-   end;
-end;
-function php_delphi_header_handler(sapi_header : psapi_header_struct;  sapi_headers : psapi_headers_struct; TSRMLS_DC : pointer) : integer; cdecl;
-begin
-  Result := SAPI_HEADER_ADD;
-end;
-function php_delphi_send_header(p1, TSRMLS_DC : pointer) : integer; cdecl;
-var
- php : TpsvPHP;
- gl  : psapi_globals_struct;
-begin
-  gl := GetSAPIGlobals;
-  php := TpsvPHP(gl^.server_context);
-  if Assigned(p1) and Assigned(php) then
-   begin
-    with php.Headers.Add do
-     Header := String(Psapi_header_struct(p1)^.header);
-   end;
-  Result := SAPI_HEADER_SENT_SUCCESSFULLY;
-end;
-
-function php_delphi_read_cookies(p1 : pointer) : pointer; cdecl;
-begin
-  result := nil;
-end;
-function php_delphi_read_post(buf : zend_pchar; len : uint; TSRMLS_DC : pointer) : integer; cdecl;
-var
- gl : psapi_globals_struct;
- php : TpsvPHP;
-begin
-  gl := GetSAPIGlobals;
-  if gl = nil then
-   begin
-     Result := 0;
-     Exit;
-   end;
-
-  php := TpsvPHP(gl^.server_context);
-
-  if PHP = nil then
-   begin
-     Result := 0;
-     Exit;
-   end;
-
-  if php.PostStream = nil then
-   begin
-     Result := 0;
-     Exit;
-   end;
-
-  if php.PostStream.Size = 0 then
-   begin
-     Result := 0;
-     Exit;
-   end;
-
-  Result := php.PostStream.Read(buf^, len);
-end;
-function GetLocalIP: String;
-const WSVer = $101;
-var
-  wsaData: TWSAData;
-  P: PHostEnt;
-  Buf: array [0..127] of Char;
-begin
-  Result := '';
-  if WSAStartup(WSVer, wsaData) = 0 then begin
-    if GetHostName(@Buf, 128) = 0 then begin
-      P := GetHostByName(@Buf);
-      if P <> nil then Result := iNet_ntoa(PInAddr(p^.h_addr_list^)^);
-    end;
-    WSACleanup;
-  end;
-end;
-
-procedure php_delphi_register_variables(val : pzval; p : pointer); cdecl;
-var
- php : TpsvPHP;
- gl : psapi_globals_struct;
- cnt : integer;
- varcnt : integer;
-begin
-  gl := GetSAPIGlobals;
-  if gl = nil then
-   Exit;
-
-  php := TpsvPHP(gl^.server_context);
-
-  if PHP = nil then
-   begin
-     Exit;
-   end;
-  php_register_variable('PHP_SELF', '_', nil, p);
-  php_register_variable('REMOTE_ADDR', zend_pchar(GetLocalIP()), val, p);
-  php_register_variable('IP_ADDRESS', zend_pchar(GetLocalIP()), val, p);
-  {if php.RequestType = prtPost then
-   php_register_variable('REQUEST_METHOD', 'POST', val, p)
-     else
-       php_register_variable('REQUEST_METHOD', 'GET', val, p);}
-
-  varcnt := PHP.Variables.Count;
-  if varcnt > 0 then
-   begin
-      for cnt := 0 to varcnt - 1 do
-       begin
-         php_register_variable(zend_pchar(php.Variables[cnt].Name),
-                zend_pchar(php.Variables[cnt].Value), val, p);
-       end;
-   end;
-end;
-function wvsprintfA(Output: zend_pchar; Format: zend_pchar; arglist: zend_pchar): Integer; stdcall; external 'user32.dll';
-{$IFDEF PHP4}
-function WriterProc(Parameter : Pointer) : integer;
-var
- n : integer;
- php : TpsvCustomPHP;
- buf : zend_pchar;
- k : cardinal;
-begin
-  try
-    php := TPsvCustomPHP(Parameter);
-    Buf := zend_pchar(php.FVirtualCode);
-    k := length(php.FVirtualCode);
-    repeat
-      n := _write(php.FVirtualWriteHandle, Buf, k);
-      if (n <= 0) then
-       break
-        else
-          begin
-            inc(Buf, n);
-            dec(K, n);
-          end;
-    until (n <= 0);
-    Close(php.FVirtualWriteHandle);
-    php.FVirtualWriteHandle := 0;
-  finally
-    Result := 0;
-    ExitThread(0);
-  end;
-end;
-{$ENDIF}
-
{$IFDEF soulengine_build}
+
+procedure TCustomPHPLibrary.SetFunctions(const Value: TPHPFunctions);
+begin
+  FFunctions.Assign(Value);
+end;
+
+procedure TCustomPHPLibrary.SetLibraryName(AValue: zend_ustr);
+begin
+  if FLibraryName <> AValue then
+   begin
+     FLibraryName := AValue;
+   end;  
+end;
+
+procedure TCustomPHPLibrary.UnregisterLibrary;
+begin
+  if Assigned(Librarian) then
+   Librarian.RemoveLibrary(Self);
+end;
+
+
+procedure InitLibrarian;
+begin
+  Librarian := TPHPLibrarian.Create;
+end;
+
+procedure UninitLibrarian;
+begin
+  if Assigned(Librarian) then
+   try
+     Librarian.Free;
+   finally
+     Librarian := nil;
+   end;
+end;
+
+{ TPHPLibrarian }
+
+procedure TPHPLibrarian.AddLibrary(ALibrary: TCustomPHPLibrary);
+begin
+  if FLibraries.IndexOf(ALibrary) = -1 then
+   FLibraries.Add(ALibrary);
+end;
+
+function TPHPLibrarian.Count: integer;
+begin
+  Result := FLibraries.Count;
+end;
+
+constructor TPHPLibrarian.Create;
+begin
+  inherited;
+  FLibraries := TList.Create;
+end;
+
+destructor TPHPLibrarian.Destroy;
+begin
+  FLibraries.Free;
+  inherited;
+end;
+
+function TPHPLibrarian.GetLibrary(Index: integer): TCustomPHPLibrary;
+begin
+  Result := TCustomPHPLibrary(FLibraries[Index]);
+end;
+
+procedure TPHPLibrarian.RemoveLibrary(ALibrary: TCustomPHPLibrary);
+begin
+  FLibraries.Remove(ALibrary);
+end;
+{ TPHPMemoryStream }
+
+constructor TPHPMemoryStream.Create;
+begin
+  inherited;
+end;
+
+procedure TPHPMemoryStream.SetInitialSize(ASize: integer);
+begin
+  Capacity := ASize;
+end;
+{ Startup functions }
+function minit (_type : integer; module_number : integer; TSRMLS_DC : pointer) : integer; cdecl;
+begin
+  RegisterInternalClasses(TSRMLS_DC);
+  RESULT := SUCCESS;
+end;
+
+function mshutdown (_type : integer; module_number : integer; TSRMLS_DC : pointer) : integer; cdecl;
+begin
+  RESULT := SUCCESS;
+end;
+
+{Request initialization}
+function rinit (_type : integer; module_number : integer; TSRMLS_DC : pointer) : integer; cdecl;
+begin
+  Result := SUCCESS;
+end;
+
+{Request shutdown}
+function rshutdown (_type : integer; module_number : integer; TSRMLS_DC : pointer) : integer; cdecl;
+begin
+  Result := SUCCESS;
+end;
+
+{$IFDEF PHP5}
+
+{PHP 5 only}
+function delphi_stream_reader (handle : pointer; buf : zend_pchar; len : size_t; TSRMLS_DC : pointer) : size_t; cdecl;
+var
+ MS : TMemoryStream;
+begin
+  MS := TMemoryStream(handle);
+  if MS =  nil then
+    result := 0
+     else
+       try
+         result := MS.Read(buf^, len);
+       except
+          result := 0;
+       end;
+end;
+
+{PHP 5 only}
+procedure delphi_stream_closer(handle : pointer; TSRMLS_DC : pointer); cdecl;
+var
+ MS : TMemoryStream;
+begin
+  MS := TMemoryStream(handle);
+  if MS <> nil then
+   try
+     MS.Clear;
+   except
+   end;
+end;
+
+{$IFDEF PHP530}
+function delphi_stream_fsizer(handle : pointer; TSRMLS_DC : pointer) : size_t; cdecl;
+var
+  MS : TMemoryStream;
+begin
+  MS := TMemoryStream(handle);
+  if MS <> nil then
+   try
+     result := MS.Size;
+   except
+     Result := 0;
+   end
+    else
+      Result := 0;
+end;
+{$ELSE}
+{$IFDEF PHP510}
+
+{ PHP 5.10 and higher }
+function delphi_stream_teller(handle : pointer; TSRMLS_DC : pointer) : longint; cdecl;
+var
+  MS : TMemoryStream;
+begin
+  MS := TMemoryStream(handle);
+  if MS <> nil then
+   try
+     result := MS.Size;
+   except
+     Result := 0;
+   end
+    else
+      Result := 0;
+end;
+{$ENDIF}
+{$ENDIF}
+{$ENDIF}
+{ PHP Info functions }
+procedure php_info_library(zend_module : Pointer; TSRMLS_DC : pointer); cdecl;
+begin
+end;
+
+function php_delphi_startup(sapi_module : Psapi_module_struct) : integer; cdecl;
+begin
+  Result := SUCCESS;
+end;
+
+function php_delphi_deactivate(p : pointer) : integer; cdecl;
+begin
+  result := SUCCESS;
+end;
+
+procedure php_delphi_flush(p : pointer); cdecl;
+begin
+end;
+
+function php_delphi_ub_write(str : pointer; len : uint; p : pointer) : integer; cdecl;
+var
+ php : TpsvPHP;
+ gl : psapi_globals_struct;
+begin
+  Result := 0;
+  gl := GetSAPIGlobals;
+  if Assigned(gl) then
+   begin
+     php := TpsvPHP(gl^.server_context);
+     if Assigned(php) then
+      begin
+        try
+         result := php.FBuffer.Write(str^, len);
+        except
+        end;
+      end;
+   end;
+end;
+function php_delphi_header_handler(sapi_header : psapi_header_struct;  sapi_headers : psapi_headers_struct; TSRMLS_DC : pointer) : integer; cdecl;
+begin
+  Result := SAPI_HEADER_ADD;
+end;
+function php_delphi_send_header(p1, TSRMLS_DC : pointer) : integer; cdecl;
+var
+ php : TpsvPHP;
+ gl  : psapi_globals_struct;
+begin
+  gl := GetSAPIGlobals;
+  php := TpsvPHP(gl^.server_context);
+  if Assigned(p1) and Assigned(php) then
+   begin
+    with php.Headers.Add do
+     Header := String(Psapi_header_struct(p1)^.header);
+   end;
+  Result := SAPI_HEADER_SENT_SUCCESSFULLY;
+end;
+
+function php_delphi_read_cookies(p1 : pointer) : pointer; cdecl;
+begin
+  result := nil;
+end;
+function php_delphi_read_post(buf : zend_pchar; len : uint; TSRMLS_DC : pointer) : integer; cdecl;
+var
+ gl : psapi_globals_struct;
+ php : TpsvPHP;
+begin
+  gl := GetSAPIGlobals;
+  if gl = nil then
+   begin
+     Result := 0;
+     Exit;
+   end;
+
+  php := TpsvPHP(gl^.server_context);
+
+  if PHP = nil then
+   begin
+     Result := 0;
+     Exit;
+   end;
+
+  if php.PostStream = nil then
+   begin
+     Result := 0;
+     Exit;
+   end;
+
+  if php.PostStream.Size = 0 then
+   begin
+     Result := 0;
+     Exit;
+   end;
+
+  Result := php.PostStream.Read(buf^, len);
+end;
+function GetLocalIP: String;
+const WSVer = $101;
+var
+  wsaData: TWSAData;
+  P: PHostEnt;
+  Buf: array [0..127] of Char;
+begin
+  Result := '';
+  if WSAStartup(WSVer, wsaData) = 0 then begin
+    if GetHostName(@Buf, 128) = 0 then begin
+      P := GetHostByName(@Buf);
+      if P <> nil then Result := iNet_ntoa(PInAddr(p^.h_addr_list^)^);
+    end;
+    WSACleanup;
+  end;
+end;
+
+procedure php_delphi_register_variables(val : pzval; p : pointer); cdecl;
+var
+ php : TpsvPHP;
+ gl : psapi_globals_struct;
+ cnt : integer;
+ varcnt : integer;
+begin
+  gl := GetSAPIGlobals;
+  if gl = nil then
+   Exit;
+
+  php := TpsvPHP(gl^.server_context);
+
+  if PHP = nil then
+   begin
+     Exit;
+   end;
+  php_register_variable('PHP_SELF', '_', nil, p);
+  php_register_variable('REMOTE_ADDR', zend_pchar(GetLocalIP()), val, p);
+  php_register_variable('IP_ADDRESS', zend_pchar(GetLocalIP()), val, p);
+  {if php.RequestType = prtPost then
+   php_register_variable('REQUEST_METHOD', 'POST', val, p)
+     else
+       php_register_variable('REQUEST_METHOD', 'GET', val, p);}
+
+  varcnt := PHP.Variables.Count;
+  if varcnt > 0 then
+   begin
+      for cnt := 0 to varcnt - 1 do
+       begin
+         php_register_variable(zend_pchar(php.Variables[cnt].Name),
+                zend_pchar(php.Variables[cnt].Value), val, p);
+       end;
+   end;
+end;
+function wvsprintfA(Output: zend_pchar; Format: zend_pchar; arglist: zend_pchar): Integer; stdcall; external 'user32.dll';
+{$IFDEF PHP4}
+function WriterProc(Parameter : Pointer) : integer;
+var
+ n : integer;
+ php : TpsvCustomPHP;
+ buf : zend_pchar;
+ k : cardinal;
+begin
+  try
+    php := TPsvCustomPHP(Parameter);
+    Buf := zend_pchar(php.FVirtualCode);
+    k := length(php.FVirtualCode);
+    repeat
+      n := _write(php.FVirtualWriteHandle, Buf, k);
+      if (n <= 0) then
+       break
+        else
+          begin
+            inc(Buf, n);
+            dec(K, n);
+          end;
+    until (n <= 0);
+    Close(php.FVirtualWriteHandle);
+    php.FVirtualWriteHandle := 0;
+  finally
+    Result := 0;
+    ExitThread(0);
+  end;
+end;
+{$ENDIF}
+
+{$IFDEF php_side_handler}
 procedure delphi_error_cb(AType: Integer; const AFname: zend_pchar; const ALineNo: UINT;
   const AFormat: zend_pchar; args: zend_pchar) cdecl;
 var
@@ -800,9 +801,9 @@ procedure delphi_error_cb(AType: Integer; const AFname: zend_pchar; const ALineN
       MessageDlg(LText, mtError, [mbOk], 0)
   end;
   end;
-end;
-{$ELSE}
-procedure delphi_error_cb(_type : integer; const error_filename : zend_pchar;
+end;
+{$ELSE}
+procedure delphi_error_cb(_type : integer; const error_filename : zend_pchar;
    const error_lineno : uint; const _format : zend_pchar; args : zend_pchar); cdecl;
 var
  buffer  : array[0..1023] of zend_uchar;
@@ -862,7 +863,7 @@ procedure delphi_error_cb(_type : integer; const error_filename : zend_pchar;
                 else
                     error_type_str := 'Unknown error';
                end;
-              {$IFDEF CUTTED_PHP7dll}
+              {$IFDEF COMPILER_php7pv}
                ShowMessage(
                 Format
                 ('PHP4DELPHI %s:  %s in %s on line %d', [error_type_str, buffer, error_filename, error_lineno]));
@@ -875,27 +876,27 @@ procedure delphi_error_cb(_type : integer; const error_filename : zend_pchar;
  end;
    if PHPLoaded then
     _zend_bailout(error_filename, error_lineno);
-end;
-{$ENDIF}
-{$IFDEF soulengine_build}
-function php_delphi_log_message(msg : zend_pchar) : integer; cdecl;
-var
- php : TpsvPHP;
- gl : psapi_globals_struct;
- S: zend_ustr;
-begin
-  Result := 0;
-  gl := GetSAPIGlobals;
-  if gl = nil then
-   Exit;
-
-  php := TpsvPHP(gl^.server_context);
-  if Assigned(PHPEngine) then
-   begin
-     if Assigned(PHPEngine.OnLogMessage) then
-       phpEngine.HandleLogMessage(php, msg)
-        else
-        if log_handler_php <> '' then
+end;
+{$ENDIF}
+{$IFDEF php_side_handler}
+function php_delphi_log_message(msg : zend_pchar) : integer; cdecl;
+var
+ php : TpsvPHP;
+ gl : psapi_globals_struct;
+ S: zend_ustr;
+begin
+  Result := 0;
+  gl := GetSAPIGlobals;
+  if gl = nil then
+   Exit;
+
+  php := TpsvPHP(gl^.server_context);
+  if Assigned(PHPEngine) then
+   begin
+     if Assigned(PHPEngine.OnLogMessage) then
+       phpEngine.HandleLogMessage(php, msg)
+        else
+        if log_handler_php <> '' then
         begin
           S :=  zend_ustr(fatal_handler_php + '(' + '''' +  AddSlashes(msg) + '''' +
                ');' + ' ?>');
@@ -905,15 +906,15 @@ function php_delphi_log_message(msg : zend_pchar) : integer; cdecl;
 
             phpmd.RunCode(S);
             S := '';
-          end
-          else
-          MessageBoxA(0, MSG, 'PHP4Delphi', MB_OK)
-       end
-      else
-        MessageBoxA(0, msg, 'PHP4Delphi', MB_OK);
-end;
-{$ELSE}
-function php_delphi_log_message(msg : Pchar) : integer; cdecl;
+          end
+          else
+          MessageBoxA(0, MSG, 'PHP4Delphi', MB_OK)
+       end
+      else
+        MessageBoxA(0, msg, 'PHP4Delphi', MB_OK);
+end;
+{$ELSE}
+function php_delphi_log_message(msg : Pchar) : integer; cdecl;
 var
  php : TpsvPHP;
  gl : psapi_globals_struct;
@@ -932,1083 +933,1083 @@ function php_delphi_log_message(msg : Pchar) : integer; cdecl;
       else
         MessageBox(0, msg, 'PHP4Delphi', MB_OK);
   result := 0;
-end;
-{$ENDIF}
-{ Request sender/dispatcher }
-
-{$IFDEF PHP510}
-procedure DispatchRequest(ht : integer; return_value : pzval; return_value_ptr : ppzval; this_ptr : pzval;
-      return_value_used : integer; TSRMLS_DC : pointer); cdecl;
-{$ELSE}
-procedure DispatchRequest(ht : integer; return_value : pzval; this_ptr : pzval;
-      return_value_used : integer; TSRMLS_DC : pointer); cdecl;
-{$ENDIF}
-var
- php : TpsvPHP;
- gl : psapi_globals_struct;
- Lib : IPHPEngine;
-{$IFNDEF PHP510}
- return_value_ptr : ppzval;
-{$ENDIF}
-begin
-  {$IFNDEF PHP510}
-  return_value_ptr := nil;
-  {$ENDIF}
-  ZVALVAL(return_value);
-  gl := GetSAPIGlobals;
-  if gl = nil then
-   Exit;
-  php := TpsvPHP(gl^.server_context);
-  if Assigned(php) then
-   begin
-     try
-       Lib := php.GetEngine;
-       if lib <> nil then
-       Lib.HandleRequest(ht, return_value, return_value_ptr, this_ptr, return_value_used, TSRMLS_DC);
-     except
-      ZVALVAL(return_value);
-     end;
-   end;
-end;
-
-{ TpsvCustomPHP }
-
-constructor TpsvCustomPHP.Create(AOwner: TComponent);
-begin
-  inherited;
-  FMaxExecutionTime := 0;
-  FExecuteMethod := emServer;
-  FSessionActive := false;
-  FVariables := TPHPVariables.Create(Self);
-  FHeaders := TPHPHeaders.Create(Self);
-  FUseDelimiters := true;
-  FRequestType := prtGet;
-  FBuffer := TPHPMemoryStream.Create;
-  {$IFDEF PHP4}
-  FVirtualCode := '';
-  {$ELSE}
-  FVirtualStream := TStringStream.Create;
-  {$ENDIF}
-end;
-
-destructor TpsvCustomPHP.Destroy;
-begin
-  FVariables.Free;
-  FHeaders.Free;
-  FSessionActive := False;
-  FBuffer.Free;
-  {$IFDEF PHP4}
-  FVirtualCode := '';
-  {$ELSE}
-  if FVirtualStream <> nil then
-   FreeAndNil(FVirtualStream);
-  {$ENDIF}
-  if Assigned(FPostStream) then
-   FreeAndNil(FPostStream);
-  inherited;
-end;
-
-procedure TpsvCustomPHP.ClearBuffer;
-begin
-  FBuffer.Clear;
-end;
-
-procedure TpsvCustomPHP.ClearHeaders;
-begin
-  FHeaders.Clear;
-end;
-
-
-function TpsvCustomPHP.Execute : zend_ustr;
-var
-  file_handle : zend_file_handle;
-  {$IFDEF PHP4}
-  thread_id : cardinal;
-  {$ENDIF}
-  {$IFDEF PHP5}
-  ZendStream : TZendStream;
-  {$ENDIF}
-begin
-
-  if not EngineActive then
-   begin
-     Result := '';
-     Exit;
-   end;
-
-   if PHPEngine.WaitForShutdown then
-    begin
-      Result := '';
-      Exit;
-    end;
-
-  PHPEngine.AddRequest;
-
-  try
-    ClearHeaders;
-    ClearBuffer;
-
-    if Assigned(FBeforeExecute) then
-     FBeforeExecute(Self);
-
-
-
-    FTerminated := false;
-    if not FUseMapping then
-     begin
-      if not FileExists(FFileName) then
-        raise Exception.CreateFmt('File %s does not exists', [FFileName]);
-     end;
-    StartupRequest;
-
-    ZeroMemory(@file_handle, sizeof(zend_file_handle));
-
-    if FUseMapping then
-     begin
-       {$IFDEF PHP5}
-       ZeroMemory(@ZendStream, sizeof(ZendStream));
-       ZendStream.reader := delphi_stream_reader;
-       ZendStream.closer := delphi_stream_closer;
-         {$IFDEF PHP530}
-            ZendStream.fsizer := delphi_stream_fsizer;
-          {$ELSE}
-            {$IFDEF PHP510}
-             ZendStream.fteller := delphi_stream_teller;
-            {$ENDIF}
-            ZendStream.interactive := 0;
-          {$ENDIF}
-       ZendStream.handle := FVirtualStream;
-
-       file_handle._type := ZEND_HANDLE_STREAM;
-       file_handle.opened_path := nil;
-       file_handle.filename := '-';
-       file_handle.free_filename := 0;
-       file_handle.handle.stream := ZendStream;
-       {$ELSE}
-       {for PHP4 only}
-       file_handle._type := ZEND_HANDLE_FD;
-       file_handle.opened_path := nil;
-       file_handle.filename := '-';
-       file_handle.free_filename := 0;
-       file_handle.handle.fd := FVirtualReadHandle;
-       FWriterHandle := BeginThread(nil, 8192, @WriterProc, Self, 0, thread_id);
-       {$ENDIF}
-     end
-      else
-       begin
-         file_handle._type := ZEND_HANDLE_FILENAME;
-         file_handle.filename := zend_pchar(FFileName);
-         file_handle.opened_path := nil;
-         file_handle.free_filename := 0;
-       end;
-
-    try
-    begin
-        PHPAPI.php_execute_script(@file_handle, TSRMLS_D);
-    end
-    except
-      FBuffer.Clear;
-      try
-      ts_free_thread;
-      except
-
-      end;
-    end;
-
-    PrepareResult;
-
-
-    if Assigned(FAfterExecute) then
-     FAfterExecute(Self);
-
-   //ShutdownRequest;
-
-    FBuffer.Position := 0;
-    if Assigned(FOnReadResult) then
-     begin
-       FOnReadResult(Self, FBuffer);
-       Result := '';
-     end
-       else
-         begin
-           SetLength(Result, FBuffer.Size);
-           FBuffer.Read(Result[1], FBuffer.Size);
-         end;
-    FBuffer.Clear;
-    {$IFDEF PHP4}
-    FVirtualCode := '';
-    {$ENDIF}
-  finally
-    PHPEngine.RemoveRequest;
-  end;
-end;
-
-function TpsvCustomPHP.RunCode(Acode : zend_ustr) : zend_ustr;
-begin
-  if not EngineActive then
-   begin
-     Result := '';
-     Exit;
-   end;
-
-  ClearHeaders;
-  ClearBuffer;
-  FUseMapping := true;
-
-  try
-   if FUseDelimiters then
-    begin
-      if Pos('<?', ACode) = 0 then
-        ACode := Format('<? %s ?>', [ACode]);
-    end;
-    if not CreateVirtualFile(ACode) then
-      begin
-        Result := '';
-        Exit;
-      end;
-     Result := Execute;
-     finally
-       FUseMapping := false;
-     end;
-end;
-
-
-function TpsvCustomPHP.RunCode(ACode: TStrings): string;
-begin
-  if Assigned(ACode) then
-   Result := RunCode(ACode.Text);
-end;
-
-
-procedure TpsvCustomPHP.SetVariables(Value: TPHPVariables);
-begin
-  FVariables.Assign(Value);
-end;
-
-procedure TpsvCustomPHP.SetHeaders(Value : TPHPHeaders);
-begin
-  FHeaders.Assign(Value);
-end;
-
-
-
-function TpsvCustomPHP.Execute(AFileName: zend_ustr): zend_ustr;
-begin
-  FFileName := AFileName;
-  Result := Execute;
-end;
-
-procedure TpsvCustomPHP.PrepareResult;
-var
-  ht  : {$IFDEF PHP7}Pzend_array{$ELSE}PHashTable{$ENDIF};
-  data: ^ppzval;
-  cnt : integer;
-  variable : pzval;
-begin
-  if FVariables.Count = 0 then
-   Exit;
-
-  if FExecuteMethod = emServer then
-   ht := GetSymbolsTable
-    else
-     ht := GetTrackHash('_GET');
-  if Assigned(ht) then
-   begin
-     for cnt := 0 to FVariables.Count - 1  do
-      begin
-        new(data);
-        try
-          if zend_hash_find(ht, zend_pchar(FVariables[cnt].Name),
-          strlen(zend_pchar(FVariables[cnt].Name)) + 1, data) = SUCCESS then
-          begin
-            variable := data^^;
-            convert_to_string(variable);
-            FVariables[cnt].Value := Z_STRVAL(variable);
-          end;
-        finally
-          freemem(data);
-        end;
-      end;
-   end;
-end;
-
-function TpsvCustomPHP.VariableByName(AName: zend_ustr): TPHPVariable;
-begin
-  Result := FVariables.ByName(AName);
-end;
-
-{Indicates activity of PHP Engine}
-function TpsvCustomPHP.EngineActive : boolean;
-begin
-  if Assigned(PHPEngine) then
-   Result := PHPEngine.EngineActive
-    else
-      Result := false;
-end;
-
-procedure TpsvCustomPHP.StartupRequest;
-var
- gl  : psapi_globals_struct;
- TimeStr : string;
-begin
-  if not EngineActive then
-   raise EDelphiErrorEx.Create('PHP engine is not active ');
-
-  if FSessionActive then
-   Exit;
-
-  TSRMLS_D := tsrmls_fetch;
-
-  gl := GetSAPIGlobals;
-  gl^.server_context := Self;
-  //ShowMessage('TpsvCustomPHP.StartupRequest -- RegisterGlobals');
-  if PHPEngine.RegisterGlobals then
-   GetPHPGlobals(TSRMLS_D)^.register_globals := true;
-  //ShowMessage('TpsvCustomPHP.StartupRequest -- Try');
-  try
-  //ShowMessage('TpsvCustomPHP.StartupRequest -- FOnReadPost');
-    if Assigned(FOnReadPost) then
-     FOnReadPost(Self, FPostStream);
-   //ShowMessage('TpsvCustomPHP.StartupRequest -- zend_alter_ini_entry');
-    zend_alter_ini_entry('max_execution_time', 19, zend_pchar(TimeStr), Length(TimeStr), ZEND_INI_SYSTEM, ZEND_INI_STAGE_RUNTIME);
-   //ShowMessage('TpsvCustomPHP.StartupRequest -- php_request_startup');
-    php_request_startup(TSRMLS_D);
-   //ShowMessage('TpsvCustomPHP.StartupRequest -- FOnRequestStartup');
-    if Assigned(FOnRequestStartup) then
-      FOnRequestStartup(Self);
-    //ShowMessage('TpsvCustomPHP.StartupRequest --');
-    FSessionActive := true;
-  except
-    FSessionActive := false;
-  end;
-end;
-
-function TpsvCustomPHP.RunTime: boolean;
-begin
-  Result :=   not (csDesigning in ComponentState);
-end;
-
-function TpsvCustomPHP.GetThreadSafeResourceManager: pointer;
-begin
-  Result := TSRMLS_D;
-end;
-
-function TpsvCustomPHP.GetVariableCount: integer;
-begin
-  Result := FVariables.Count;
-end;
-
-
-procedure TpsvCustomPHP.ShutdownRequest;
-var
- gl  : psapi_globals_struct;
-begin
-  if not FSessionActive then
-   Exit;
-  try
-
-    if not FTerminated then
-     begin
-       try
-        php_request_shutdown(nil);
-       except
-       end;
-       gl := GetSAPIGlobals;
-       gl^.server_context := nil;
-     end;
-
-
-    if Assigned(FOnRequestShutdown) then
-      FOnRequestShutdown(Self);
-
-  finally
-    FSessionActive := false;
-  end;
-
-end;
-
-procedure TpsvCustomPHP.PrepareVariables;
-var
-  ht  : {$IFDEF PHP7}Pzend_array{$ELSE}PHashTable{$ENDIF};
-  data: ^ppzval;
-  cnt : integer;
-  {$IFDEF PHP5}
-  EG : pzend_executor_globals;
-  {$ENDIF}
-begin
-  {$IFDEF PHP4}
-   ht := GetSymbolsTable;
-  {$ELSE}
-    begin
-     EG := GetExecutorGlobals;
-     if Assigned(EG) then
-     ht := @EG.symbol_table
-      else
-        ht := nil;
-    end;
-  {$ENDIF}
-
-  if Assigned(ht) then
-   begin
-     for cnt := 0 to FVariables.Count - 1  do
-      begin
-        new(data);
-        try
-          if zend_hash_find(ht, zend_pchar(FVariables[cnt].Name),
-          strlen(zend_pchar(FVariables[cnt].Name)) + 1, data) = SUCCESS then
-          begin
-          {$IFDEF PHP7}
-          if (data^^^.u1.v._type = IS_STRING) then
-          {$ELSE}
-            if (data^^^._type = IS_STRING) then
-          {$ENDIF}
-             begin
-               efree(data^^^.value.str.val);
-               ZVAL_STRING(data^^, zend_pchar(FVariables[cnt].Value), true);
-             end
-               else
-                 begin
-                   ZVAL_STRING(data^^, zend_pchar(FVariables[cnt].Value), true);
-                 end;
-          end;
-        finally
-          freemem(data);
-        end;
-      end;
-   end;
-end;
-
-procedure TpsvCustomPHP.CloseVirtualFile;
-begin
-  {$IFDEF PHP4}
-  if FWriterHandle <> 0 then
-   begin
-     WaitForSingleObject(FWriterHandle, INFINITE);
-     CloseHandle(FWriterHandle);
-     FWriterHandle := 0;
-   end;
-  {$ELSE}
-  FVirtualStream.Clear;
-  {$ENDIF}
-end;
-
-function TpsvCustomPHP.CreateVirtualFile(A_code : zend_ustr): boolean;
-var
-{$IFDEF PHP4}
-_handles : array[0..1] of THandle;
-{$ENDIF}
-sc:PUTF8Char;
-begin
-
-  Result := false;
-  {$IFDEF PHP4}
-  if ACode = '' then
-   begin
-     FVirtualReadHandle := 0;
-     FVirtualWriteHandle := 0;
-     Exit; {empty buffer was provided}
-   end;
-
-  FVirtualCode := A_code;
-
-  if pipe(@_handles, 4096, 0) = -1 then
-   begin
-     FVirtualReadHandle := 0;
-     FVirtualWriteHandle := 0;
-     FVirtualCode := '';
-     Exit;
-   end;
-
-  FVirtualReadHandle := _handles[0];
-  FVirtualWriteHandle := _handles[1];
-  Result := true;
-  {$ELSE}
-  if A_code = '' then
-   Exit;
-   try
-    FVirtualStream.Clear;
-    FVirtualStream.WriteString(A_code);
-    FVirtualStream.Seek(0, TSeekOrigin.soBeginning);
+end;
+{$ENDIF}
+{ Request sender/dispatcher }
+
+{$IFDEF PHP510}
+procedure DispatchRequest(ht : integer; return_value : pzval; return_value_ptr : ppzval; this_ptr : pzval;
+      return_value_used : integer; TSRMLS_DC : pointer); cdecl;
+{$ELSE}
+procedure DispatchRequest(ht : integer; return_value : pzval; this_ptr : pzval;
+      return_value_used : integer; TSRMLS_DC : pointer); cdecl;
+{$ENDIF}
+var
+ php : TpsvPHP;
+ gl : psapi_globals_struct;
+ Lib : IPHPEngine;
+{$IFNDEF PHP510}
+ return_value_ptr : ppzval;
+{$ENDIF}
+begin
+  {$IFNDEF PHP510}
+  return_value_ptr := nil;
+  {$ENDIF}
+  ZVALVAL(return_value);
+  gl := GetSAPIGlobals;
+  if gl = nil then
+   Exit;
+  php := TpsvPHP(gl^.server_context);
+  if Assigned(php) then
+   begin
+     try
+       Lib := php.GetEngine;
+       if lib <> nil then
+       Lib.HandleRequest(ht, return_value, return_value_ptr, this_ptr, return_value_used, TSRMLS_DC);
+     except
+      ZVALVAL(return_value);
+     end;
+   end;
+end;
+
+{ TpsvCustomPHP }
+
+constructor TpsvCustomPHP.Create(AOwner: TComponent);
+begin
+  inherited;
+  FMaxExecutionTime := 0;
+  FExecuteMethod := emServer;
+  FSessionActive := false;
+  FVariables := TPHPVariables.Create(Self);
+  FHeaders := TPHPHeaders.Create(Self);
+  FUseDelimiters := true;
+  FRequestType := prtGet;
+  FBuffer := TPHPMemoryStream.Create;
+  {$IFDEF PHP4}
+  FVirtualCode := '';
+  {$ELSE}
+  FVirtualStream := TStringStream.Create;
+  {$ENDIF}
+end;
+
+destructor TpsvCustomPHP.Destroy;
+begin
+  FVariables.Free;
+  FHeaders.Free;
+  FSessionActive := False;
+  FBuffer.Free;
+  {$IFDEF PHP4}
+  FVirtualCode := '';
+  {$ELSE}
+  if FVirtualStream <> nil then
+   FreeAndNil(FVirtualStream);
+  {$ENDIF}
+  if Assigned(FPostStream) then
+   FreeAndNil(FPostStream);
+  inherited;
+end;
+
+procedure TpsvCustomPHP.ClearBuffer;
+begin
+  FBuffer.Clear;
+end;
+
+procedure TpsvCustomPHP.ClearHeaders;
+begin
+  FHeaders.Clear;
+end;
+
+
+function TpsvCustomPHP.Execute : zend_ustr;
+var
+  file_handle : zend_file_handle;
+  {$IFDEF PHP4}
+  thread_id : cardinal;
+  {$ENDIF}
+  {$IFDEF PHP5}
+  ZendStream : TZendStream;
+  {$ENDIF}
+begin
+
+  if not EngineActive then
+   begin
+     Result := '';
+     Exit;
+   end;
+
+   if PHPEngine.WaitForShutdown then
+    begin
+      Result := '';
+      Exit;
+    end;
+
+  PHPEngine.AddRequest;
+
+  try
+    ClearHeaders;
+    ClearBuffer;
+
+    if Assigned(FBeforeExecute) then
+     FBeforeExecute(Self);
+
+
+
+    FTerminated := false;
+    if not FUseMapping then
+     begin
+      if not FileExists(FFileName) then
+        raise Exception.CreateFmt('File %s does not exists', [FFileName]);
+     end;
+    StartupRequest;
+
+    ZeroMemory(@file_handle, sizeof(zend_file_handle));
+
+    if FUseMapping then
+     begin
+       {$IFDEF PHP5}
+       ZeroMemory(@ZendStream, sizeof(ZendStream));
+       ZendStream.reader := delphi_stream_reader;
+       ZendStream.closer := delphi_stream_closer;
+         {$IFDEF PHP530}
+            ZendStream.fsizer := delphi_stream_fsizer;
+          {$ELSE}
+            {$IFDEF PHP510}
+             ZendStream.fteller := delphi_stream_teller;
+            {$ENDIF}
+            ZendStream.interactive := 0;
+          {$ENDIF}
+       ZendStream.handle := FVirtualStream;
+
+       file_handle._type := ZEND_HANDLE_STREAM;
+       file_handle.opened_path := nil;
+       file_handle.filename := '-';
+       file_handle.free_filename := 0;
+       file_handle.handle.stream := ZendStream;
+       {$ELSE}
+       {for PHP4 only}
+       file_handle._type := ZEND_HANDLE_FD;
+       file_handle.opened_path := nil;
+       file_handle.filename := '-';
+       file_handle.free_filename := 0;
+       file_handle.handle.fd := FVirtualReadHandle;
+       FWriterHandle := BeginThread(nil, 8192, @WriterProc, Self, 0, thread_id);
+       {$ENDIF}
+     end
+      else
+       begin
+         file_handle._type := ZEND_HANDLE_FILENAME;
+         file_handle.filename := zend_pchar(FFileName);
+         file_handle.opened_path := nil;
+         file_handle.free_filename := 0;
+       end;
+
+    try
+    begin
+        PHPAPI.php_execute_script(@file_handle, TSRMLS_D);
+    end
+    except
+      FBuffer.Clear;
+      try
+      ts_free_thread;
+      except
+
+      end;
+    end;
+
+    PrepareResult;
+
+
+    if Assigned(FAfterExecute) then
+     FAfterExecute(Self);
+
+   //ShutdownRequest;
+
+    FBuffer.Position := 0;
+    if Assigned(FOnReadResult) then
+     begin
+       FOnReadResult(Self, FBuffer);
+       Result := '';
+     end
+       else
+         begin
+           SetLength(Result, FBuffer.Size);
+           FBuffer.Read(Result[1], FBuffer.Size);
+         end;
+    FBuffer.Clear;
+    {$IFDEF PHP4}
+    FVirtualCode := '';
+    {$ENDIF}
+  finally
+    PHPEngine.RemoveRequest;
+  end;
+end;
+
+function TpsvCustomPHP.RunCode(Acode : zend_ustr) : zend_ustr;
+begin
+  if not EngineActive then
+   begin
+     Result := '';
+     Exit;
+   end;
+
+  ClearHeaders;
+  ClearBuffer;
+  FUseMapping := true;
+
+  try
+   if FUseDelimiters then
+    begin
+      if Pos('<?', ACode) = 0 then
+        ACode := Format('<? %s ?>', [ACode]);
+    end;
+    if not CreateVirtualFile(ACode) then
+      begin
+        Result := '';
+        Exit;
+      end;
+     Result := Execute;
+     finally
+       FUseMapping := false;
+     end;
+end;
+
+
+function TpsvCustomPHP.RunCode(ACode: TStrings): string;
+begin
+  if Assigned(ACode) then
+   Result := RunCode(ACode.Text);
+end;
+
+
+procedure TpsvCustomPHP.SetVariables(Value: TPHPVariables);
+begin
+  FVariables.Assign(Value);
+end;
+
+procedure TpsvCustomPHP.SetHeaders(Value : TPHPHeaders);
+begin
+  FHeaders.Assign(Value);
+end;
+
+
+
+function TpsvCustomPHP.Execute(AFileName: zend_ustr): zend_ustr;
+begin
+  FFileName := AFileName;
+  Result := Execute;
+end;
+
+procedure TpsvCustomPHP.PrepareResult;
+var
+  ht  : {$IFDEF PHP7}Pzend_array{$ELSE}PHashTable{$ENDIF};
+  data: ^ppzval;
+  cnt : integer;
+  variable : pzval;
+begin
+  if FVariables.Count = 0 then
+   Exit;
+
+  if FExecuteMethod = emServer then
+   ht := GetSymbolsTable
+    else
+     ht := GetTrackHash('_GET');
+  if Assigned(ht) then
+   begin
+     for cnt := 0 to FVariables.Count - 1  do
+      begin
+        new(data);
+        try
+          if zend_hash_find(ht, zend_pchar(FVariables[cnt].Name),
+          strlen(zend_pchar(FVariables[cnt].Name)) + 1, data) = SUCCESS then
+          begin
+            variable := data^^;
+            convert_to_string(variable);
+            FVariables[cnt].Value := Z_STRVAL(variable);
+          end;
+        finally
+          freemem(data);
+        end;
+      end;
+   end;
+end;
+
+function TpsvCustomPHP.VariableByName(AName: zend_ustr): TPHPVariable;
+begin
+  Result := FVariables.ByName(AName);
+end;
+
+{Indicates activity of PHP Engine}
+function TpsvCustomPHP.EngineActive : boolean;
+begin
+  if Assigned(PHPEngine) then
+   Result := PHPEngine.EngineActive
+    else
+      Result := false;
+end;
+
+procedure TpsvCustomPHP.StartupRequest;
+var
+ gl  : psapi_globals_struct;
+ TimeStr : string;
+begin
+  if not EngineActive then
+   raise EDelphiErrorEx.Create('PHP engine is not active ');
+
+  if FSessionActive then
+   Exit;
+
+  TSRMLS_D := tsrmls_fetch;
+
+  gl := GetSAPIGlobals;
+  gl^.server_context := Self;
+  //ShowMessage('TpsvCustomPHP.StartupRequest -- RegisterGlobals');
+  if PHPEngine.RegisterGlobals then
+   GetPHPGlobals(TSRMLS_D)^.register_globals := true;
+  //ShowMessage('TpsvCustomPHP.StartupRequest -- Try');
+  try
+  //ShowMessage('TpsvCustomPHP.StartupRequest -- FOnReadPost');
+    if Assigned(FOnReadPost) then
+     FOnReadPost(Self, FPostStream);
+   //ShowMessage('TpsvCustomPHP.StartupRequest -- zend_alter_ini_entry');
+    zend_alter_ini_entry('max_execution_time', 19, zend_pchar(TimeStr), Length(TimeStr), ZEND_INI_SYSTEM, ZEND_INI_STAGE_RUNTIME);
+   //ShowMessage('TpsvCustomPHP.StartupRequest -- php_request_startup');
+    php_request_startup(TSRMLS_D);
+   //ShowMessage('TpsvCustomPHP.StartupRequest -- FOnRequestStartup');
+    if Assigned(FOnRequestStartup) then
+      FOnRequestStartup(Self);
+    //ShowMessage('TpsvCustomPHP.StartupRequest --');
+    FSessionActive := true;
+  except
+    FSessionActive := false;
+  end;
+end;
+
+function TpsvCustomPHP.RunTime: boolean;
+begin
+  Result :=   not (csDesigning in ComponentState);
+end;
+
+function TpsvCustomPHP.GetThreadSafeResourceManager: pointer;
+begin
+  Result := TSRMLS_D;
+end;
+
+function TpsvCustomPHP.GetVariableCount: integer;
+begin
+  Result := FVariables.Count;
+end;
+
+
+procedure TpsvCustomPHP.ShutdownRequest;
+var
+ gl  : psapi_globals_struct;
+begin
+  if not FSessionActive then
+   Exit;
+  try
+
+    if not FTerminated then
+     begin
+       try
+        php_request_shutdown(nil);
+       except
+       end;
+       gl := GetSAPIGlobals;
+       gl^.server_context := nil;
+     end;
+
+
+    if Assigned(FOnRequestShutdown) then
+      FOnRequestShutdown(Self);
+
+  finally
+    FSessionActive := false;
+  end;
+
+end;
+
+procedure TpsvCustomPHP.PrepareVariables;
+var
+  ht  : {$IFDEF PHP7}Pzend_array{$ELSE}PHashTable{$ENDIF};
+  data: ^ppzval;
+  cnt : integer;
+  {$IFDEF PHP5}
+  EG : pzend_executor_globals;
+  {$ENDIF}
+begin
+  {$IFDEF PHP4}
+   ht := GetSymbolsTable;
+  {$ELSE}
+    begin
+     EG := GetExecutorGlobals;
+     if Assigned(EG) then
+     ht := @EG.symbol_table
+      else
+        ht := nil;
+    end;
+  {$ENDIF}
+
+  if Assigned(ht) then
+   begin
+     for cnt := 0 to FVariables.Count - 1  do
+      begin
+        new(data);
+        try
+          if zend_hash_find(ht, zend_pchar(FVariables[cnt].Name),
+          strlen(zend_pchar(FVariables[cnt].Name)) + 1, data) = SUCCESS then
+          begin
+          {$IFDEF PHP7}
+          if (data^^^.u1.v._type = IS_STRING) then
+          {$ELSE}
+            if (data^^^._type = IS_STRING) then
+          {$ENDIF}
+             begin
+               efree(data^^^.value.str.val);
+               ZVAL_STRING(data^^, zend_pchar(FVariables[cnt].Value), true);
+             end
+               else
+                 begin
+                   ZVAL_STRING(data^^, zend_pchar(FVariables[cnt].Value), true);
+                 end;
+          end;
+        finally
+          freemem(data);
+        end;
+      end;
+   end;
+end;
+
+procedure TpsvCustomPHP.CloseVirtualFile;
+begin
+  {$IFDEF PHP4}
+  if FWriterHandle <> 0 then
+   begin
+     WaitForSingleObject(FWriterHandle, INFINITE);
+     CloseHandle(FWriterHandle);
+     FWriterHandle := 0;
+   end;
+  {$ELSE}
+  FVirtualStream.Clear;
+  {$ENDIF}
+end;
+
+function TpsvCustomPHP.CreateVirtualFile(A_code : zend_ustr): boolean;
+var
+{$IFDEF PHP4}
+_handles : array[0..1] of THandle;
+{$ENDIF}
+sc:PUTF8Char;
+begin
+
+  Result := false;
+  {$IFDEF PHP4}
+  if ACode = '' then
+   begin
+     FVirtualReadHandle := 0;
+     FVirtualWriteHandle := 0;
+     Exit; {empty buffer was provided}
+   end;
+
+  FVirtualCode := A_code;
+
+  if pipe(@_handles, 4096, 0) = -1 then
+   begin
+     FVirtualReadHandle := 0;
+     FVirtualWriteHandle := 0;
+     FVirtualCode := '';
+     Exit;
+   end;
+
+  FVirtualReadHandle := _handles[0];
+  FVirtualWriteHandle := _handles[1];
+  Result := true;
+  {$ELSE}
+  if A_code = '' then
+   Exit;
+   try
+    FVirtualStream.Clear;
+    FVirtualStream.WriteString(A_code);
+    FVirtualStream.Seek(0, TSeekOrigin.soBeginning);
    finally
     Result := True;
-   end;
-  {$ENDIF}
-end;
-
-
-function TpsvCustomPHP.GetEngine: IPHPEngine;
-begin
-  Result := PHPEngine;
-end;
-
-{ TPHPEngine }
-
-
-constructor TPHPEngine.Create(AOwner: TComponent);
-begin
-  inherited;
-  if Assigned(PHPEngine) then
-   raise Exception.Create('Only one instance of PHP engine per application');
-  FEngineActive := false;
-  FHandleErrors := true;
-  {$IFNDEF PHP540}
-  FSafeMode := false;
-  FSafeModeGid := false;
-  {$ENDIF}
-  FRegisterGlobals := true;
-  FHTMLErrors := false;
-  FMaxInputTime := 0;
-  FWaitForShutdown := false;
-  FConstants := TPHPConstants.Create(Self);
-  FRequestCount := 0;
-  FHash := TStringList.Create;
-  FHash.Duplicates := dupError;
-  FHash.Sorted := true;
-  InitializeCriticalSection(FLock);
-  PHPEngine := Self;
-
-end;
-
-destructor TPHPEngine.Destroy;
-begin
-  ShutdownAndWaitFor;
-  FEngineActive := false;
-  FConstants.Free;
-  FHash.Free;
-  DeleteCriticalSection(FLock);
-  if (PHPEngine = Self) then
-   PHPEngine := nil;
-  inherited;
-  if PHPLoaded then
-     UnloadPHP;
-end;
-
-function TPHPEngine.GetConstantCount: integer;
-begin
-  Result := FConstants.Count;
-end;
-{
-procedure log(i:String);
-var f:TextFile;
-begin
+   end;
+  {$ENDIF}
+end;
+
+
+function TpsvCustomPHP.GetEngine: IPHPEngine;
+begin
+  Result := PHPEngine;
+end;
+
+{ TPHPEngine }
+
+
+constructor TPHPEngine.Create(AOwner: TComponent);
+begin
+  inherited;
+  if Assigned(PHPEngine) then
+   raise Exception.Create('Only one instance of PHP engine per application');
+  FEngineActive := false;
+  FHandleErrors := true;
+  {$IFNDEF PHP540}
+  FSafeMode := false;
+  FSafeModeGid := false;
+  {$ENDIF}
+  FRegisterGlobals := true;
+  FHTMLErrors := false;
+  FMaxInputTime := 0;
+  FWaitForShutdown := false;
+  FConstants := TPHPConstants.Create(Self);
+  FRequestCount := 0;
+  FHash := TStringList.Create;
+  FHash.Duplicates := dupError;
+  FHash.Sorted := true;
+  InitializeCriticalSection(FLock);
+  PHPEngine := Self;
+
+end;
+
+destructor TPHPEngine.Destroy;
+begin
+  ShutdownAndWaitFor;
+  FEngineActive := false;
+  FConstants.Free;
+  FHash.Free;
+  DeleteCriticalSection(FLock);
+  if (PHPEngine = Self) then
+   PHPEngine := nil;
+  inherited;
+  if PHPLoaded then
+     UnloadPHP;
+end;
+
+function TPHPEngine.GetConstantCount: integer;
+begin
+  Result := FConstants.Count;
+end;
+{
+procedure log(i:String);
+var f:TextFile;
+begin
   AssignFile(f, 'log.txt');
   Append(f);
   Write(f, #10 + #13 + i);
   CloseFile(f);
-end;
-}
-procedure TPHPEngine.HandleRequest(ht: integer; return_value: pzval;
-  return_value_ptr: ppzval; this_ptr: pzval; return_value_used: integer;
-  TSRMLS_DC: pointer);
-
-var
-  Params : pzval_array;
-  AFunction : TPHPFunction;
-  j  : integer;
-  FActiveFunctionName : string;
-  FunctionIndex : integer;
-  FZendVar : TZendVariable;
-  FParameters : TFunctionParams;
-  ReturnValue : variant;
-begin
- FParameters := TFunctionParams.Create(nil, TFunctionParam);
-
-  if ht > 0 then
-   begin
-     if ( not (zend_get_parameters_my(ht, Params, TSRMLS_DC) = SUCCESS )) then
-      begin
-        zend_wrong_param_count(TSRMLS_DC);
-        Exit;
-      end;
-    end;
-
-  FActiveFunctionName := get_active_function_name(TSRMLS_DC);
-  if FHash.Find(FActiveFunctionName, FunctionIndex) then
-    AFunction := TPHPFunction(FHash.Objects[FunctionIndex])
-     else
-       AFunction := nil;
-
-   if Assigned(AFunction) then
-    begin
-      if AFunction.Collection = nil then
-       Exit; {library was destroyed}
-
-      if Assigned(AFunction.OnExecute) then
-        begin
-           if AFunction.Parameters.Count <> ht then
-             begin
-               zend_wrong_param_count(TSRMLS_DC);
-               Exit;
-             end;
-
-           FParameters.Assign(AFunction.Parameters);
-           if ht > 0 then
-             begin
-               for j := 0 to ht - 1 do
-                 begin
-                   if not IsParamTypeCorrect(FParameters[j].ParamType, Params[j]^) then
-                     begin
-                       zend_error(E_WARNING, zend_pchar(
-                       {$IFDEF PHP_UNICODE}Format{$ELSE}AnsiFormat{$ENDIF}
-                       ('Wrong parameter type for %s()', [FActiveFunctionName])));
-                       Exit;
-                     end;
-                   FParameters[j].ZendValue := (Params[j]^);
-                 end;
-             end; { if ht > 0}
-          //log(FActiveFunctionName);
-          FZendVar := TZendVariable.Create;
-           FZendVar.AsZendVariable := return_value;
-           AFunction.OnExecute(Self, FParameters, ReturnValue, FZendVar, TSRMLS_DC);
-           if Assigned(FZendVar) then
-           begin
-             if FZendVar.ISNull then   {perform variant conversion}
-               VariantToZend(ReturnValue, return_value);
-              FZendVar.Free;
-           end
-           else
-              VariantToZend(ReturnValue, return_value);
-      end; {if assigned AFunction.OnExecute}
-    end;
-    FParameters.Free;
-    dispose_pzval_array(Params);
-end;
-
-procedure TPHPEngine.PrepareIniEntry;
-var
-  p, p2   : pointer;
-  TimeStr : string;
-begin
-  if not PHPLoaded then
-   Exit;
-
-   if FHandleErrors then
-   begin
-     HFunc(@delphi_error_cb, 'zend_error_cb');
-   end;
-    {$IFNDEF PHP540}
-  if FSafeMode then
-   zend_alter_ini_entry('safe_mode', 10, '1', 1, PHP_INI_SYSTEM, PHP_INI_STAGE_STARTUP)
-    else
-    {$ENDIF}
-      zend_alter_ini_entry('safe_mode', 10, '0', 1, PHP_INI_SYSTEM, PHP_INI_STAGE_STARTUP);
-     {$IFNDEF PHP540}
-  if FSafeModeGID then
-   zend_alter_ini_entry('safe_mode_gid', 14, '1', 1, PHP_INI_SYSTEM, PHP_INI_STAGE_STARTUP)
-    else
-    {$ENDIF}
-      zend_alter_ini_entry('safe_mode_gid', 14, '0', 1, PHP_INI_SYSTEM, PHP_INI_STAGE_STARTUP);
-
-  zend_alter_ini_entry('register_argc_argv', 19, '0', 1, ZEND_INI_SYSTEM, ZEND_INI_STAGE_ACTIVATE);
-
-  if FRegisterGlobals then
-    zend_alter_ini_entry('register_globals',   17, '1', 1, ZEND_INI_SYSTEM, ZEND_INI_STAGE_ACTIVATE)
-      else
-        zend_alter_ini_entry('register_globals',   17, '0', 1, ZEND_INI_SYSTEM, ZEND_INI_STAGE_ACTIVATE);
-
-  if FHTMLErrors then
-   zend_alter_ini_entry('html_errors',        12, '1', 1, ZEND_INI_SYSTEM, ZEND_INI_STAGE_ACTIVATE)
-     else
-       zend_alter_ini_entry('html_errors',        12, '0', 1, ZEND_INI_SYSTEM, ZEND_INI_STAGE_ACTIVATE);
-
-  zend_alter_ini_entry('implicit_flush',     15, '1', 1, ZEND_INI_SYSTEM, ZEND_INI_STAGE_ACTIVATE);
- TimeStr := IntToStr(FMaxInputTime);
-  zend_alter_ini_entry('max_input_time', 15, zend_pchar(TimeStr), Length(TimeStr), ZEND_INI_SYSTEM, ZEND_INI_STAGE_ACTIVATE);
-end;
-
-procedure TPHPEngine.PrepareEngine;
-begin
-  delphi_sapi_module.name := 'embed';  {to solve a problem with dl()}
-  delphi_sapi_module.pretty_name := 'PHP for Delphi';
-  delphi_sapi_module.startup := php_delphi_startup;
-  delphi_sapi_module.shutdown := nil; //php_module_shutdown_wrapper;
-  delphi_sapi_module.activate:= nil;
-  delphi_sapi_module.deactivate := @php_delphi_deactivate;
-  delphi_sapi_module.ub_write := @php_delphi_ub_write;
-  delphi_sapi_module.flush := @php_delphi_flush;
-  delphi_sapi_module.stat:= nil;
-  delphi_sapi_module.getenv:= nil;
-  delphi_sapi_module.sapi_error := @zend_error;
-  delphi_sapi_module.header_handler := @php_delphi_header_handler;
-  delphi_sapi_module.send_headers := nil;
-  delphi_sapi_module.send_header := @php_delphi_send_header;
-  delphi_sapi_module.read_post := @php_delphi_read_post;
-  delphi_sapi_module.read_cookies := @php_delphi_read_cookies;
-  delphi_sapi_module.register_server_variables := @php_delphi_register_variables;
-  delphi_sapi_module.log_message := @php_delphi_log_message;
-  if FIniPath <> '' then
-     delphi_sapi_module.php_ini_path_override := zend_pchar(FIniPath)
-  else
-     delphi_sapi_module.php_ini_path_override :=  nil;
-  delphi_sapi_module.block_interruptions := nil;
-  delphi_sapi_module.unblock_interruptions := nil;
-  delphi_sapi_module.default_post_reader := nil;
-  delphi_sapi_module.treat_data := nil;
-  delphi_sapi_module.executable_location := nil;
-  delphi_sapi_module.php_ini_ignore := 0;
-
-  FLibraryModule.size := sizeOf(Tzend_module_entry);
-  FLibraryModule.zend_api := ZEND_MODULE_API_NO;
-  {$IFDEF PHP_DEBUG}
-  FLibraryModule.zend_debug := 1;
-  {$ELSE}
-  FLibraryModule.zend_debug := 0;
-  {$ENDIF}
-  FLibraryModule.zts := USING_ZTS;
-  FLibraryModule.name :=  'php4delphi_internal';
-  FLibraryModule.functions := nil;
-  FLibraryModule.module_startup_func := @minit;
-  FLibraryModule.module_shutdown_func := @mshutdown;
-  FLibraryModule.info_func := @php_info_library;
-
-  FLibraryModule.request_shutdown_func := @rshutdown;
-  FLibraryModule.request_startup_func := @rinit;
-
-  FLibraryModule.module_started := 0;
-  FLibraryModule._type := MODULE_PERSISTENT;
-
-  FLibraryModule.Handle := nil;
-  FLibraryModule.module_number := 0;
-  FLibraryModule.build_id := DupStr(zend_pchar(ZEND_MODULE_BUILD_ID));
-end;
-
-procedure TPHPEngine.RegisterConstants;
-var
- cnt : integer;
- ConstantName : zend_ustr;
- ConstantValue : zend_ustr;
-begin
-  for cnt := 0 to FConstants.Count - 1 do
-  begin
-    ConstantName  := FConstants[cnt].Name;
-    ConstantValue := FConstants[cnt].Value;
-    zend_register_string_constant(zend_pchar(ConstantName),
-      strlen(zend_pchar(ConstantName)) + 1,
-      zend_pchar(ConstantValue), CONST_PERSISTENT or CONST_CS, 0, TSRMLS_D);
-  end;
-  zend_register_bool_constant( zend_pchar('UTF8_SUPPORT'), 13, {$IFDEF PHP_UNICODE}TRUE{$ELSE}FALSE{$ENDIF},
-    CONST_PERSISTENT or CONST_CS, 0, TSRMLS_D);
-  RegisterInternalConstants(TSRMLS_D);
-end;
-
-procedure TPHPEngine.RegisterInternalConstants(TSRMLS_DC: pointer);
-{$IFDEF REGISTER_COLORS}
-var
- i : integer;
- ColorName : zend_ustr;
-{$ENDIF}
-begin
- {$IFDEF REGISTER_COLORS}
-  for I := Low(Colors) to High(Colors) do
-  begin
-   ColorName := zend_ustr(Colors[i].Name);
-   zend_register_long_constant( zend_pchar(ColorName), strlen(zend_pchar(ColorName)) + 1, Colors[i].Value,
-    CONST_PERSISTENT or CONST_CS, 0, TSRMLS_DC);
-  end;
- {$ENDIF}
-end;
-
-
-procedure TPHPEngine.SetConstants(Value: TPHPConstants);
-begin
-  FConstants.Assign(Value);
-end;
-
-procedure TPHPEngine.ShutdownEngine;
-begin
-
-  if PHPEngine <> Self then
-   raise EDelphiErrorEx.Create('Only active engine can be stopped');
-
-
-  if not FEngineActive then
-   Exit;
-
-  try
-
-   if @delphi_sapi_module.shutdown <> nil then
-    delphi_sapi_module.shutdown(@delphi_sapi_module);
-    sapi_shutdown;
-     {Shutdown PHP thread safe resource manager}
-     if Assigned(FOnEngineShutdown) then
-       FOnEngineShutdown(Self);
-    {$IF not Defined(PHP550) and not Defined(PHP560)}
-    try
-    tsrm_shutdown();
-    except
-
-    end;
-    {$ENDIF}
-    FHash.Clear;
-   finally
-     FEngineActive := false;
-     FWaitForShutdown := False;
-   end;
-end;
-
-procedure TPHPEngine.RegisterLibrary(ALib : TCustomPHPLibrary);
-var
- cnt : integer;
- skip : boolean;
- FN : zend_ustr;
-begin
-  skip := false;
-  ALib.Refresh;
-
-  {No functions defined, skip this library}
-  if ALib.Functions.Count = 0 then
-   Exit;
-
-  for cnt := 0 to ALib.Functions.Count - 1 do
-   begin
-      FN :=
-      {$IFDEF PHP_UNICODE}UTF8LowerCase{$ELSE}AnsiLowerCase{$ENDIF}
-      (ALib.Functions[cnt].FunctionName);
-      if FHash.IndexOf(FN) > -1 then
-      begin
-        skip := true;
-        break;
-      end;
-   end;
-
-  if not skip then
-   begin
-      for cnt := 0 to ALib.Functions.Count - 1 do
-       begin
-         FN := {$IFDEF PHP_UNICODE}UTF8LowerCase{$ELSE}AnsiLowerCase{$ENDIF}
-         (ALib.Functions[cnt].FunctionName);
-         FHash.AddObject(FN, ALib.Functions[cnt]);
-       end;
-      ALib.Locked := true;
-   end;
-end;
-
-procedure TPHPEngine.StartupEngine;
-var
- i : integer;
-  x: Pzend_module_entry;
-begin
-  if PHPEngine <> Self then
-   begin
-     raise EDelphiErrorEx.Create('Only one PHP engine can be activated');
-   end;
-
-   if FEngineActive then
-       raise EDelphiErrorEx.Create('PHP engine already active');
-
-     StartupPHP;
-     PrepareEngine;
-//     ini := GetExecutorGlobals.ini_directives;
-
-
-
-     if not PHPLoaded then //Peter Enz
-       begin
-         raise EDelphiErrorEx.Create('PHP engine is not loaded');
-       end;
-
-     try
-      FHash.Clear;
-
-      for i := 0 to Librarian.Count -1 do
-      begin
-         RegisterLibrary(Librarian.GetLibrary(I));
-      end;
-
-
-      //Start PHP thread safe resource manager
-      tsrm_startup(128, 1, 0 , nil);
-
-      sapi_startup(@delphi_sapi_module);
-
-      RefreshLibrary;
-
-      php_module_startup(@delphi_sapi_module, @FLibraryModule, 1);
-
-      TSRMLS_D := ts_resource_ex(0, nil);
-      if Length(FAddMods) > 0 then
-      for x in FAddMods do
-      begin
-        zend_register_module_ex(x, TSRMLS_D);
-        zend_startup_module_ex(x, TSRMLS_D);
-      end;
-
-
-      PrepareIniEntry;
-      RegisterConstants;
-
-      if Assigned(FOnEngineStartup) then
-       FOnEngineStartup(Self);
-
-      FEngineActive := true;
-      except
-       FEngineActive := false;
-      end;
-end;
-
-procedure TPHPEngine.StartupPHP;
-var
- DLLName : string;
-begin
-   if not PHPLoaded then
-    begin
-      if FDLLFolder <> '' then
-         DLLName := IncludeTrailingBackSlash(FDLLFolder) + PHPWin
-           else
-             DLLName := PHPWin;
-      LoadPHP(DLLName);
-      if FReportDLLError then
-       begin
-         if PHPLib = 0 then raise Exception.CreateFmt('%s not found', [DllName]);
-       end;
-    end;
-end;
-
-procedure TPHPEngine.LockEngine;
-begin
-  EnterCriticalSection(FLock);
-end;
-
-procedure TPHPEngine.UnlockEngine;
-begin
-  LeaveCriticalSection(FLock);
-end;
-
-procedure TPHPEngine.HandleError(Sender: TObject; AText: string;
-  AType: Integer; AFileName: string; ALineNo: integer);
-begin
-  LockEngine;
-  try
-    if Assigned(FOnScriptError) then
-
-
-       FOnScriptError(Sender, AText, AType, AFileName, ALineNo);
-      //ShowMessage( AText + #10#13 +  AType.ToString + #10#13 + AFileName + #10#13 + ALineNo.ToString );
-     // FOnScriptError(Sender, AText, AType, AFileName, ALineNo);
-  finally
-    UnlockEngine;
-  end;
-end;
-
-procedure TPHPEngine.HandleLogMessage(Sender: TObject; AText: string);
-begin
-  LockEngine;
-  try
-    if Assigned(FOnLogMessage) then
-     FOnLogMessage(Sender, AText);
-  finally
-    UnlockEngine;
-  end;
-end;
-
-procedure TPHPEngine.PrepareForShutdown;
-begin
-  LockEngine;
-  try
-   FWaitForShutdown := true;
-  finally
-    UnlockEngine;
-  end;
-end;
-
-procedure TPHPEngine.ShutdownAndWaitFor;
-var
- cnt : integer;
- AllClear : boolean;
-begin
-  PrepareForShutdown;
-
-  AllClear := false;
-  while not AllClear do
-   begin
-      cnt := FRequestCount;
-      if cnt <= 0 then
-        AllClear := true
-         else
-           Sleep(250);
-   end;
-  ShutdownEngine;
-end;
-
-function TPHPEngine.GetEngineActive: boolean;
-begin
-  Result := FEngineActive;
-end;
-
-procedure TPHPEngine.UnlockLibraries;
-var
- cnt : integer;
-begin
-  if Assigned(Librarian) then
-   begin
-     for cnt := 0 to Librarian.Count - 1 do
-      Librarian.GetLibrary(cnt).Locked := false;
-   end;
-end;
-
-procedure TPHPEngine.RemoveRequest;
+end;
+}
+procedure TPHPEngine.HandleRequest(ht: integer; return_value: pzval;
+  return_value_ptr: ppzval; this_ptr: pzval; return_value_used: integer;
+  TSRMLS_DC: pointer);
+
+var
+  Params : pzval_array;
+  AFunction : TPHPFunction;
+  j  : integer;
+  FActiveFunctionName : string;
+  FunctionIndex : integer;
+  FZendVar : TZendVariable;
+  FParameters : TFunctionParams;
+  ReturnValue : variant;
+begin
+ FParameters := TFunctionParams.Create(nil, TFunctionParam);
+
+  if ht > 0 then
+   begin
+     if ( not (zend_get_parameters_my(ht, Params, TSRMLS_DC) = SUCCESS )) then
+      begin
+        zend_wrong_param_count(TSRMLS_DC);
+        Exit;
+      end;
+    end;
+
+  FActiveFunctionName := get_active_function_name(TSRMLS_DC);
+  if FHash.Find(FActiveFunctionName, FunctionIndex) then
+    AFunction := TPHPFunction(FHash.Objects[FunctionIndex])
+     else
+       AFunction := nil;
+
+   if Assigned(AFunction) then
+    begin
+      if AFunction.Collection = nil then
+       Exit; {library was destroyed}
+
+      if Assigned(AFunction.OnExecute) then
+        begin
+           if AFunction.Parameters.Count <> ht then
+             begin
+               zend_wrong_param_count(TSRMLS_DC);
+               Exit;
+             end;
+
+           FParameters.Assign(AFunction.Parameters);
+           if ht > 0 then
+             begin
+               for j := 0 to ht - 1 do
+                 begin
+                   if not IsParamTypeCorrect(FParameters[j].ParamType, Params[j]^) then
+                     begin
+                       zend_error(E_WARNING, zend_pchar(
+                       {$IFDEF PHP_UNICODE}Format{$ELSE}AnsiFormat{$ENDIF}
+                       ('Wrong parameter type for %s()', [FActiveFunctionName])));
+                       Exit;
+                     end;
+                   FParameters[j].ZendValue := (Params[j]^);
+                 end;
+             end; { if ht > 0}
+          //log(FActiveFunctionName);
+          FZendVar := TZendVariable.Create;
+           FZendVar.AsZendVariable := return_value;
+           AFunction.OnExecute(Self, FParameters, ReturnValue, FZendVar, TSRMLS_DC);
+           if Assigned(FZendVar) then
+           begin
+             if FZendVar.ISNull then   {perform variant conversion}
+               VariantToZend(ReturnValue, return_value);
+              FZendVar.Free;
+           end
+           else
+              VariantToZend(ReturnValue, return_value);
+      end; {if assigned AFunction.OnExecute}
+    end;
+    FParameters.Free;
+    dispose_pzval_array(Params);
+end;
+
+procedure TPHPEngine.PrepareIniEntry;
+var
+  p, p2   : pointer;
+  TimeStr : string;
+begin
+  if not PHPLoaded then
+   Exit;
+
+   if FHandleErrors then
+   begin
+     HFunc(@delphi_error_cb, 'zend_error_cb');
+   end;
+    {$IFNDEF PHP540}
+  if FSafeMode then
+   zend_alter_ini_entry('safe_mode', 10, '1', 1, PHP_INI_SYSTEM, PHP_INI_STAGE_STARTUP)
+    else
+    {$ENDIF}
+      zend_alter_ini_entry('safe_mode', 10, '0', 1, PHP_INI_SYSTEM, PHP_INI_STAGE_STARTUP);
+     {$IFNDEF PHP540}
+  if FSafeModeGID then
+   zend_alter_ini_entry('safe_mode_gid', 14, '1', 1, PHP_INI_SYSTEM, PHP_INI_STAGE_STARTUP)
+    else
+    {$ENDIF}
+      zend_alter_ini_entry('safe_mode_gid', 14, '0', 1, PHP_INI_SYSTEM, PHP_INI_STAGE_STARTUP);
+
+  zend_alter_ini_entry('register_argc_argv', 19, '0', 1, ZEND_INI_SYSTEM, ZEND_INI_STAGE_ACTIVATE);
+
+  if FRegisterGlobals then
+    zend_alter_ini_entry('register_globals',   17, '1', 1, ZEND_INI_SYSTEM, ZEND_INI_STAGE_ACTIVATE)
+      else
+        zend_alter_ini_entry('register_globals',   17, '0', 1, ZEND_INI_SYSTEM, ZEND_INI_STAGE_ACTIVATE);
+
+  if FHTMLErrors then
+   zend_alter_ini_entry('html_errors',        12, '1', 1, ZEND_INI_SYSTEM, ZEND_INI_STAGE_ACTIVATE)
+     else
+       zend_alter_ini_entry('html_errors',        12, '0', 1, ZEND_INI_SYSTEM, ZEND_INI_STAGE_ACTIVATE);
+
+  zend_alter_ini_entry('implicit_flush',     15, '1', 1, ZEND_INI_SYSTEM, ZEND_INI_STAGE_ACTIVATE);
+ TimeStr := IntToStr(FMaxInputTime);
+  zend_alter_ini_entry('max_input_time', 15, zend_pchar(TimeStr), Length(TimeStr), ZEND_INI_SYSTEM, ZEND_INI_STAGE_ACTIVATE);
+end;
+
+procedure TPHPEngine.PrepareEngine;
+begin
+  delphi_sapi_module.name := 'embed';  {to solve a problem with dl()}
+  delphi_sapi_module.pretty_name := 'PHP for Delphi';
+  delphi_sapi_module.startup := php_delphi_startup;
+  delphi_sapi_module.shutdown := nil; //php_module_shutdown_wrapper;
+  delphi_sapi_module.activate:= nil;
+  delphi_sapi_module.deactivate := @php_delphi_deactivate;
+  delphi_sapi_module.ub_write := @php_delphi_ub_write;
+  delphi_sapi_module.flush := @php_delphi_flush;
+  delphi_sapi_module.stat:= nil;
+  delphi_sapi_module.getenv:= nil;
+  delphi_sapi_module.sapi_error := @zend_error;
+  delphi_sapi_module.header_handler := @php_delphi_header_handler;
+  delphi_sapi_module.send_headers := nil;
+  delphi_sapi_module.send_header := @php_delphi_send_header;
+  delphi_sapi_module.read_post := @php_delphi_read_post;
+  delphi_sapi_module.read_cookies := @php_delphi_read_cookies;
+  delphi_sapi_module.register_server_variables := @php_delphi_register_variables;
+  delphi_sapi_module.log_message := @php_delphi_log_message;
+  if FIniPath <> '' then
+     delphi_sapi_module.php_ini_path_override := zend_pchar(FIniPath)
+  else
+     delphi_sapi_module.php_ini_path_override :=  nil;
+  delphi_sapi_module.block_interruptions := nil;
+  delphi_sapi_module.unblock_interruptions := nil;
+  delphi_sapi_module.default_post_reader := nil;
+  delphi_sapi_module.treat_data := nil;
+  delphi_sapi_module.executable_location := nil;
+  delphi_sapi_module.php_ini_ignore := 0;
+
+  FLibraryModule.size := sizeOf(Tzend_module_entry);
+  FLibraryModule.zend_api := ZEND_MODULE_API_NO;
+  {$IFDEF PHP_DEBUG}
+  FLibraryModule.zend_debug := 1;
+  {$ELSE}
+  FLibraryModule.zend_debug := 0;
+  {$ENDIF}
+  FLibraryModule.zts := USING_ZTS;
+  FLibraryModule.name :=  'php4delphi_internal';
+  FLibraryModule.functions := nil;
+  FLibraryModule.module_startup_func := @minit;
+  FLibraryModule.module_shutdown_func := @mshutdown;
+  FLibraryModule.info_func := @php_info_library;
+
+  FLibraryModule.request_shutdown_func := @rshutdown;
+  FLibraryModule.request_startup_func := @rinit;
+
+  FLibraryModule.module_started := 0;
+  FLibraryModule._type := MODULE_PERSISTENT;
+
+  FLibraryModule.Handle := nil;
+  FLibraryModule.module_number := 0;
+  FLibraryModule.build_id := DupStr(zend_pchar(ZEND_MODULE_BUILD_ID));
+end;
+
+procedure TPHPEngine.RegisterConstants;
+var
+ cnt : integer;
+ ConstantName : zend_ustr;
+ ConstantValue : zend_ustr;
+begin
+  for cnt := 0 to FConstants.Count - 1 do
+  begin
+    ConstantName  := FConstants[cnt].Name;
+    ConstantValue := FConstants[cnt].Value;
+    zend_register_string_constant(zend_pchar(ConstantName),
+      strlen(zend_pchar(ConstantName)) + 1,
+      zend_pchar(ConstantValue), CONST_PERSISTENT or CONST_CS, 0, TSRMLS_D);
+  end;
+  zend_register_bool_constant( zend_pchar('UTF8_SUPPORT'), 13, {$IFDEF PHP_UNICODE}TRUE{$ELSE}FALSE{$ENDIF},
+    CONST_PERSISTENT or CONST_CS, 0, TSRMLS_D);
+  RegisterInternalConstants(TSRMLS_D);
+end;
+
+procedure TPHPEngine.RegisterInternalConstants(TSRMLS_DC: pointer);
+{$IFDEF REGISTER_COLOURS}
 var
-  x: Pzend_module_entry;
-  xp: function(_type : integer; module_number : integer; TSRMLS_DC : pointer):integer;cdecl;
-begin
-  InterlockedDecrement(FRequestCount);
-  if Length(FAddMods) > 0 then
-    for x in FAddMods do
-    begin
-      xp := x^.request_shutdown_func;
+ i : integer;
+ ColorName : zend_ustr;
+{$ENDIF}
+begin
+ {$IFDEF REGISTER_COLOURS}
+  for I := Low(Colors) to High(Colors) do
+  begin
+   ColorName := zend_ustr(Colors[i].Name);
+   zend_register_long_constant( zend_pchar(ColorName), strlen(zend_pchar(ColorName)) + 1, Colors[i].Value,
+    CONST_PERSISTENT or CONST_CS, 0, TSRMLS_DC);
+  end;
+ {$ENDIF}
+end;
+
+
+procedure TPHPEngine.SetConstants(Value: TPHPConstants);
+begin
+  FConstants.Assign(Value);
+end;
+
+procedure TPHPEngine.ShutdownEngine;
+begin
+
+  if PHPEngine <> Self then
+   raise EDelphiErrorEx.Create('Only active engine can be stopped');
+
+
+  if not FEngineActive then
+   Exit;
+
+  try
+
+   if @delphi_sapi_module.shutdown <> nil then
+    delphi_sapi_module.shutdown(@delphi_sapi_module);
+    sapi_shutdown;
+     {Shutdown PHP thread safe resource manager}
+     if Assigned(FOnEngineShutdown) then
+       FOnEngineShutdown(Self);
+    {$IF not Defined(PHP550) and not Defined(PHP560)}
+    try
+    tsrm_shutdown();
+    except
+
+    end;
+    {$ENDIF}
+    FHash.Clear;
+   finally
+     FEngineActive := false;
+     FWaitForShutdown := False;
+   end;
+end;
+
+procedure TPHPEngine.RegisterLibrary(ALib : TCustomPHPLibrary);
+var
+ cnt : integer;
+ skip : boolean;
+ FN : zend_ustr;
+begin
+  skip := false;
+  ALib.Refresh;
+
+  {No functions defined, skip this library}
+  if ALib.Functions.Count = 0 then
+   Exit;
+
+  for cnt := 0 to ALib.Functions.Count - 1 do
+   begin
+      FN :=
+      {$IFDEF PHP_UNICODE}UTF8LowerCase{$ELSE}AnsiLowerCase{$ENDIF}
+      (ALib.Functions[cnt].FunctionName);
+      if FHash.IndexOf(FN) > -1 then
+      begin
+        skip := true;
+        break;
+      end;
+   end;
+
+  if not skip then
+   begin
+      for cnt := 0 to ALib.Functions.Count - 1 do
+       begin
+         FN := {$IFDEF PHP_UNICODE}UTF8LowerCase{$ELSE}AnsiLowerCase{$ENDIF}
+         (ALib.Functions[cnt].FunctionName);
+         FHash.AddObject(FN, ALib.Functions[cnt]);
+       end;
+      ALib.Locked := true;
+   end;
+end;
+
+procedure TPHPEngine.StartupEngine;
+var
+ i : integer;
+  x: Pzend_module_entry;
+begin
+  if PHPEngine <> Self then
+   begin
+     raise EDelphiErrorEx.Create('Only one PHP engine can be activated');
+   end;
+
+   if FEngineActive then
+       raise EDelphiErrorEx.Create('PHP engine already active');
+
+     StartupPHP;
+     PrepareEngine;
+//     ini := GetExecutorGlobals.ini_directives;
+
+
+
+     if not PHPLoaded then //Peter Enz
+       begin
+         raise EDelphiErrorEx.Create('PHP engine is not loaded');
+       end;
+
+     try
+      FHash.Clear;
+
+      for i := 0 to Librarian.Count -1 do
+      begin
+         RegisterLibrary(Librarian.GetLibrary(I));
+      end;
+
+
+      //Start PHP thread safe resource manager
+      tsrm_startup(128, 1, 0 , nil);
+
+      sapi_startup(@delphi_sapi_module);
+
+      RefreshLibrary;
+
+      php_module_startup(@delphi_sapi_module, @FLibraryModule, 1);
+
+      TSRMLS_D := ts_resource_ex(0, nil);
+      if Length(FAddMods) > 0 then
+      for x in FAddMods do
+      begin
+        zend_register_module_ex(x, TSRMLS_D);
+        zend_startup_module_ex(x, TSRMLS_D);
+      end;
+
+
+      PrepareIniEntry;
+      RegisterConstants;
+
+      if Assigned(FOnEngineStartup) then
+       FOnEngineStartup(Self);
+
+      FEngineActive := true;
+      except
+       FEngineActive := false;
+      end;
+end;
+
+procedure TPHPEngine.StartupPHP;
+var
+ DLLName : string;
+begin
+   if not PHPLoaded then
+    begin
+      if FDLLFolder <> '' then
+         DLLName := IncludeTrailingBackSlash(FDLLFolder) + PHPWin
+           else
+             DLLName := PHPWin;
+      LoadPHP(DLLName);
+      if FReportDLLError then
+       begin
+         if PHPLib = 0 then raise Exception.CreateFmt('%s not found', [DllName]);
+       end;
+    end;
+end;
+
+procedure TPHPEngine.LockEngine;
+begin
+  EnterCriticalSection(FLock);
+end;
+
+procedure TPHPEngine.UnlockEngine;
+begin
+  LeaveCriticalSection(FLock);
+end;
+
+procedure TPHPEngine.HandleError(Sender: TObject; AText: string;
+  AType: Integer; AFileName: string; ALineNo: integer);
+begin
+  LockEngine;
+  try
+    if Assigned(FOnScriptError) then
+
+
+       FOnScriptError(Sender, AText, AType, AFileName, ALineNo);
+      //ShowMessage( AText + #10#13 +  AType.ToString + #10#13 + AFileName + #10#13 + ALineNo.ToString );
+     // FOnScriptError(Sender, AText, AType, AFileName, ALineNo);
+  finally
+    UnlockEngine;
+  end;
+end;
+
+procedure TPHPEngine.HandleLogMessage(Sender: TObject; AText: string);
+begin
+  LockEngine;
+  try
+    if Assigned(FOnLogMessage) then
+     FOnLogMessage(Sender, AText);
+  finally
+    UnlockEngine;
+  end;
+end;
+
+procedure TPHPEngine.PrepareForShutdown;
+begin
+  LockEngine;
+  try
+   FWaitForShutdown := true;
+  finally
+    UnlockEngine;
+  end;
+end;
+
+procedure TPHPEngine.ShutdownAndWaitFor;
+var
+ cnt : integer;
+ AllClear : boolean;
+begin
+  PrepareForShutdown;
+
+  AllClear := false;
+  while not AllClear do
+   begin
+      cnt := FRequestCount;
+      if cnt <= 0 then
+        AllClear := true
+         else
+           Sleep(250);
+   end;
+  ShutdownEngine;
+end;
+
+function TPHPEngine.GetEngineActive: boolean;
+begin
+  Result := FEngineActive;
+end;
+
+procedure TPHPEngine.UnlockLibraries;
+var
+ cnt : integer;
+begin
+  if Assigned(Librarian) then
+   begin
+     for cnt := 0 to Librarian.Count - 1 do
+      Librarian.GetLibrary(cnt).Locked := false;
+   end;
+end;
+
+procedure TPHPEngine.RemoveRequest;
+var
+  x: Pzend_module_entry;
+  xp: function(_type : integer; module_number : integer; TSRMLS_DC : pointer):integer;cdecl;
+begin
+  InterlockedDecrement(FRequestCount);
+  if Length(FAddMods) > 0 then
+    for x in FAddMods do
+    begin
+      xp := x^.request_shutdown_func;
        if(Assigned(xp)) then
-         xp(x^._type, x^.module_number, TSRMLS_D);
-    end;
-end;
-
-procedure TPHPEngine.AddFunction(FN: zend_pchar; Func: Pointer);
-begin
+         xp(x^._type, x^.module_number, TSRMLS_D);
+    end;
+end;
+
+procedure TPHPEngine.AddFunction(FN: zend_pchar; Func: Pointer);
+begin
   inc(RegNumFunc);
   SetLength(FLibraryEntryTable, RegNumFunc + 1);
   FLibraryEntryTable[RegNumFunc - 1].fname := FN;
   //FLibraryEntryTable[RegNumFunc - 1].num_args := 0;
   FLibraryEntryTable[RegNumFunc - 1].arg_info := nil;
-  FLibraryEntryTable[RegNumFunc - 1].handler := Func;
-end;
-
-procedure TPHPEngine.AddModule(Module_entry: Pzend_module_entry);
-begin
+  FLibraryEntryTable[RegNumFunc - 1].handler := Func;
+end;
+
+procedure TPHPEngine.AddModule(Module_entry: Pzend_module_entry);
+begin
   SetLength(FAddMods, Length(FAddMods)+1);
   FAddMods[High(FAddMods)] := Module_entry;
-end;
-
-procedure TPHPEngine.RefreshLibrary;
-var i: integer;
-begin
+end;
+
+procedure TPHPEngine.RefreshLibrary;
+var i: integer;
+begin
   Self.AddFunction('delphi_date', @delphi_date);
   Self.AddFunction('delphi_get_author', @delphi_get_author);
   Self.AddFunction('delphi_str_date', @delphi_str_date);
   Self.AddFunction('InputBox', @delphi_input_box);
 
-  for i := 0 to FHash.Count - 1 do
+  for i := 0 to FHash.Count - 1 do
       Self.AddFunction(zend_pchar(zend_ustr(FHash[i])), @DispatchRequest);
   FLibraryModule.functions := @FLibraryEntryTable[0];
-end;
-
-procedure TPHPEngine.AddRequest;
+end;
+
+procedure TPHPEngine.AddRequest;
 var
-  x: Pzend_module_entry;
-  xp: function(_type : integer; module_number : integer; TSRMLS_DC : pointer):integer;cdecl;
-begin
-  InterlockedIncrement(FRequestCount);
-    if Length(FAddMods) > 0 then
-    for x in FAddMods do
-    begin
-      xp := x^.request_startup_func;
+  x: Pzend_module_entry;
+  xp: function(_type : integer; module_number : integer; TSRMLS_DC : pointer):integer;cdecl;
+begin
+  InterlockedIncrement(FRequestCount);
+    if Length(FAddMods) > 0 then
+    for x in FAddMods do
+    begin
+      xp := x^.request_startup_func;
        if(Assigned(xp)) then
-          xp(x^._type, x^.module_number, TSRMLS_D);
-    end;
-end;
-
-initialization
-  InitLibrarian;
-
-finalization
-  UnInitLibrarian;
-
-end.
+          xp(x^._type, x^.module_number, TSRMLS_D);
+    end;
+end;
+
+initialization
+  InitLibrarian;
+
+finalization
+  UnInitLibrarian;
+
+end.

From 67658bd28e6567a7a152c0f7aaa2f19663465485 Mon Sep 17 00:00:00 2001
From: lion <levzenin@pm.me>
Date: Sat, 18 Jul 2020 18:05:41 +0300
Subject: [PATCH 29/35] returned D2010 support

---
 .gitignore                                    |   3 +-
 Source/AutomaticConversion.log                |   1 -
 Source/DelphiFunctions.pas                    |   4 +-
 .../Delphi Class 2/delphi_class2.dpr          |  24 +-
 .../Extensions/css/css.dpr                    |   4 +-
 .../Extensions/php class/php_class.dpr        |  16 --
 .../Extensions/skeleton/skeleton.dpr          |   3 -
 .../psvPHP/Components/Unit1.pas               |  13 -
 .../psvPHP/sample1/frm_phpDemo.pas            |   5 -
 Source/Demos/Bonus/JpegConverter/php_jpeg.dpr |   3 -
 Source/Demos/Bonus/PHPEncoder/phpencoder.dpr  |   3 -
 .../Demos/Bonus/phpRegistry/php_registry.dpr  |  38 +--
 .../Delphi Class 2/delphi_class2.dpr          |  27 +-
 Source/Demos/Extensions/css/css.dpr           |   4 +-
 .../Demos/Extensions/php class/php_class.dpr  |  18 +-
 Source/Demos/Extensions/skeleton/skeleton.dpr |   3 -
 Source/Demos/psvPHP/Components/Unit1.pas      |  13 -
 Source/Demos/psvPHP/console/phpcon.dpr        |   2 +-
 Source/Demos/psvPHP/sample1/Unit1.pas         |   5 -
 Source/Demos/psvPHP/sample1/frm_phpDemo.pas   |   5 -
 Source/PHP.INC                                |  54 +++-
 Source/PHP4DelphiD2006.dpk                    |   6 +-
 Source/PHP4DelphiD2006.dproj.local            |   2 -
 Source/PHP4DelphiD2006.stat                   |  10 -
 Source/PHPAPI.pas                             |  69 +++--
 Source/PHPCommon.pas                          |  42 ++-
 Source/ZENDAPI.pas                            | 215 ++++++++++-----
 Source/ZendTypes.pas                          |  85 +++---
 ...p4delphi Delphi 10 Seattle.groupproj.local |  12 -
 ...4delphi Delphi 10.1 Berlin.groupproj.local |  11 -
 ...p4delphi Delphi 10.2 Tokyo.groupproj.local |  13 -
 .../php4delphi Delphi 2010.groupproj.local    |  23 --
 .../php4delphi Delphi 2011.groupproj.local    |  22 --
 Source/packages/php4delphi Delphi 5.bpg       |  23 ++
 Source/packages/php4delphi Delphi 7.bpg       |  23 ++
 .../php4delphi Delphi XE1.groupproj.local     |  14 -
 .../php4delphi Delphi XE2.groupproj.local     |  15 --
 .../php4delphi Delphi XE3.groupproj.local     |  16 --
 .../php4delphi Delphi XE4.groupproj.local     |  17 --
 .../php4delphi Delphi XE5.groupproj.local     |  18 --
 .../php4delphi Delphi XE6.groupproj.local     |  19 --
 .../php4delphi Delphi XE7.groupproj.local     |  20 --
 .../php4delphi Delphi XE8.groupproj.local     |  21 --
 Source/php4App.dproj.local                    |   2 -
 Source/php4App.identcache                     | Bin 47 -> 0 bytes
 Source/php4App.stat                           |  10 -
 Source/php4AppUnit.pas                        |   6 +-
 Source/php4Applications/PHP 4.4.6/php4App.dll | Bin 130560 -> 0 bytes
 .../php4Applications/PHP 5.2.11/php4App.dll   | Bin 134656 -> 0 bytes
 Source/php4Applications/PHP 5.3.0/php4App.dll | Bin 135168 -> 0 bytes
 Source/php4Applications/PHP4/php4App.dll      | Bin 49152 -> 0 bytes
 Source/php4Applications/PHP511/php4App.dll    | Bin 119808 -> 0 bytes
 Source/php4Applications/PHP512/php4App.dll    | Bin 37888 -> 0 bytes
 Source/php4DelphiD2005.dpk                    |   6 +-
 Source/php4DelphiD2005.dproj.local            |   2 -
 Source/php4DelphiD2005.stat                   |  10 -
 Source/php4DelphiD2007.dpk                    |   6 +-
 Source/php4DelphiD2007.dproj.local            |   2 -
 Source/php4DelphiD2007.stat                   |  10 -
 Source/php4DelphiD2009.dpk                    |  15 +-
 Source/php4DelphiD2009.dproj                  | 254 +++++++++---------
 Source/php4DelphiD2009.dproj.local            |   2 -
 Source/php4DelphiD2009.stat                   |  10 -
 Source/php4DelphiD2010.dpk                    |  18 +-
 Source/php4DelphiD2010.dproj.local            |   6 -
 Source/php4DelphiD2010.identcache             | Bin 1204 -> 0 bytes
 Source/php4DelphiD2010.stat                   |  10 -
 Source/php4DelphiD5.dproj.local               |   2 -
 Source/php4DelphiD5.stat                      |  10 -
 Source/php4DelphiD6.dpk                       |   7 +-
 Source/php4DelphiD6.dproj.local               |   2 -
 Source/php4DelphiD6.stat                      |  10 -
 Source/php4DelphiD7.cfg                       |  40 +++
 Source/php4DelphiD7.dof                       | 136 ++++++++++
 Source/php4DelphiD7.dproj.local               |   2 -
 Source/php4DelphiD7.stat                      |  10 -
 Source/php4DelphiR2005.dpk                    |   8 +-
 Source/php4DelphiR2005.dproj.local            |   2 -
 Source/php4DelphiR2005.stat                   |  10 -
 Source/php4DelphiR2006.dpk                    |   7 +-
 Source/php4DelphiR2006.dproj.local            |   2 -
 Source/php4DelphiR2006.stat                   |  10 -
 Source/php4DelphiR2007.dpk                    |   7 +-
 Source/php4DelphiR2007.dproj.local            |   2 -
 Source/php4DelphiR2007.stat                   |  10 -
 Source/php4DelphiR2009.dpk                    |  16 +-
 Source/php4DelphiR2009.dproj                  | 249 +++++++++--------
 Source/php4DelphiR2009.dproj.local            |   2 -
 Source/php4DelphiR2009.res                    | Bin 4396 -> 5056 bytes
 Source/php4DelphiR2009.stat                   |  10 -
 Source/php4DelphiR2010.dproj.local            |   6 -
 Source/php4DelphiR2010.identcache             | Bin 823 -> 0 bytes
 Source/php4DelphiR2010.stat                   |  10 -
 Source/php4DelphiR5.dpk                       |   5 +-
 Source/php4DelphiR5.dproj.local               |   2 -
 Source/php4DelphiR5.identcache                | Bin 556 -> 0 bytes
 Source/php4DelphiR5.stat                      |  10 -
 Source/php4DelphiR6.dpk                       |  11 +-
 Source/php4DelphiR6.dproj.local               |   2 -
 Source/php4DelphiR6.stat                      |  10 -
 Source/php4DelphiR7.cfg                       |  40 +++
 Source/php4DelphiR7.dof                       | 136 ++++++++++
 Source/php4DelphiR7.dpk                       |   1 -
 Source/php4DelphiR7.dproj.local               |   2 -
 Source/php4DelphiR7.identcache                | Bin 856 -> 0 bytes
 Source/php4DelphiR7.stat                      |  10 -
 Source/php4delphi.pas                         |  59 +++-
 Source/phpClass.pas                           |  20 ++
 Source/phpModules.pas                         |  26 +-
 php4Delphi.pdf                                | Bin 221817 -> 0 bytes
 110 files changed, 1125 insertions(+), 1092 deletions(-)
 delete mode 100644 Source/AutomaticConversion.log
 delete mode 100644 Source/PHP4DelphiD2006.dproj.local
 delete mode 100644 Source/PHP4DelphiD2006.stat
 delete mode 100644 Source/packages/php4delphi Delphi 10 Seattle.groupproj.local
 delete mode 100644 Source/packages/php4delphi Delphi 10.1 Berlin.groupproj.local
 delete mode 100644 Source/packages/php4delphi Delphi 10.2 Tokyo.groupproj.local
 delete mode 100644 Source/packages/php4delphi Delphi 2010.groupproj.local
 delete mode 100644 Source/packages/php4delphi Delphi 2011.groupproj.local
 create mode 100644 Source/packages/php4delphi Delphi 5.bpg
 create mode 100644 Source/packages/php4delphi Delphi 7.bpg
 delete mode 100644 Source/packages/php4delphi Delphi XE1.groupproj.local
 delete mode 100644 Source/packages/php4delphi Delphi XE2.groupproj.local
 delete mode 100644 Source/packages/php4delphi Delphi XE3.groupproj.local
 delete mode 100644 Source/packages/php4delphi Delphi XE4.groupproj.local
 delete mode 100644 Source/packages/php4delphi Delphi XE5.groupproj.local
 delete mode 100644 Source/packages/php4delphi Delphi XE6.groupproj.local
 delete mode 100644 Source/packages/php4delphi Delphi XE7.groupproj.local
 delete mode 100644 Source/packages/php4delphi Delphi XE8.groupproj.local
 delete mode 100644 Source/php4App.dproj.local
 delete mode 100644 Source/php4App.identcache
 delete mode 100644 Source/php4App.stat
 delete mode 100644 Source/php4Applications/PHP 4.4.6/php4App.dll
 delete mode 100644 Source/php4Applications/PHP 5.2.11/php4App.dll
 delete mode 100644 Source/php4Applications/PHP 5.3.0/php4App.dll
 delete mode 100644 Source/php4Applications/PHP4/php4App.dll
 delete mode 100644 Source/php4Applications/PHP511/php4App.dll
 delete mode 100644 Source/php4Applications/PHP512/php4App.dll
 delete mode 100644 Source/php4DelphiD2005.dproj.local
 delete mode 100644 Source/php4DelphiD2005.stat
 delete mode 100644 Source/php4DelphiD2007.dproj.local
 delete mode 100644 Source/php4DelphiD2007.stat
 delete mode 100644 Source/php4DelphiD2009.dproj.local
 delete mode 100644 Source/php4DelphiD2009.stat
 delete mode 100644 Source/php4DelphiD2010.dproj.local
 delete mode 100644 Source/php4DelphiD2010.identcache
 delete mode 100644 Source/php4DelphiD2010.stat
 delete mode 100644 Source/php4DelphiD5.dproj.local
 delete mode 100644 Source/php4DelphiD5.stat
 delete mode 100644 Source/php4DelphiD6.dproj.local
 delete mode 100644 Source/php4DelphiD6.stat
 create mode 100644 Source/php4DelphiD7.cfg
 create mode 100644 Source/php4DelphiD7.dof
 delete mode 100644 Source/php4DelphiD7.dproj.local
 delete mode 100644 Source/php4DelphiD7.stat
 delete mode 100644 Source/php4DelphiR2005.dproj.local
 delete mode 100644 Source/php4DelphiR2005.stat
 delete mode 100644 Source/php4DelphiR2006.dproj.local
 delete mode 100644 Source/php4DelphiR2006.stat
 delete mode 100644 Source/php4DelphiR2007.dproj.local
 delete mode 100644 Source/php4DelphiR2007.stat
 delete mode 100644 Source/php4DelphiR2009.dproj.local
 delete mode 100644 Source/php4DelphiR2009.stat
 delete mode 100644 Source/php4DelphiR2010.dproj.local
 delete mode 100644 Source/php4DelphiR2010.identcache
 delete mode 100644 Source/php4DelphiR2010.stat
 delete mode 100644 Source/php4DelphiR5.dproj.local
 delete mode 100644 Source/php4DelphiR5.identcache
 delete mode 100644 Source/php4DelphiR5.stat
 delete mode 100644 Source/php4DelphiR6.dproj.local
 delete mode 100644 Source/php4DelphiR6.stat
 create mode 100644 Source/php4DelphiR7.cfg
 create mode 100644 Source/php4DelphiR7.dof
 delete mode 100644 Source/php4DelphiR7.dproj.local
 delete mode 100644 Source/php4DelphiR7.identcache
 delete mode 100644 Source/php4DelphiR7.stat
 delete mode 100644 php4Delphi.pdf

diff --git a/.gitignore b/.gitignore
index 294f54a..1d9c846 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,5 +1,4 @@
 __history/
-
 __recovery/
 *.dcu
 *.local
@@ -7,3 +6,5 @@ __recovery/
 *.identcache
 *.stat
 *.res
+*.~pas
+*.~dcu
\ No newline at end of file
diff --git a/Source/AutomaticConversion.log b/Source/AutomaticConversion.log
deleted file mode 100644
index e660758..0000000
--- a/Source/AutomaticConversion.log
+++ /dev/null
@@ -1 +0,0 @@
- Fatal: Перетворення перервано.
diff --git a/Source/DelphiFunctions.pas b/Source/DelphiFunctions.pas
index 74bbcc3..11163b2 100644
--- a/Source/DelphiFunctions.pas
+++ b/Source/DelphiFunctions.pas
@@ -17,9 +17,7 @@
 interface
 uses
   SysUtils, Classes,
-  VCL.Controls,
-  ZendTypes, ZendAPI, PHPTypes, PHPAPI, VCL.Dialogs, typinfo,
-  VCL.Forms, VCL.stdctrls;
+  ZendTypes, ZendAPI, PHPTypes, PHPAPI, typinfo;
 
 {$ifdef fpc}
    {$mode delphi}
diff --git a/Source/Demos Delphi 2009 (WideString support)/Extensions/Delphi Class 2/delphi_class2.dpr b/Source/Demos Delphi 2009 (WideString support)/Extensions/Delphi Class 2/delphi_class2.dpr
index 1035333..9879358 100644
--- a/Source/Demos Delphi 2009 (WideString support)/Extensions/Delphi Class 2/delphi_class2.dpr	
+++ b/Source/Demos Delphi 2009 (WideString support)/Extensions/Delphi Class 2/delphi_class2.dpr	
@@ -59,43 +59,24 @@ begin
 
   DelphiTable[4].fname := 'delphi_extract_file_ext';
   DelphiTable[4].handler := @delphi_extract_file_ext;
-  {$IFDEF PHP4}
-  DelphiTable[4].func_arg_types := nil;
-  {$ELSE}
   DelphiTable[4].arg_info := nil;
-  {$ENDIF}
 
   DelphiTable[5].fname := 'delphi_show_message';
   DelphiTable[5].handler := @delphi_show_message;
-  {$IFDEF PHP4}
-  DelphiTable[5].func_arg_types := nil;
-  {$ELSE}
   DelphiTable[5].arg_info := nil;
-  {$ENDIF}
 
   DelphiTable[6].fname :=  'register_delphi_object';
   delphitable[6].handler := @register_delphi_object;
-  {$IFDEF PHP4}
-  DelphiTable[6].func_arg_types := nil;
-  {$ELSE}
   DelphiTable[6].arg_info := nil;
-  {$ENDIF}
 
   DelphiTable[7].fname := 'delphi_get_author';
   DelphiTable[7].handler := @delphi_get_author;
-  {$IFDEF PHP4}
-  DelphiTable[7].func_arg_types := nil;
-  {$ELSE}
   DelphiTable[7].arg_info := nil;
-  {$ENDIF}
+
 
   DelphiTable[8].fname := 'delphi_str_date';
   DelphiTable[8].handler := @delphi_str_date;
-  {$IFDEF PHP4}
-  DelphiTable[8].func_arg_types := nil;
-  {$ELSE}
   DelphiTable[8].arg_info := nil;
-  {$ENDIF}
 
 
   PHP_FUNCTION(DelphiTable[9], 'delphi_get_system_directory', @delphi_get_system_directory);
@@ -122,9 +103,6 @@ begin
   ModuleEntry.request_startup_func := @rinit;
   ModuleEntry.request_shutdown_func := @rshutdown;
   ModuleEntry.info_func := @php_info_module;
-  {$IFDEF PHP4}
-  Module_entry_table[0].func_arg_types := nil;
-  {$ENDIF}
   ModuleEntry.functions :=  @DelphiTable[0];
   ModuleEntry._type := MODULE_PERSISTENT;
   {$IFDEF PHP530}
diff --git a/Source/Demos Delphi 2009 (WideString support)/Extensions/css/css.dpr b/Source/Demos Delphi 2009 (WideString support)/Extensions/css/css.dpr
index 209efd7..52aae8e 100644
--- a/Source/Demos Delphi 2009 (WideString support)/Extensions/css/css.dpr	
+++ b/Source/Demos Delphi 2009 (WideString support)/Extensions/css/css.dpr	
@@ -114,9 +114,7 @@ begin
     ModuleEntry.info_func := @php_info_module;
     module_entry_table[0].fname := 'delphi_css';
     module_entry_table[0].handler := @delphi_css;
-   {$IFDEF PHP4}
-    Module_entry_table[0].func_arg_types := nil;
-   {$ENDIF}
+
     ModuleEntry.functions :=  @module_entry_table[0];
     ModuleEntry._type := MODULE_PERSISTENT;
     {$IFDEF PHP530}
diff --git a/Source/Demos Delphi 2009 (WideString support)/Extensions/php class/php_class.dpr b/Source/Demos Delphi 2009 (WideString support)/Extensions/php class/php_class.dpr
index 1fbe696..fe9c521 100644
--- a/Source/Demos Delphi 2009 (WideString support)/Extensions/php class/php_class.dpr	
+++ b/Source/Demos Delphi 2009 (WideString support)/Extensions/php class/php_class.dpr	
@@ -100,25 +100,12 @@ begin
   properties[0] := 'name';
   properties[1] := 'tool';
   properties[2] := 'height';
-  {$IFDEF PHP4}
-  _object_init_ex(return_value, ce, nil, 0, TSRMLS_DC );
-  {$ELSE}
   object_init(return_value, ce, TSRMLS_DC );
-  {$ENDIF}
 
-  {$IFDEF PHP4}
-  add_property_string_ex(return_value, properties[0], strlen(properties[0]) + 1, 'Serhiy', 1);
-  add_property_string_ex(return_value, properties[1], strlen(properties[1]) + 1, 'Delphi', 1);
-  {$ELSE}
   add_property_string_ex(return_value, properties[0], strlen(properties[0]) + 1, 'Serhiy', 1, TSRMLS_DC);
   add_property_string_ex(return_value, properties[1], strlen(properties[1]) + 1, 'Delphi', 1, TSRMLS_DC);
-  {$ENDIF}
 
-  {$IFDEF PHP4}
-  add_property_long_ex(return_value, properties[2], strlen(properties[2]) + 1, 185);
-  {$ELSE}
   add_property_long_ex(return_value, properties[2], strlen(properties[2]) + 1, 185, TSRMLS_DC);
-  {$ENDIF}
 end;
 
 
@@ -143,9 +130,6 @@ begin
   ModuleEntry.info_func := @php_info_module;
   module_entry_table[0].fname := 'get_demo_class';
   module_entry_table[0].handler := @get_demo_class;
-  {$IFDEF PHP4}
-  module_entry_table[0].func_arg_types := nil;
-  {$ENDIF}
   ModuleEntry.functions :=  @module_entry_table[0];
   ModuleEntry._type := MODULE_PERSISTENT;
   {$IFDEF PHP530}
diff --git a/Source/Demos Delphi 2009 (WideString support)/Extensions/skeleton/skeleton.dpr b/Source/Demos Delphi 2009 (WideString support)/Extensions/skeleton/skeleton.dpr
index db76d9f..a2c7c38 100644
--- a/Source/Demos Delphi 2009 (WideString support)/Extensions/skeleton/skeleton.dpr	
+++ b/Source/Demos Delphi 2009 (WideString support)/Extensions/skeleton/skeleton.dpr	
@@ -102,9 +102,6 @@ begin
   ModuleEntry.info_func := @php_info_module;
   Module_entry_table[0].fname := 'confirm_extname_compiled';
   Module_entry_table[0].handler := @confirm_extname_compiled;
-  {$IFDEF PHP4}
-  Module_entry_table[0].func_arg_types := nil;
-  {$ENDIF}
   ModuleEntry.functions :=  @module_entry_table[0];
   ModuleEntry._type := MODULE_PERSISTENT;
   {$IFDEF PHP530}
diff --git a/Source/Demos Delphi 2009 (WideString support)/psvPHP/Components/Unit1.pas b/Source/Demos Delphi 2009 (WideString support)/psvPHP/Components/Unit1.pas
index d0afb70..5a9e4e9 100644
--- a/Source/Demos Delphi 2009 (WideString support)/psvPHP/Components/Unit1.pas	
+++ b/Source/Demos Delphi 2009 (WideString support)/psvPHP/Components/Unit1.pas	
@@ -86,18 +86,6 @@ procedure TfrmTest.FormCreate(Sender: TObject);
    memScript.Lines.Clear;
    with memScript.Lines do
    begin
-  {$IFDEF PHP4}
-    Add('$btnClose = register_delphi_component("btnClose");');
-    Add('$frmTest =   register_delphi_component("frmTest");');
-    Add('$btnClose->Caption = "&Exit";');
-    Add('$frmTest->Caption = "PHP4Delphi demo";');
-    Add('$btnClose->Top =  150;');
-    Add('$btnClose->Font->Size = 10;');
-    Add('$btnClose->Cursor = -21;');
-    Add('$frmTest->Color = clGreen;');
-    Add('$st = delphi_input_box("InputBox", "Type your message", "Done");');
-    Add('delphi_show_message($st);');
-  {$ELSE}
     Add('$btnClose = register_delphi_component("btnClose");');
     Add('$frmTest =   register_delphi_component("frmTest");');
     Add('$btnClose->Caption = "&Exit";');
@@ -108,7 +96,6 @@ procedure TfrmTest.FormCreate(Sender: TObject);
     Add('$frmTest->Color = clGreen;');
     Add('$st = delphi_input_box("InputBox", "Type your message", "Done");');
     Add('delphi_show_message($st);');
-  {$ENDIF}
    end;
    PHPEngine.StartupEngine;
 end;
diff --git a/Source/Demos Delphi 2009 (WideString support)/psvPHP/sample1/frm_phpDemo.pas b/Source/Demos Delphi 2009 (WideString support)/psvPHP/sample1/frm_phpDemo.pas
index 6cff647..38f0f7f 100644
--- a/Source/Demos Delphi 2009 (WideString support)/psvPHP/sample1/frm_phpDemo.pas	
+++ b/Source/Demos Delphi 2009 (WideString support)/psvPHP/sample1/frm_phpDemo.pas	
@@ -118,13 +118,8 @@ procedure TfrmPHPDemo.DisplayResultInBrowser(AStr: AnsiString);
   AStr := StringReplace(AStr, 'src="?=PHPE9568F34-D428-11d2-A769-00AA001ACF42"',
   'src="res://'+ParamStr(0)+'/php"', [rfReplaceAll, rfIgnoreCase]);
 
-  {$IFDEF PHP4}
-  AStr := StringReplace(AStr, 'src="?=PHPE9568F35-D428-11d2-A769-00AA001ACF42"',
-  'src="res://'+ ParamStr(0) + '/zend1"', [rfReplaceAll, rfIgnoreCase]);
-  {$ELSE}
   AStr := StringReplace(AStr, 'src="?=PHPE9568F35-D428-11d2-A769-00AA001ACF42"',
   'src="res://'+ ParamStr(0) + '/zend2"', [rfReplaceAll, rfIgnoreCase]);
-  {$ENDIF}
 
   Stream := StringToOleStream(AStr);
   StreamInit := Webbrowser1.Document as IPersistStreamInit;
diff --git a/Source/Demos/Bonus/JpegConverter/php_jpeg.dpr b/Source/Demos/Bonus/JpegConverter/php_jpeg.dpr
index 2ef4892..4ab728d 100644
--- a/Source/Demos/Bonus/JpegConverter/php_jpeg.dpr
+++ b/Source/Demos/Bonus/JpegConverter/php_jpeg.dpr
@@ -266,9 +266,6 @@ begin
   Module_entry_table[2].fname := 'sign_jpeg';
   Module_entry_table[2].handler := @sign_jpeg;
 
-  {$IFDEF PHP4}
-  Module_entry_table[0].func_arg_types := nil;
-  {$ENDIF}
   ModuleEntry.functions :=  @module_entry_table[0];
   ModuleEntry._type := MODULE_PERSISTENT;
   
diff --git a/Source/Demos/Bonus/PHPEncoder/phpencoder.dpr b/Source/Demos/Bonus/PHPEncoder/phpencoder.dpr
index 0f03996..93396ad 100644
--- a/Source/Demos/Bonus/PHPEncoder/phpencoder.dpr
+++ b/Source/Demos/Bonus/PHPEncoder/phpencoder.dpr
@@ -85,9 +85,6 @@ begin
   Module_entry_table[0].fname := 'ex_dec';
   Module_entry_table[0].handler := @ex_dec;
 
-  {$IFDEF PHP4}
-  Module_entry_table[0].func_arg_types := nil;
-  {$ENDIF}
   ModuleEntry.functions :=  @module_entry_table[0];
   ModuleEntry._type := MODULE_PERSISTENT;
   {$IFDEF PHP530}
diff --git a/Source/Demos/Bonus/phpRegistry/php_registry.dpr b/Source/Demos/Bonus/phpRegistry/php_registry.dpr
index ef0bd03..39319e2 100644
--- a/Source/Demos/Bonus/phpRegistry/php_registry.dpr
+++ b/Source/Demos/Bonus/phpRegistry/php_registry.dpr
@@ -562,75 +562,39 @@ begin
 
     module_entry_table[0].fname := 'regcreatekey';
     module_entry_table[0].handler := @php_regcreatekey;
-    {$IFDEF PHP4}
-    module_entry_table[0].func_arg_types := nil;
-    {$ENDIF}
 
     module_entry_table[1].fname := 'regdeleteentry';
     module_entry_table[1].handler := @php_regdeleteentry;
-    {$IFDEF PHP4}
-    module_entry_table[1].func_arg_types := nil;
-    {$ENDIF}
 
     module_entry_table[2].fname := 'regdeletekeytree';
-    module_entry_table[2].handler := @php_regdeletekeytree;
-   {$IFDEF PHP4}
-    module_entry_table[2].func_arg_types := nil;
-    {$ENDIF}
+    module_entry_table[2].handler := p_regdeletekeytree;
 
     module_entry_table[3].fname := 'reghassubkeys';
     module_entry_table[3].handler := @php_reghassubkeys;
-   {$IFDEF PHP4}
-    module_entry_table[3].func_arg_types := nil;
-    {$ENDIF}
 
     module_entry_table[4].fname := 'regkeyexists';
     module_entry_table[4].handler := @php_regkeyexists;
-   {$IFDEF PHP4}
-    module_entry_table[4].func_arg_types := nil;
-    {$ENDIF}
 
     module_entry_table[5].fname := 'regreadbool';
     module_entry_table[5].handler := @php_regreadbool;
-   {$IFDEF PHP4}
-    module_entry_table[5].func_arg_types := nil;
-    {$ENDIF}
 
     module_entry_table[6].fname := 'regreadinteger';
     module_entry_table[6].handler := @php_regreadinteger;
-   {$IFDEF PHP4}
-    module_entry_table[6].func_arg_types := nil;
-    {$ENDIF}
 
     module_entry_table[7].fname := 'regreadstring';
     module_entry_table[7].handler := @php_regreadstring;
-   {$IFDEF PHP4}
-    module_entry_table[7].func_arg_types := nil;
-    {$ENDIF}
 
     module_entry_table[8].fname := 'regwritebool';
     module_entry_table[8].handler := @php_regwritebool;
-   {$IFDEF PHP4}
-    module_entry_table[8].func_arg_types := nil;
-    {$ENDIF}
 
     module_entry_table[9].fname := 'regwriteinteger';
     module_entry_table[9].handler := @php_regwriteinteger;
-   {$IFDEF PHP4}
-    module_entry_table[9].func_arg_types := nil;
-    {$ENDIF}
 
     module_entry_table[10].fname := 'regwritestring';
     module_entry_table[10].handler := @php_regwritestring;
-   {$IFDEF PHP4}
-    module_entry_table[10].func_arg_types := nil;
-    {$ENDIF}
 
     module_entry_table[11].fname := nil;
     module_entry_table[11].handler := nil;
-   {$IFDEF PHP4}
-    module_entry_table[11].func_arg_types := nil;
-    {$ENDIF}
 
     ModuleEntry.functions :=  @module_entry_table[0];
     ModuleEntry._type := MODULE_PERSISTENT;
diff --git a/Source/Demos/Extensions/Delphi Class 2/delphi_class2.dpr b/Source/Demos/Extensions/Delphi Class 2/delphi_class2.dpr
index 6972d25..cb67916 100644
--- a/Source/Demos/Extensions/Delphi Class 2/delphi_class2.dpr	
+++ b/Source/Demos/Extensions/Delphi Class 2/delphi_class2.dpr	
@@ -59,43 +59,23 @@ begin
 
   DelphiTable[4].fname := 'delphi_extract_file_ext';
   DelphiTable[4].handler := @delphi_extract_file_ext;
-  {$IFDEF PHP4}
-  DelphiTable[4].func_arg_types := nil;
-  {$ELSE}
   DelphiTable[4].arg_info := nil;
-  {$ENDIF}
 
   DelphiTable[5].fname := 'delphi_show_message';
-  DelphiTable[5].handler := @delphi_show_message;
-  {$IFDEF PHP4}
-  DelphiTable[5].func_arg_types := nil;
-  {$ELSE}
+  DelphiTable[5].handler := @delphi_show_message;}
   DelphiTable[5].arg_info := nil;
-  {$ENDIF}
 
   DelphiTable[6].fname :=  'register_delphi_object';
   delphitable[6].handler := @register_delphi_object;
-  {$IFDEF PHP4}
-  DelphiTable[6].func_arg_types := nil;
-  {$ELSE}
   DelphiTable[6].arg_info := nil;
-  {$ENDIF}
 
   DelphiTable[7].fname := 'delphi_get_author';
   DelphiTable[7].handler := @delphi_get_author;
-  {$IFDEF PHP4}
-  DelphiTable[7].func_arg_types := nil;
-  {$ELSE}
-  DelphiTable[7].arg_info := nil;
-  {$ENDIF}
+  DelphiTable[7].arg_info := nil;}
 
   DelphiTable[8].fname := 'delphi_str_date';
   DelphiTable[8].handler := @delphi_str_date;
-  {$IFDEF PHP4}
-  DelphiTable[8].func_arg_types := nil;
-  {$ELSE}
   DelphiTable[8].arg_info := nil;
-  {$ENDIF}
 
 
   PHP_FUNCTION(DelphiTable[9], 'delphi_get_system_directory', @delphi_get_system_directory);
@@ -122,9 +102,6 @@ begin
   ModuleEntry.request_startup_func := @rinit;
   ModuleEntry.request_shutdown_func := @rshutdown;
   ModuleEntry.info_func := @php_info_module;
-  {$IFDEF PHP4}
-  Module_entry_table[0].func_arg_types := nil;
-  {$ENDIF}
   ModuleEntry.functions :=  @DelphiTable[0];
   ModuleEntry._type := MODULE_PERSISTENT;
   {$IFDEF PHP530}
diff --git a/Source/Demos/Extensions/css/css.dpr b/Source/Demos/Extensions/css/css.dpr
index 79f0d5a..0b04986 100644
--- a/Source/Demos/Extensions/css/css.dpr
+++ b/Source/Demos/Extensions/css/css.dpr
@@ -104,9 +104,7 @@ begin
     ModuleEntry.info_func := @php_info_module;
     module_entry_table[0].fname := 'delphi_css';
     module_entry_table[0].handler := @delphi_css;
-  {$IFDEF PHP4}
-  Module_entry_table[0].func_arg_types := nil;
-  {$ENDIF}
+
   ModuleEntry.functions :=  @module_entry_table[0];
   ModuleEntry._type := MODULE_PERSISTENT;
   {$IFDEF PHP530}
diff --git a/Source/Demos/Extensions/php class/php_class.dpr b/Source/Demos/Extensions/php class/php_class.dpr
index c0938e1..8333ffc 100644
--- a/Source/Demos/Extensions/php class/php_class.dpr	
+++ b/Source/Demos/Extensions/php class/php_class.dpr	
@@ -100,25 +100,11 @@ begin
   properties[0] := 'name';
   properties[1] := 'tool';
   properties[2] := 'height';
-  {$IFDEF PHP4}
-  _object_init_ex(return_value, ce, nil, 0, TSRMLS_DC );
-  {$ELSE}
   object_init(return_value, ce, TSRMLS_DC );
-  {$ENDIF}
-
-  {$IFDEF PHP4}
-  add_property_string_ex(return_value, properties[0], strlen(properties[0]) + 1, 'Serhiy', 1);
-  add_property_string_ex(return_value, properties[1], strlen(properties[1]) + 1, 'Delphi', 1);
-  {$ELSE}
   add_property_string_ex(return_value, properties[0], strlen(properties[0]) + 1, 'Serhiy', 1, TSRMLS_DC);
   add_property_string_ex(return_value, properties[1], strlen(properties[1]) + 1, 'Delphi', 1, TSRMLS_DC);
-  {$ENDIF}
 
-  {$IFDEF PHP4}
-  add_property_long_ex(return_value, properties[2], strlen(properties[2]) + 1, 185);
-  {$ELSE}
   add_property_long_ex(return_value, properties[2], strlen(properties[2]) + 1, 185, TSRMLS_DC);
-  {$ENDIF}
 end;
 
 
@@ -143,9 +129,7 @@ begin
   ModuleEntry.info_func := @php_info_module;
   module_entry_table[0].fname := 'get_demo_class';
   module_entry_table[0].handler := @get_demo_class;
-  {$IFDEF PHP4}
-  module_entry_table[0].func_arg_types := nil;
-  {$ENDIF}
+
   ModuleEntry.functions :=  @module_entry_table[0];
   ModuleEntry._type := MODULE_PERSISTENT;
   {$IFDEF PHP530}
diff --git a/Source/Demos/Extensions/skeleton/skeleton.dpr b/Source/Demos/Extensions/skeleton/skeleton.dpr
index e951a0c..4bebef7 100644
--- a/Source/Demos/Extensions/skeleton/skeleton.dpr
+++ b/Source/Demos/Extensions/skeleton/skeleton.dpr
@@ -103,9 +103,6 @@ begin
   ModuleEntry.info_func := @php_info_module;
   Module_entry_table[0].fname := 'confirm_extname_compiled';
   Module_entry_table[0].handler := @confirm_extname_compiled;
-  {$IFDEF PHP4}
-  Module_entry_table[0].func_arg_types := nil;
-  {$ENDIF}
   ModuleEntry.functions :=  @module_entry_table[0];
   ModuleEntry._type := MODULE_PERSISTENT;
   {$IFDEF PHP530}
diff --git a/Source/Demos/psvPHP/Components/Unit1.pas b/Source/Demos/psvPHP/Components/Unit1.pas
index d0afb70..5a9e4e9 100644
--- a/Source/Demos/psvPHP/Components/Unit1.pas
+++ b/Source/Demos/psvPHP/Components/Unit1.pas
@@ -86,18 +86,6 @@ procedure TfrmTest.FormCreate(Sender: TObject);
    memScript.Lines.Clear;
    with memScript.Lines do
    begin
-  {$IFDEF PHP4}
-    Add('$btnClose = register_delphi_component("btnClose");');
-    Add('$frmTest =   register_delphi_component("frmTest");');
-    Add('$btnClose->Caption = "&Exit";');
-    Add('$frmTest->Caption = "PHP4Delphi demo";');
-    Add('$btnClose->Top =  150;');
-    Add('$btnClose->Font->Size = 10;');
-    Add('$btnClose->Cursor = -21;');
-    Add('$frmTest->Color = clGreen;');
-    Add('$st = delphi_input_box("InputBox", "Type your message", "Done");');
-    Add('delphi_show_message($st);');
-  {$ELSE}
     Add('$btnClose = register_delphi_component("btnClose");');
     Add('$frmTest =   register_delphi_component("frmTest");');
     Add('$btnClose->Caption = "&Exit";');
@@ -108,7 +96,6 @@ procedure TfrmTest.FormCreate(Sender: TObject);
     Add('$frmTest->Color = clGreen;');
     Add('$st = delphi_input_box("InputBox", "Type your message", "Done");');
     Add('delphi_show_message($st);');
-  {$ENDIF}
    end;
    PHPEngine.StartupEngine;
 end;
diff --git a/Source/Demos/psvPHP/console/phpcon.dpr b/Source/Demos/psvPHP/console/phpcon.dpr
index 0886d78..dd42a80 100644
--- a/Source/Demos/psvPHP/console/phpcon.dpr
+++ b/Source/Demos/psvPHP/console/phpcon.dpr
@@ -32,7 +32,7 @@ var
 begin
   if zend_parse_method_parameters(1, TSRMLS_DC, this_ptr, 'z', @Text) = 0 then
   begin
-    ShowMessage(WideString(Z_RawStr(Text)));
+    ShowMessage(Z_STRVAL(Text));
   end;
 end;
     procedure grc(ht: integer; return_value: pzval;
diff --git a/Source/Demos/psvPHP/sample1/Unit1.pas b/Source/Demos/psvPHP/sample1/Unit1.pas
index 53d68ce..7b7281e 100644
--- a/Source/Demos/psvPHP/sample1/Unit1.pas
+++ b/Source/Demos/psvPHP/sample1/Unit1.pas
@@ -110,13 +110,8 @@ procedure TfrmPHPDemo.DisplayResultInBrowser(AStr: string);
   AStr := StringReplace(AStr, 'src="?=PHPE9568F34-D428-11d2-A769-00AA001ACF42"',
   'src="res://'+ParamStr(0)+'/php"', [rfReplaceAll, rfIgnoreCase]);
 
-  {$IFDEF PHP4}
-  AStr := StringReplace(AStr, 'src="?=PHPE9568F35-D428-11d2-A769-00AA001ACF42"',
-  'src="res://'+ ParamStr(0) + '/zend1"', [rfReplaceAll, rfIgnoreCase]);
-  {$ELSE}
   AStr := StringReplace(AStr, 'src="?=PHPE9568F35-D428-11d2-A769-00AA001ACF42"',
   'src="res://'+ ParamStr(0) + '/zend2"', [rfReplaceAll, rfIgnoreCase]);
-  {$ENDIF}
 
   Stream := StringToOleStream(AStr);
   StreamInit := Webbrowser1.Document as IPersistStreamInit;
diff --git a/Source/Demos/psvPHP/sample1/frm_phpDemo.pas b/Source/Demos/psvPHP/sample1/frm_phpDemo.pas
index 4593e8e..98e98f3 100644
--- a/Source/Demos/psvPHP/sample1/frm_phpDemo.pas
+++ b/Source/Demos/psvPHP/sample1/frm_phpDemo.pas
@@ -117,13 +117,8 @@ procedure TfrmPHPDemo.DisplayResultInBrowser(AStr: string);
   AStr := StringReplace(AStr, 'src="?=PHPE9568F34-D428-11d2-A769-00AA001ACF42"',
   'src="res://'+ParamStr(0)+'/php"', [rfReplaceAll, rfIgnoreCase]);
 
-  {$IFDEF PHP4}
-  AStr := StringReplace(AStr, 'src="?=PHPE9568F35-D428-11d2-A769-00AA001ACF42"',
-  'src="res://'+ ParamStr(0) + '/zend1"', [rfReplaceAll, rfIgnoreCase]);
-  {$ELSE}
   AStr := StringReplace(AStr, 'src="?=PHPE9568F35-D428-11d2-A769-00AA001ACF42"',
   'src="res://'+ ParamStr(0) + '/zend2"', [rfReplaceAll, rfIgnoreCase]);
-  {$ENDIF}
 
   Stream := StringToOleStream(AStr);
   StreamInit := Webbrowser1.Document as IPersistStreamInit;
diff --git a/Source/PHP.INC b/Source/PHP.INC
index 09db880..d7fa89c 100644
--- a/Source/PHP.INC
+++ b/Source/PHP.INC
@@ -35,13 +35,19 @@ Define suitable visual library
 
 //Version
 {$DEFINE PHP560}
+	//PHP Version
+{$DEFINE ZTS}
+	//Thread Safe mode (php7ts, e.g)
 {$DEFINE VCL}
-
+	//visual library - Kylix, VCL, FMX for Delphi and LCL, fpGUI for Lazarus
+	
 //Features
 {$DEFINE PHP_UNICODE}
     //PHP unicode support *Enables WideString and UnicodeString
-{$DEFINE REGISTER_COLOURS} 
+{.$DEFINE REGISTER_COLOURS} 
     //constants for Delphi colours
+{.$DEFINE php_side_handler}
+    //enable ability to define own error handler from php side ~NON_TC
 {.$DEFINE QUIET_LOAD}
     //Do not show errors while loading php library
 {.$DEFINE PHP4DELPHI_AUTOLOAD}
@@ -50,8 +56,6 @@ Define suitable visual library
     // Unload php library at finalization
 
 //Compiler switches
-{.$DEFINE php_side_handler}
-    //enable ability to define own error handler from php side ~NON_TC
 {.$DEFINE COMPILER_php7pv}
     // use macroses from PHP sources patch 
     // https://github.com/resistancelion/no-name-engine/tree/master/php-src
@@ -70,7 +74,6 @@ Define suitable visual library
 
 
 
-
 //E N D
 {$WARN UNIT_DEPRECATED OFF}
 {$IFDEF PHP_UNICODE} {$DEFINE UNICODE} {$ENDIF}
@@ -101,9 +104,23 @@ Define suitable visual library
     {$ENDIF}
 {$ENDIF}
 
-{$IFNDEF LINUX}
- {$DEFINE ZTS}                                               {zend thread safety support}
-{$ENDIF}
+
+{$ifdef FPC}
+	{$DEFINE VERSION1}
+	{$DEFINE VERSION2}
+	{$DEFINE VERSION3}
+	{$DEFINE VERSION4}
+	{$DEFINE VERSION5}
+	{$DEFINE VERSION6}
+	{$DEFINE VERSION7}
+	{$DEFINE VERSION8}
+	{$DEFINE VERSION9}
+	{$DEFINE VERSION10}
+	{$DEFINE VERSION11}
+	{$DEFINE VERSION12}
+	{$DEFINE VERSION13}
+	{$DEFINE VERSION14}
+{$endif}
 
 {$IFNDEF VER80}                                             {Delphi 1.0}
   {$DEFINE VERSION2}                                        {Delphi 2.0 and BCB 1 or higher}
@@ -179,6 +196,17 @@ Define suitable visual library
   {$ENDIF}
 {$ENDIF}
 
+{$IFNDEF VER180}
+	{$DEFINE OLD_PATHS}
+{$ENDIF}
+
+{$IFDEF VERSION12}
+	{$DEFINE WSTR}
+{$ELSE}
+	{$IFDEF PHP_UNICODE} {$UNDEF PHP_UNICODE} {$ENDIF}
+{$ENDIF}
+
+
 {$IFDEF VERSION6}
   {$WARN SYMBOL_PLATFORM OFF}
   {$IFDEF VERSION7}
@@ -214,8 +242,10 @@ Define suitable visual library
     {$IFDEF VCL} {$UNDEF VCL} {$ENDIF}
     {$DEFINE LCL}
 {$ELSE}
-    {$IFDEF LCL}
-        {$UNDEF LCL}
-        {$DEFINE VCL}
-    {$ENDIF}
+    {$UNDEF LCL}
+	{$IFDEF WINDOWS}
+		{$DEFINE VCL}
+	{$ELSE}
+		{$DEFINE KYLIX}
+	{$ENDIF}
 {$ENDIF}
diff --git a/Source/PHP4DelphiD2006.dpk b/Source/PHP4DelphiD2006.dpk
index 35082b9..2ff391a 100644
--- a/Source/PHP4DelphiD2006.dpk
+++ b/Source/PHP4DelphiD2006.dpk
@@ -30,7 +30,7 @@ package php4DelphiD2006;
 {$DESIGNONLY}
 {$IMPLICITBUILD OFF}
 
-rrequires
+requires
   rtl,
   vcl,
   designide,
@@ -38,11 +38,11 @@ rrequires
   vclx,
   php4DelphiR2006;
 
-ocontains
+contains
   PHPProjectWizard in 'PHPProjectWizard.pas',
   php4DelphiReg in 'php4DelphiReg.pas',
   php4DelphiWeb in 'php4DelphiWeb.pas',
   phpWeb in 'phpWeb.pas',
   phpAbout in 'phpAbout.pas' {dlgAbout};
 
-d.
+end.
diff --git a/Source/PHP4DelphiD2006.dproj.local b/Source/PHP4DelphiD2006.dproj.local
deleted file mode 100644
index b3811b7..0000000
--- a/Source/PHP4DelphiD2006.dproj.local
+++ /dev/null
@@ -1,2 +0,0 @@
-﻿<?xml version="1.0" encoding="utf-8"?>
-<BorlandProject/>
diff --git a/Source/PHP4DelphiD2006.stat b/Source/PHP4DelphiD2006.stat
deleted file mode 100644
index 2539032..0000000
--- a/Source/PHP4DelphiD2006.stat
+++ /dev/null
@@ -1,10 +0,0 @@
-[Stats]
-EditorSecs=1
-DesignerSecs=1
-InspectorSecs=1
-CompileSecs=1
-OtherSecs=4
-StartTime=21.09.2018 3:07:34
-RealKeys=0
-EffectiveKeys=0
-DebugSecs=1
diff --git a/Source/PHPAPI.pas b/Source/PHPAPI.pas
index 23b8426..d26fec7 100644
--- a/Source/PHPAPI.pas
+++ b/Source/PHPAPI.pas
@@ -22,7 +22,6 @@ interface
 
 uses
  {Windows} SysUtils,
-  VCL.Dialogs,
  {$IFDEF FPC}
   dynlibs
  {$ELSE}
@@ -122,8 +121,8 @@ interface
   php_ob_handler_used: function (handler_name : zend_pchar; TSRMLS_DC : pointer) : integer; cdecl;
   {$IF not Defined(PHP540) and not Defined(PHP550) and not Defined(PHP560)}
   php_ob_init_conflict: function (handler_new : zend_pchar; handler_set : zend_pchar; TSRMLS_DC : pointer) : integer; cdecl;
-  {$ENDIF}
-  {$ENDIF}
+  {$ifend}
+  {$endif}
 
 //php_output.h
 
@@ -237,7 +236,7 @@ function GetPHPGlobals(TSRMLS_DC : pointer) : Pphp_Core_Globals;
 
 procedure PHP_FUNCTION(var AFunction : zend_function_entry; AName : zend_pchar; AHandler : pointer);
 
-function LoadPHP(const DllFileName: zend_ustr = PHPWin) : boolean;
+function LoadPHP(const LibraryPath: zend_ustr = PHPlp) : boolean;
 
 procedure UnloadPHP;
 
@@ -274,7 +273,7 @@ function ValueToFloat(Value : zend_ustr) : extended;
 {$ELSE}
 php_body_write: function (const str : zend_pchar; str_length: uint; TSRMLS_DC : pointer) : integer; cdecl;
 php_header_write: function (const str : zend_pchar; str_length: uint; TSRMLS_DC : pointer) : integer; cdecl;
-{$ENDIF}
+{$ifend}
 
 php_header: function(TSRMLS_D: pointer) : integer; cdecl;
 php_setcookie: function (name : zend_pchar; name_len : integer; value : zend_pchar; value_len: integer;
@@ -433,13 +432,13 @@ procedure php_end_implicit_flush(TSRMLS_D : pointer);
 {$ENDIF}
 
 
-function LoadPHP(const DllFileName: zend_ustr = PHPWin) : boolean;
+function LoadPHP(const LibraryPath: zend_ustr = PHPlp) : boolean;
 
 begin
   Result := false;
   if not PHPLoaded then
     begin
-      if not LoadZend(DllFileName) then
+      if not LoadZend(LibraryPath) then
        Exit;
     end;
 
@@ -509,29 +508,29 @@ function LoadPHP(const DllFileName: zend_ustr = PHPWin) : boolean;
   {$ELSE}
   LFunc(@php_start_ob_buffer, 'php_start_ob_buffer');
 
-  php_start_ob_buffer_named, 'php_start_ob_buffer_named');
+  LFunc(@php_start_ob_buffer_named, 'php_start_ob_buffer_named');
 
-  php_end_ob_buffer, 'php_end_ob_buffer');
+  LFunc(@php_end_ob_buffer, 'php_end_ob_buffer');
 
-  php_end_ob_buffers, 'php_end_ob_buffers');
+  LFunc(@php_end_ob_buffers, 'php_end_ob_buffers');
 
-  php_ob_get_buffer, 'php_ob_get_buffer');
+  LFunc(@php_ob_get_buffer, 'php_ob_get_buffer');
 
-  php_ob_get_length, 'php_ob_get_length');
+  LFunc(@php_ob_get_length, 'php_ob_get_length');
 
-  php_start_implicit_flush, 'php_start_implicit_flush');
+  LFunc(@php_start_implicit_flush, 'php_start_implicit_flush');
 
-  php_end_implicit_flush, 'php_end_implicit_flush');
+  LFunc(@php_end_implicit_flush, 'php_end_implicit_flush');
 
-  php_get_output_start_filename, 'php_get_output_start_filename');
+  LFunc(@php_get_output_start_filename, 'php_get_output_start_filename');
 
-  php_get_output_start_lineno, 'php_get_output_start_lineno');
+  LFunc(@php_get_output_start_lineno, 'php_get_output_start_lineno');
 
-  php_ob_handler_used, 'php_ob_handler_used');
+  LFunc(@php_ob_handler_used, 'php_ob_handler_used');
 {$ENDIF}
     {$IF not Defined(PHP540) and not Defined(PHP550) and not Defined(PHP560)}
-  php_ob_init_conflict, 'php_ob_init_conflict');
-    {$ENDIF}
+  LFunc(@php_ob_init_conflict, 'php_ob_init_conflict');
+    {$ifend}
   LFunc(@php_strtoupper, 'php_strtoupper');
 
   LFunc(@php_strtolower,'php_strtolower');
@@ -586,7 +585,7 @@ function LoadPHP(const DllFileName: zend_ustr = PHPWin) : boolean;
   {$ELSE}
   LFunc(@php_body_write, 'php_body_write' );
   LFunc(@php_header_write, 'php_header_write');
-  {$ENDIF}
+  {$ifend}
   {$IFNDEF COMPILER_php7pv}
   LFunc(@php_log_err, 'php_log_err');
   {$ENDIF}
@@ -673,6 +672,7 @@ function FloatToValue(Value: Extended): zend_ustr;
 var
   c: CharPtr;
 begin
+  {$if CompilerVersion > 21}
   c := FormatSettings.DecimalSeparator;
   try
    FormatSettings.DecimalSeparator := '.';
@@ -680,19 +680,38 @@ function FloatToValue(Value: Extended): zend_ustr;
   finally
     FormatSettings.DecimalSeparator := c;
   end;
+  {$else}
+  c := DecimalSeparator;
+  try
+   DecimalSeparator := '.';
+   Result := SysUtils.FormatFloat('0.####', Value);
+  finally
+    DecimalSeparator := c;
+  end;
+  {$ifend}
 end;
 
 function ValueToFloat(Value : zend_ustr) : extended;
 var
   c: CharPtr;
 begin
+  {$if CompilerVersion > 21}
   c := FormatSettings.DecimalSeparator;
   try
    FormatSettings.DecimalSeparator := '.';
-   Result := SysUtils.StrToFloat(Value);
+   Result := SysUtils.StrToFloat( Value);
   finally
-   FormatSettings.DecimalSeparator := c;
+    FormatSettings.DecimalSeparator := c;
+  end;
+  {$else}
+  c := DecimalSeparator;
+  try
+   DecimalSeparator := '.';
+   Result := SysUtils.StrToFloat( Value);
+  finally
+    DecimalSeparator := c;
   end;
+  {$ifend}
 end;
 
 
@@ -714,7 +733,7 @@ function GetPHPVersion: TPHPFileInfo;
   Result.MinorVersion := 0;
   Result.Release := 0;
   Result.Build := 0;
-  FileName := PHPWin;
+  FileName := PHPlp;
   InfoSize := GetFileVersionInfoSize(PWideChar(Filename), Wnd);
    if InfoSize <> 0 then
     begin
@@ -735,13 +754,13 @@ function GetPHPVersion: TPHPFileInfo;
 end;
 {$ENDIF}
 
-initialization
 {$IFDEF PHP4DELPHI_AUTOLOAD}
+initialization
   LoadPHP;
 {$ENDIF}
 
-finalization
 {$IFDEF PHP4DELPHI_AUTOUNLOAD}
+finalization
   UnloadPHP;
 {$ENDIF}
 
diff --git a/Source/PHPCommon.pas b/Source/PHPCommon.pas
index 04369c1..d0a3a41 100644
--- a/Source/PHPCommon.pas
+++ b/Source/PHPCommon.pas
@@ -19,7 +19,27 @@
 interface
 
 uses
-  Windows, Messages, SysUtils, Classes, VCL.Graphics, VCL.Controls, VCL.Forms, VCL.Dialogs,
+  Windows, Messages, SysUtils, Classes,
+  {$if CompilerVersion > 21}
+  VCL.Controls,
+  VCL.Dialogs,
+  VCL.Forms, VCL.Graphics,
+  {$elseif defined(FMX)}
+  FMX.Controls,
+  FMX.Dialogs,
+  FMX.Forms, FMX.Graphics,
+  {$else}
+    {$ifdef KYLIX}
+    QControls,
+    QDialogs,
+    QForms, QGraphics,
+    {$else}
+    Controls,
+    Dialogs,
+    Forms, Graphics,
+    {$endif}
+  {$ifend}
+
   ZendTypes, ZendAPI, PHPTypes, PHPAPI;
 
 type
@@ -274,6 +294,7 @@ function TPHPVariable.GetAsInteger: integer;
 var
  c: CharPtr;
 begin
+{$if CompilerVersion > 21}
   c := FormatSettings.DecimalSeparator;
   try
    FormatSettings.DecimalSeparator := '.';
@@ -281,6 +302,15 @@ function TPHPVariable.GetAsInteger: integer;
   finally
     FormatSettings.DecimalSeparator := c;
   end;
+{$else}
+  c := DecimalSeparator;
+  try
+   DecimalSeparator := '.';
+   Result := Round(ValueToFloat(FValue));
+  finally
+    DecimalSeparator := c;
+  end;
+{$ifend}
 end;
 
 function TPHPVariable.GetDisplayName: string;
@@ -308,6 +338,7 @@ procedure TPHPVariable.SetAsInteger(const Value: integer);
 var
  c: CharPtr;
 begin
+{$if CompilerVersion > 21}
   c := FormatSettings.DecimalSeparator;
   try
    FormatSettings.DecimalSeparator := '.';
@@ -315,6 +346,15 @@ procedure TPHPVariable.SetAsInteger(const Value: integer);
   finally
     FormatSettings.DecimalSeparator := c;
   end;
+{$else}
+  c := DecimalSeparator;
+  try
+   DecimalSeparator := '.';
+   FValue := IntToStr(Value);
+  finally
+    DecimalSeparator := c;
+  end;
+{$ifend}
 end;
 
 { TPHPConstant }
diff --git a/Source/ZENDAPI.pas b/Source/ZENDAPI.pas
index 192f6ff..62d0a6c 100644
--- a/Source/ZENDAPI.pas
+++ b/Source/ZENDAPI.pas
@@ -20,8 +20,9 @@
 interface
 
 uses
-VCL.Dialogs,
+{$ifdef PHP_UNICODE}
 WideStrUtils,
+{$endif}
   {$IFDEF FPC} LCLType,LCLIntf,dynlibs,libc{$ELSE}Windows{$ENDIF}, SysUtils,
   ZendTypes, Variants,
   PHPTypes;
@@ -32,37 +33,22 @@ interface
    TASDate = array of AnsiString;
   PASDate = ^TWSDate;
 const
-PHPWin =
-{$IFDEF PHP_DEBUG}
+PHPlp =
 {$IFDEF PHP7}
-  'php7ts_debug.dll'
+  'php7'
 {$ELSE}
- {$IFDEF PHP5}
-  'php5ts_debug.dll'
+  {$IFDEF PHP5}
+    'php5'
   {$ELSE}
-  'php4ts_debug.dll'
+    'php4'
   {$ENDIF}
- {$ENDIF}
+{$ENDIF}
+{$IFDEF ZTS} + 'ts' {$ENDIF}
+{$IFDEF PHP_DEBUG} + '_debug' {$ENDIF}
+{$IFDEF WINDOWS}
+  + '.dll'
 {$ELSE}
- {$IFDEF PHP5}
-    {$IFDEF PHP7}
-    {$IFDEF LINUX}
-         'php7ts.so'
-   {$ENDIF}
-   {$IFDEF MSWINDOWS}
-    'php7ts.dll'
-     {$ENDIF}
-    {$ELSE}
-    {$IFDEF LINUX}
-         'php5ts.so'
-   {$ENDIF}
-   {$IFDEF MSWINDOWS}
-    'php5ts.dll'
-     {$ENDIF}
-    {$ENDIF}
-  {$ELSE}
-  'php4ts.dll'
-  {$ENDIF}
+  + '.so'
 {$ENDIF};
 
 type
@@ -84,9 +70,14 @@   align_test = record
 {$IFNDEF PHP_UNICODE}
 function AnsiFormat(const Format: AnsiString; const Args: array of const): AnsiString;
 {$ENDIF}
+{$ifdef VERSION12}
 function Lfunc(var Func: Pointer; addr: LPCWSTR): Bool;
 function HFunc(const Func: Pointer; addr: LPCWSTR): Bool;
-function  LoadZEND(const DllFilename: zend_ustr = PHPWin) : boolean;
+{$else}
+function Lfunc(var Func: Pointer; addr: PAnsiChar): BOOL;
+function HFunc(const Func: Pointer; addr: PAnsiChar): Bool;
+{$endif}
+function  LoadZEND(const LibraryPath: zend_ustr = PHPlp) : boolean;
 function __fgsapi(sapi_globals_value:pointer; tsrmls_dc:pointer): Pointer;
 
 procedure UnloadZEND;
@@ -105,9 +96,11 @@ function  ZENDLoaded: boolean;
   _erealloc      : function(ptr: pointer; size: size_t; allow_failure: integer; __zend_filename: zend_pchar; __zend_lineno: uint; __zend_orig_filename: zend_pchar; __zend_orig_line_no: uint): pointer; cdecl;
   _estrdup       : function(const s: zend_pchar; __zend_filename: zend_pchar; __zend_lineno: uint; __zend_orig_filename: zend_pchar; __zend_orig_line_no: uint): pointer; cdecl;
   _estrndup      : function(s: zend_pchar; Len: Cardinal; __zend_filename: zend_pchar; __zend_lineno: uint; __zend_orig_filename: zend_pchar; __zend_orig_line_no: uint): zend_pchar; cdecl;
+  {$ifdef PHP_UNICODE}
   _estrndupu     : function(s: PUTF8Char; Len: Cardinal; __zend_filename: PUTF8Char;
   __zend_lineno: uint; __zend_orig_filename: PUTF8Char;
   __zend_orig_line_no: uint): PUTF8Char; cdecl;
+  {$endif}
 function emalloc(size: size_t): pointer;
 procedure efree(ptr: pointer);
 function ecalloc(nmemb: size_t; size: size_t): pointer;
@@ -674,17 +667,17 @@ procedure ZEND_PUTS(str: zend_pchar);
   zend_startup_modules             : function(TSRMLS_DC:pointer):integer;
   zend_collect_module_handlers     : function(TSRMLS_DC:pointer):integer;
 
-  procedure ZvalVAL(z:pzval; v:Boolean) overload;
-  procedure ZvalVAL(z:pzval; v:Integer; const _type:Integer = IS_LONG) overload;
-  procedure ZvalVAL(z:pzval) overload;
-  procedure ZvalVAL(z:pzval; v:Double) overload;
-  procedure ZvalVAL(z:pzval; v:SmallInt) overload;
-  procedure ZvalVAL(z:pzval; v:Extended) overload;
+  procedure ZvalVAL(z:pzval; v:Boolean); overload;
+  procedure ZvalVAL(z:pzval; v:Integer; const _type:Integer = IS_LONG); overload;
+  procedure ZvalVAL(z:pzval); overload;
+  procedure ZvalVAL(z:pzval; v:Double); overload;
+  procedure ZvalVAL(z:pzval; v:SmallInt); overload;
+  procedure ZvalVAL(z:pzval; v:Extended); overload;
   procedure ZvalVAL(z: pzval; s: zend_ustr; len: Integer = 0); overload;
-  procedure ZvalString(z:pzval) overload;
-  procedure ZvalString(z:pzval; s:zend_pchar; len:Integer = 0) overload;
-  procedure ZvalString(z:pzval; s:PWideChar; len:Integer = 0) overload;
-  procedure ZvalString(z:pzval; s:string; len:Integer = 0) overload;
+  procedure ZvalString(z:pzval); overload;
+  procedure ZvalString(z:pzval; s:zend_pchar; len:Integer = 0); overload;
+  procedure ZvalString(z:pzval; s:PWideChar; len:Integer = 0); overload;
+  procedure ZvalString(z:pzval; s:string; len:Integer = 0); overload;
 
 function ZvalArrayAdd(z: pzval; Args: array of const): Integer; overload;
 function ZvalArrayAdd(z: pzval; idx: Integer; Args: array of const)
@@ -718,9 +711,15 @@ function add_assoc_variant(arg: pzval; key: zend_pchar; key_len: uint; value: va
 procedure ZVAL_ARRAY(z: pzval; arr:  TWSDate); overload;
 procedure ZVAL_ARRAY(z: pzval; arr:  TASDate); overload;
 procedure ZVAL_ARRAY(z: pzval; arr:  array of string); overload;
+{$IFDEF WSTR}
 procedure ZVAL_ARRAY(z: pzval; arr:  array of zend_ustr); overload;
+{$ENDIF}
 procedure ZVAL_ARRAY(z: pzval; arr: array of variant); overload;
+{$if CompilerVersion > 21}
 procedure ZVAL_ARRAY(z: pzval; arr: System.TArray<System.integer>); overload;
+{$else}
+procedure ZVAL_ARRAY(z: pzval; arr: array of integer); overload;
+{$ifend}
 procedure ZVAL_ARRAY(z: pzval; arr: Variant); overload;
 procedure ZVAL_ARRAYAC(z: pzval; keynames: Array of AnsiChar; keyvals: Array of AnsiChar);
 procedure ZVAL_ARRAYWC(z: pzval; keynames: Array of PWideChar; keyvals: Array of PWideChar);
@@ -743,7 +742,9 @@ function ZendToVariant(const Value: pppzval;cobj: TObjectBConvertMethod=nil): Va
 {$ENDIF}
 procedure VariantToZend(const Value: Variant; z: pzval;
 cobj: TObjectAConvertMethod=nil);
+{$IFDEF WSTR}
 procedure ZVAL_RawStr(z: pzval; s:RawByteString; duplicate: boolean);
+{$ENDIF}
 procedure ZVAL_STRING(z: pzval; s: WideString; duplicate: boolean);
 procedure ZVAL_STRINGU(z: pzval; s: UTF8String; duplicate: boolean);
 procedure ZVAL_STRINGW(z: pzval; StW: WideString; duplicate: boolean);
@@ -757,7 +758,7 @@ procedure zend_copy_constant(c: zend_constant);
 {$IF defined(PHP540) or defined(PHP550) or defined(PHP560)}
 procedure zend_copy_constants(target: PHashTable; source: PHashTable); cdecl;
 procedure zend_class_add_ref(aclass: Ppzend_class_entry); cdecl;
-{$ENDIF}
+{$IFEND}
 
 var
   get_zend_version           : function(): zend_pchar; cdecl;
@@ -769,7 +770,7 @@ procedure zend_class_add_ref(aclass: Ppzend_class_entry); cdecl;
 {$IFDEF PHP5}
   {$IF not defined(PHP540) and not defined(PHP550) and not defined(PHP560)}
   zend_copy_constants: procedure(target: PHashTable; source: PHashTable); cdecl;
-  {$ENDIF}
+  {$IFEND}
   zend_objects_new : function (_object : pointer; class_type : pointer; TSRMLS_DC : pointer) : {$IFDEF PHP7}zend_object{$ELSE}_zend_object_value{$ENDIF}; cdecl;
   zend_objects_clone_obj: function(_object: pzval; TSRMLS_DC : pointer): {$IFDEF PHP7}zend_object{$ELSE}_zend_object_value{$ENDIF}; cdecl;
   zend_objects_store_add_ref: procedure (_object : pzval; TSRMLS_DC : pointer); cdecl;
@@ -778,7 +779,7 @@ procedure zend_class_add_ref(aclass: Ppzend_class_entry); cdecl;
   function_add_ref: procedure (func: {$IFDEF PHP7}Pzend_function{$ELSE}PZendFunction{$ENDIF}); cdecl;
   {$IF not defined(PHP540) and not defined(PHP550) and not defined(PHP560)}
   zend_class_add_ref: procedure(aclass: Ppzend_class_entry); cdecl;
-  {$ENDIF}
+  {$IFEND}
 
 {$ENDIF}
 
@@ -826,16 +827,24 @@ function object_init(arg: pzval; ce: pzend_class_entry; TSRMLS_DC : pointer) : i
 function Z_LVAL(z : Pzval) : longint;
 function Z_BVAL(z : Pzval) : boolean;
 function Z_DVAL(z : Pzval) : double;
+{$ifdef WSTR}
 function Z_RAWSTR(z: PZval): RawByteString;
+{$else}
+function Z_RAWSTR(z: PZval): TBytes;
+{$endif}
+
 function Z_STRVAL(z : Pzval) : WideString;
 function Z_ASTRVAL(z : Pzval) : AnsiString;
 function Z_STRUVAL(z : PZval): UTF8String;
-function Z_WSTRVAL(z : pzval) : String;
+function Z_SSTRVAL(z : pzval) : String;
 function Z_CHAR(z: PZval) : zend_uchar;
 function Z_WCHAR(z: PZval) : WideChar;
 function Z_ACHAR(z: PZVAL): AnsiChar;
+{$ifdef WSTR}
 function Z_UCHAR(z: PZVAL): UTF8Char;
-
+{$else}
+function Z_UCHAR(z: PZVAL): AnsiChar;
+{$endif}
 function Z_STRLEN(z : Pzval) : longint;
 function Z_ARRVAL(z : Pzval ) : PHashTable;
 function Z_OBJ_HANDLE(z :Pzval) : {$IFDEF PHP7} P_zend_object_handlers {$ELSE} zend_object_handle{$ENDIF};
@@ -891,6 +900,7 @@ function estrndup(s: zend_pchar; len: Cardinal): zend_pchar;
      else
       Result := nil;
 end;
+{$ifdef PHP_UNICODE}
 function estrndupu(s: PUtf8Char; len: Cardinal): PUTf8Char;
 begin
   if assigned(s) then
@@ -898,6 +908,7 @@ function estrndupu(s: PUtf8Char; len: Cardinal): PUTf8Char;
      else
       Result := nil;
 end;
+{$endif}
 function emalloc(size: size_t): pointer;
 begin
   Result := _emalloc(size, nil, 0, nil, 0);
@@ -1021,7 +1032,7 @@ procedure ZvalString(z:pzval; s:string; len:Integer = 0);
     ZvalString(z, _s, len);
 end;
 
-procedure ZvalVAL(z:pzval; v:Boolean);
+procedure ZvalVAL(z:pzval; v:Boolean); overload;
 Begin
   {$IFDEF PHP7}
   z^.u1.v._type
@@ -1031,7 +1042,7 @@ procedure ZvalVAL(z:pzval; v:Boolean);
   z.value.lval := integer(v);
 End;
 
-procedure ZvalVAL(z:pzval; v:Integer; const _type:Integer = IS_LONG);
+procedure ZvalVAL(z:pzval; v:Integer; const _type:Integer = IS_LONG); overload;
 Begin
   {$IFDEF PHP7}
   z^.u1.v._type
@@ -1041,7 +1052,7 @@ procedure ZvalVAL(z:pzval; v:Integer; const _type:Integer = IS_LONG);
   z^.value.lval := v;
 End;
 
-procedure ZvalVAL(z:pzval);
+procedure ZvalVAL(z:pzval); overload;
 Begin
   {$IFDEF PHP7}
   z^.u1.v._type
@@ -1050,7 +1061,7 @@ procedure ZvalVAL(z:pzval);
   {$ENDIF}  := IS_NULL;
 End;
 
-procedure ZvalVAL(z:pzval; v:Double);
+procedure ZvalVAL(z:pzval; v:Double); overload;
 Begin
   {$IFDEF PHP7}
   z^.u1.v._type
@@ -1060,7 +1071,7 @@ procedure ZvalVAL(z:pzval; v:Double);
   z.value.dval := v;
 End;
 
-procedure ZvalVAL(z:pzval; v:SmallInt);
+procedure ZvalVAL(z:pzval; v:SmallInt); overload;
 begin
   {$IFDEF PHP7}
   z^.u1.v._type
@@ -1070,7 +1081,7 @@ procedure ZvalVAL(z:pzval; v:SmallInt);
   z^.value.lval := v;
 end;
 
-procedure ZvalVAL(z:pzval; v:Extended);
+procedure ZvalVAL(z:pzval; v:Extended); overload;
 Begin
   {$IFDEF PHP7}
   z^.u1.v._type
@@ -1080,7 +1091,7 @@ procedure ZvalVAL(z:pzval; v:Extended);
   z.value.dval := v;
 End;
 
-procedure ZvalVAL(z: pzval; s: zend_ustr; len: Integer = 0);
+procedure ZvalVAL(z: pzval; s: zend_ustr; len: Integer = 0); overload;
 var
   lens: Integer;
   AChar: zend_pchar;
@@ -1294,9 +1305,14 @@ procedure MAKE_STD_ZVAL(out Result: pzval);
 
 
 
-function GetArgPZval;
+function GetArgPZval(Args: TVarRec; const _type: Integer = IS_LONG;
+  Make: Boolean = false): pzval;
 begin
+  {$if CompilerVersion > 21}
   if Args._Reserved1 = 0 then // nil
+  {$else}
+  if Integer(Args.VPointer) = 0 then
+  {$ifend}
   begin
     if Make then
       MAKE_STD_ZVAL(Result);
@@ -1317,14 +1333,27 @@ function GetArgPZval;
         ZvalVAL(Result, Args.VBoolean);
       vtExtended:
         ZvalVAL(Result, Args.VExtended^);
+      {$if CompilerVersion > 21}
       vtClass, vtObject:
         ZvalVAL(Result, Args._Reserved1);
+      {$else}
+      vtClass:
+        ZvalVAL(Result, Integer(Args.VClass));
+      vtObject:
+        ZvalVAL(Result, Integer(Args.VObject));
+      {$ifend}
       vtString:
         ZvalVAL(Result, zend_ustr(Args.VString^));
       vtAnsiString:
         ZvalVAL(Result, zend_pchar(zend_ustr(Args.VAnsiString)));
+      {$ifdef WSTR}
       vtUnicodeString:
+        {$if CompilerVersion > 21}
         ZvalVAL(Result, UnicodeString(Args._Reserved1));
+        {$else}
+        ZvalVal(Result, UnicodeString(Args.VUnicodeString));
+        {$ifend}
+      {$endif}
       vtWideChar:
         ZvalVAL(Result, zend_pchar(Args.VWideChar));
       vtChar:
@@ -1339,7 +1368,7 @@ function GetArgPZval;
   end;
 end;
 
-
+{$ifdef WSTR}
 procedure ZVAL_STRINGU(z: pzval; s: UTF8String; duplicate: boolean);
 var
   sc: PUTF8Char;
@@ -1361,19 +1390,21 @@ procedure ZVAL_RawStr(z: pzval; s: RawByteString; duplicate: boolean);
   SetCodePage(_s, CP_UTF8, not IsUTF8String(_s));
   ZVAL_STRINGU(z, UTF8String(_s), duplicate);
 end;
+{$endif}
 
 procedure ZVAL_STRING(z: pzval; s: WideString; duplicate: boolean);
 begin
   ZVAL_STRINGU(z, UTF8String(s), duplicate);
 end;
+
 procedure ZVAL_STRINGW(z: pzval; StW: WideString; duplicate: boolean);
 var
   St: UTF8String;
   sc: PUTF8Char;
 begin
-
   St := UTF8String(StW);
   sc := PUtf8Char(St);
+  
   z^.value.str.len := Length(St);
   if duplicate then
     z^.value.str.val := estrndup(sc, z^.value.str.len)
@@ -1546,10 +1577,10 @@ procedure VariantToZend(const Value:Variant;z:pzval;
                    ZVAL_STRING(z, '', true);
                  end;
          end;
-
+  {$ifdef VERSION12}
   varUString    :
              ZVAL_RawStr(z, RawByteString(TVarData(Value).VUString), true);
-
+  {$endif}
      varOleStr    :
          begin
            if Assigned ( TVarData(Value).VOleStr ) then
@@ -1592,6 +1623,7 @@ procedure VariantToZend(const Value:Variant;z:pzval;
      end;
      //varRecord : integer(TVarData(Value).VRecord)
      //<==������... � �� ��� ��� �� ���������� ��� � ���� ����� RTTI ��������
+     {$if CompilerVersion > 21}
      varRecord    :
      begin
        if Assigned(cobj) then
@@ -1599,6 +1631,7 @@ procedure VariantToZend(const Value:Variant;z:pzval;
        else
         ZVALVAL(z);
      end;
+
      //varObject : integer(TVarData(Value).VObject)
      //<==������...
      varObject    :
@@ -1608,6 +1641,8 @@ procedure VariantToZend(const Value:Variant;z:pzval;
        else
         ZVALVAL(z, integer(TObject(TVarData(Value).VPointer^)));
      end;
+     {$ifend}
+
      varStrArg    :
          begin
            if Assigned ( TVarData(Value).VString ) then
@@ -1619,10 +1654,13 @@ procedure VariantToZend(const Value:Variant;z:pzval;
                    ZVAL_STRING(z, '', true);
                  end;
          end;
-
+     {$if CompilerVersion > 21}
      varUStrArg  : ZVAL_RawStr(z, RawByteString(TVarData(Value).VUString), true);
+     {$ifend}
      varInt64    : ZVALVAL(z, TVarData(Value).VInt64);
+     {$ifdef VERSION14}
      varUInt64   : ZVALVAL(z, TVarData(Value).VUInt64);
+     {$endif}
      varShortInt : ZVALVAL(z, Integer(TVarData(Value).VShortInt));
      varSmallInt : ZVALVAL(z, Integer(TVarData(Value).VSmallint));
      varInteger  : ZVALVAL(z, TVarData(Value).VInteger);
@@ -1816,7 +1854,7 @@ procedure ZVAL_ARRAY(z: pzval; arr: array of string); overload;
     end;
     Exit;
 end;
-
+{$ifdef WSTR}
 procedure ZVAL_ARRAY(z: pzval; arr:  array of zend_ustr); overload;
 var
   i: integer;
@@ -1843,6 +1881,7 @@ procedure ZVAL_ARRAY(z: pzval; arr:  array of zend_ustr); overload;
     end;
     Exit;
 end;
+{$endif}
 
 procedure ZVAL_ARRAY(z: pzval; arr:  array of variant); overload;
 var
@@ -1870,7 +1909,12 @@ procedure ZVAL_ARRAY(z: pzval; arr:  array of variant); overload;
     end;
     Exit;
 end;
+
+{$ifdef VERSION14}
 procedure ZVAL_ARRAY(z: pzval; arr: System.TArray<System.integer>); overload;
+{$else}
+procedure ZVAL_ARRAY(z: pzval; arr: array of integer); overload;
+{$endif}
 var
   i: integer;
 begin
@@ -2149,7 +2193,12 @@ procedure UnloadZEND;
     FreeLibrary(H);
   end;
 end;
+
+{$ifdef VERSION12}
 function Lfunc(var Func: Pointer; addr: LPCWSTR): BOOL;
+{$else}
+function Lfunc(var Func: Pointer; addr: PAnsiChar): BOOL;
+{$endif}
 begin
   Result := True;
   Func := GetProcAddress(PHPLib, addr);
@@ -2161,7 +2210,11 @@ function Lfunc(var Func: Pointer; addr: LPCWSTR): BOOL;
     Result := False;
   end;
 end;
+{$ifdef VERSION12}
 function HFunc(const Func: Pointer; addr: LPCWSTR): BOOL;
+{$else}
+function HFunc(const Func: Pointer; addr: PAnsiChar): Bool;
+{$endif}
 var fr: FARPROC;
 begin
   Result := True;
@@ -2197,16 +2250,19 @@ procedure zend_class_add_ref(aclass: Ppzend_class_entry); cdecl;
 begin
   Inc(aclass^.refcount,1);
 end;
-{$ENDIF}
-function LoadZEND(const DllFilename: zend_ustr = PHPWin) : boolean;
+{$IFEND}
+function LoadZEND(const LibraryPath: zend_ustr = PHPlp) : boolean;
 var
   WriteFuncPtr  : pointer;
 begin
  {$IFDEF QUIET_LOAD}
   Result := false;
  {$ENDIF}
-  PHPLib := LoadLibrary( PWideChar(WideString(DllFilename)) );
-
+ {$if CompilerVersion >= 20}
+  PHPLib := LoadLibrary( PWideChar(WideString(LibraryPath)) );
+ {$else}
+  PHPLib := LoadLibrary( String( LibraryPath ) );
+ {$ifend}
 {$IFNDEF QUIET_LOAD}
   if PHPLib = 0 then
   begin
@@ -2220,13 +2276,13 @@ function LoadZEND(const DllFilename: zend_ustr = PHPWin) : boolean;
  {$IFDEF PHP5}
  {$IF not defined(PHP540) and not defined(PHP550) and not defined(PHP560)}
    LFunc(@zend_copy_constants, 'zend_copy_constants');
- {$ENDIF}
+ {$IFEND}
    LFunc(@zend_objects_new, 'zend_objects_new');
    LFunc(@zend_objects_clone_obj, 'zend_objects_clone_obj');
    LFunc(@function_add_ref, 'function_add_ref');
  {$IF not defined(PHP540) and not defined(PHP550) and not defined(PHP560)}
    LFunc(@zend_class_add_ref, 'zend_class_add_ref');
- {$ENDIF}
+ {$IFEND}
 
    LFunc(@zend_objects_store_add_ref, 'zend_objects_store_add_ref');
    LFunc(@zend_objects_store_del_ref, 'zend_objects_store_del_ref');
@@ -2327,6 +2383,7 @@ function LoadZEND(const DllFilename: zend_ustr = PHPWin) : boolean;
   '_estrndup@@8'
   {$ENDIF});
 
+  {$ifdef PHP_UNICODE}
   // -- _estrndup  Unicode
   LFunc(@_estrndupu,
   {$IFNDEF PHP7}
@@ -2334,6 +2391,7 @@ function LoadZEND(const DllFilename: zend_ustr = PHPWin) : boolean;
   {$ELSE}
   '_estrndup@@8'
   {$ENDIF});
+  {$endif}
 
   // -- zend_set_memory_limit
   LFunc(@zend_set_memory_limit, 'zend_set_memory_limit');
@@ -3469,7 +3527,21 @@ function Z_VARREC(z: pzval): TVarRec;
         end;
     end;
 end;
-function Z_RawStr(z: pzval): RawByteString;
+{$ifndef WSTR}
+function RawByteString(s: String): TBytes; overload;
+begin
+	
+end;
+
+function RawByteString(s: PAnsiChar): TBytes; overload;
+begin
+	
+end;
+
+function Z_RAWSTR(z: pzval): TBytes;
+{$else}
+function Z_RAWSTR(z: pzval): RawByteString;
+{$endif}
 {$ifdef fpc}
 var
   s_len: SizeInt;
@@ -3485,7 +3557,7 @@ function Z_RawStr(z: pzval): RawByteString;
         Result := RawByteString('False');
     end;
     IS_LONG:
-      Result := RawByteString(inttostr(z^.value.lval));
+      Result := RawByteString(IntToStr(z^.value.lval));
     IS_DOUBLE:
       Result := RawByteString(FloatToStr(z^.value.dval));
     IS_STRING:
@@ -3516,7 +3588,7 @@ function Z_ASTRVAL(z : pzval) : AnsiString;
   Result := AnsiString(Z_RawStr(z));
 end;
 
-function Z_WSTRVAL(z : pzval) : String;
+function Z_SSTRVAL(z : pzval) : String;
 begin
   Result := String(Z_RawStr(z));
 end;
@@ -3576,6 +3648,7 @@ function Z_WCHAR(z: PZVAL): WideChar;
   SetLength(S,1);
   Result := WideChar(S[1]);
 end;
+{$ifdef WSTR}
 function Z_UCHAR(z: PZVAL): UTF8Char;
 var S: UTF8String;
 begin
@@ -3594,6 +3667,12 @@ function Z_UCHAR(z: PZVAL): UTF8Char;
   SetLength(S,1);
   Result := Utf8Char(S[1]);
 end;
+{$else}
+function Z_UCHAR(z: PZVAL): AnsiChar;
+begin
+	Result := Z_ACHAR(z);
+end;
+{$endif}
 
 function Z_STRLEN(z : pzval) : longint;
 begin
@@ -3703,13 +3782,13 @@ function  DupStr(strSource : zend_pchar) : zend_pchar; cdecl;
 end;
 {$ENDIF}
 
-initialization
 {$IFDEF PHP4DELPHI_AUTOLOAD}
+initialization
   LoadZEND;
 {$ENDIF}
 
-finalization
 {$IFDEF PHP4DELPHI_AUTOUNLOAD}
+finalization
   UnloadZEND;
 {$ENDIF}
 
diff --git a/Source/ZendTypes.pas b/Source/ZendTypes.pas
index dcc97c5..63588f9 100644
--- a/Source/ZendTypes.pas
+++ b/Source/ZendTypes.pas
@@ -16,7 +16,7 @@
 interface
 
 uses
-  {$IFNDEF FPC} Windows {$ELSE} LCLType{$ENDIF}, {$IFDEF PHP7} hzend_types, {$ENDIF} SysUtils;
+  {$IFNDEF FPC} Windows {$ELSE} LCLType{$ENDIF}, SysUtils;
 
 const
   //zend.h
@@ -340,47 +340,36 @@ interface
 
   //zend_modules.h
 const
-{$IFDEF PHP7}
-   ZEND_MODULE_API_NO = 20151012;
-{$ELSE}
-  {$IFDEF PHP530}
-    ZEND_MODULE_API_NO                        =
-   {$IFDEF PHP560}
-    20131226
-   {$ELSE}
-    {$IFDEF PHP550}20121212{$ELSE}{$IFDEF PHP540}20100525{$ELSE}20090626{$ENDIF}{$ENDIF}
-    {$ENDIF};
-  {$ELSE}
-  {$IFDEF PHP520}
-    ZEND_MODULE_API_NO                          = 20060613;
-  {$ELSE}
-  {$IFDEF PHP512}
-   ZEND_MODULE_API_NO                          = 20050922;
-    {$ELSE}
-     {$IFDEF PHP511}
-     ZEND_MODULE_API_NO                       = 20050922;
-      {$ELSE}
-       {$IFDEF PHP510}
-       ZEND_MODULE_API_NO                     = 20050617;
-        {$ELSE}
-          {$IFDEF PHP504}
-          ZEND_MODULE_API_NO                  =  20041030;
-           {$ELSE}
-            ZEND_MODULE_API_NO                =  20040412;
-          {$ENDIF}
-       {$ENDIF}
-     {$ENDIF}
-   {$ENDIF}
-   {$ENDIF}
-{$ENDIF}
-{$ENDIF}
-{$IFDEF ZTS}
-const
-  USING_ZTS                                       = 1;
-{$ELSE}
+   ZEND_MODULE_API_NO_700 = 20151012;
+   ZEND_MODULE_API_NO_560 = 20131226;
+   ZEND_MODULE_API_NO_550 = 20121212;
+   ZEND_MODULE_API_NO_540 = 20100525;
+   ZEND_MODULE_API_NO_530 = 20090626;
+   ZEND_MODULE_API_NO_520 = 20060613;
+   ZEND_MODULE_API_NO_511 = 20050922;
+   ZEND_MODULE_API_NO_510 = 20050617;
+   ZEND_MODULE_API_NO_504 = 20041030;
+   ZEND_MODULE_API_NO_500 = 20040412;
+   
+   ZEND_MODULE_API_NO =
+   {$ifdef PHP700}20151012
+   {$elseif defined(PHP560)}20131226
+   {$elseif defined(PHP550)}20121212
+   {$elseif defined(PHP540)}20100525
+   {$elseif defined(PHP530)}20090626
+   {$elseif defined(PHP520)}20060613
+   {$elseif defined(PHP512)}20050922
+   {$elseif defined(PHP511)}20050922
+   {$elseif defined(PHP510)}20050617
+   {$elseif defined(PHP504)}20041030
+   {$else}20040412
+   {$ifend};
+
 const
-  USING_ZTS                                       = 0;
-{$ENDIF}
+  USING_ZTS   = 
+  {$ifdef ZTS}1
+  {$else}0
+  {$endif};
 
 
 const
@@ -493,14 +482,18 @@ interface
   UIntPtr = LongWord;
   ULongPtr = ULong;
   {$ENDIF}
+  {$if defined(WSTR) and (CompilerVersion < 22) }
+  UTF8Char = AnsiChar;
+  PUTF8Char = PAnsiChar;
+  {$ifend}
   zend_uint   = UIntPtr;
   zend_bool   = boolean;
-  zend_uchar  = {$IF Defined(PHP_UNICODE)}Utf8Char{$ELSE}AnsiChar{$ENDIF};
-  zend_ustr   = {$IF Defined(PHP_UNICODE)}UTF8String{$ELSE}AnsiString{$ENDIF};
+  zend_uchar  = {$IFDEF PHP_UNICODE}UTF8Char{$ELSE}AnsiChar{$ENDIF};
+  zend_ustr   = {$IFDEF PHP_UNICODE}UTF8String{$ELSE}AnsiString{$ENDIF};
   zend_ulong  = ULongPtr;
   zend_long   = IntPtr;
-  zend_pchar  = {$IF Defined(PHP_UNICODE)}PUtf8Char{$ELSE}PAnsiChar{$ENDIF};
-  zend_pstr   = {$IF Defined(PHP_UNICODE)}PUtf8String{$ELSE}PAnsiString{$ENDIF};
+  zend_pchar  = {$IFDEF PHP_UNICODE}PUTF8Char{$ELSE}PAnsiChar{$ENDIF};
+  zend_pstr   = {$IFDEF PHP_UNICODE}PUtf8String{$ELSE}PAnsiString{$ENDIF};
   {$IFDEF PHP7}
   _zend_refcounted_h = record
       refcount : cardinal;
@@ -1077,7 +1070,7 @@   _zend_stream = record
     _type : zend_stream_type;
     {$ELSE}
     _type: uchar;
-    {$ENDIF}
+    {$IFEND}
     filename: zend_pchar;
     opened_path: zend_pchar;
     handle:
diff --git a/Source/packages/php4delphi Delphi 10 Seattle.groupproj.local b/Source/packages/php4delphi Delphi 10 Seattle.groupproj.local
deleted file mode 100644
index 744d98c..0000000
--- a/Source/packages/php4delphi Delphi 10 Seattle.groupproj.local	
+++ /dev/null
@@ -1,12 +0,0 @@
-﻿<?xml version="1.0" encoding="utf-8"?>
-<BorlandProject>
-	<Transactions>
-    <Transaction>1899.12.30 00:00:00.000.717,C:\Users\Andrew\Documents\GitHub\php4delphi\ProjectGroup1.groupproj=C:\Users\Andrew\Documents\GitHub\php4delphi\php4delphi2010.groupproj</Transaction>
-    <Transaction>1899.12.30 00:00:00.000.086,C:\Users\Andrew\Documents\GitHub\php4delphi\php4delphi2010.groupproj=C:\Users\Andrew\Documents\GitHub\php4delphi\php4delphi 10 Seattle.groupproj</Transaction>
-    <Transaction>1899.12.30 00:00:00.000.120,C:\Users\Andrew\Documents\GitHub\php4delphi\packages\php4delphi Delphi 10.1 Berlin.groupproj=C:\Users\Andrew\Documents\GitHub\php4delphi\php4delphi Delphi 10.1 Berlin.groupproj</Transaction>
-    <Transaction>1899.12.30 00:00:00.000.047,C:\Users\Andrew\Documents\GitHub\php4delphi\php4delphi 10 Seattle.groupproj=C:\Users\Andrew\Documents\GitHub\php4delphi\php4delphi Delphi 10 Seattle.groupproj</Transaction>
-  </Transactions>
-	<Default.Personality>
-		<Projects ActiveProject="C:\Users\Andrew\Documents\GitHub\php4delphi\Source\php4DelphiR2010.dproj"/>
-	</Default.Personality>
-</BorlandProject>
diff --git a/Source/packages/php4delphi Delphi 10.1 Berlin.groupproj.local b/Source/packages/php4delphi Delphi 10.1 Berlin.groupproj.local
deleted file mode 100644
index dbd6596..0000000
--- a/Source/packages/php4delphi Delphi 10.1 Berlin.groupproj.local	
+++ /dev/null
@@ -1,11 +0,0 @@
-﻿<?xml version="1.0" encoding="utf-8"?>
-<BorlandProject>
-	<Transactions>
-    <Transaction>1899.12.30 00:00:00.000.086,C:\Users\Andrew\Documents\GitHub\php4delphi\php4delphi2010.groupproj=C:\Users\Andrew\Documents\GitHub\php4delphi\php4delphi 10 Seattle.groupproj</Transaction>
-    <Transaction>1899.12.30 00:00:00.000.717,C:\Users\Andrew\Documents\GitHub\php4delphi\ProjectGroup1.groupproj=C:\Users\Andrew\Documents\GitHub\php4delphi\php4delphi2010.groupproj</Transaction>
-    <Transaction>1899.12.30 00:00:00.000.047,C:\Users\Andrew\Documents\GitHub\php4delphi\php4delphi 10 Seattle.groupproj=C:\Users\Andrew\Documents\GitHub\php4delphi\php4delphi Delphi 10 Seattle.groupproj</Transaction>
-  </Transactions>
-	<Default.Personality>
-		<Projects ActiveProject="C:\Users\Lev\Documents\GitHub\php4delphi\Source\php4DelphiD2010.dproj"/>
-	</Default.Personality>
-</BorlandProject>
diff --git a/Source/packages/php4delphi Delphi 10.2 Tokyo.groupproj.local b/Source/packages/php4delphi Delphi 10.2 Tokyo.groupproj.local
deleted file mode 100644
index 35948ce..0000000
--- a/Source/packages/php4delphi Delphi 10.2 Tokyo.groupproj.local	
+++ /dev/null
@@ -1,13 +0,0 @@
-﻿<?xml version="1.0" encoding="utf-8"?>
-<BorlandProject>
-	<Transactions>
-    <Transaction>1899.12.30 00:00:00.000.086,C:\Users\Andrew\Documents\GitHub\php4delphi\php4delphi2010.groupproj=C:\Users\Andrew\Documents\GitHub\php4delphi\php4delphi 10 Seattle.groupproj</Transaction>
-    <Transaction>1899.12.30 00:00:00.000.717,C:\Users\Andrew\Documents\GitHub\php4delphi\ProjectGroup1.groupproj=C:\Users\Andrew\Documents\GitHub\php4delphi\php4delphi2010.groupproj</Transaction>
-    <Transaction>1899.12.30 00:00:00.000.047,C:\Users\Andrew\Documents\GitHub\php4delphi\php4delphi 10 Seattle.groupproj=C:\Users\Andrew\Documents\GitHub\php4delphi\php4delphi Delphi 10 Seattle.groupproj</Transaction>
-    <Transaction>2019.03.04 22:31:53.120,C:\Users\Andrew\Documents\GitHub\php4delphi\packages\php4delphi Delphi 10.1 Berlin.groupproj=C:\Users\Andrew\Documents\GitHub\php4delphi\php4delphi Delphi 10.1 Berlin.groupproj</Transaction>
-    <Transaction>2019.03.04 22:32:03.207,C:\Users\Andrew\Documents\GitHub\php4delphi\packages\php4delphi Delphi 10 Seattle.groupproj=C:\Users\Andrew\Documents\GitHub\php4delphi\packages\php4delphi Delphi 10.1 Berlin.groupproj</Transaction>
-  </Transactions>
-	<Default.Personality>
-		<Projects ActiveProject="C:\Users\Andrew\Documents\GitHub\php4delphi\php4DelphiD2010.dproj"/>
-	</Default.Personality>
-</BorlandProject>
diff --git a/Source/packages/php4delphi Delphi 2010.groupproj.local b/Source/packages/php4delphi Delphi 2010.groupproj.local
deleted file mode 100644
index ce4c03c..0000000
--- a/Source/packages/php4delphi Delphi 2010.groupproj.local	
+++ /dev/null
@@ -1,23 +0,0 @@
-﻿<?xml version="1.0" encoding="utf-8"?>
-<BorlandProject>
-	<Transactions>
-    <Transaction>1899.12.30 00:00:00.000.047,C:\Users\Andrew\Documents\GitHub\php4delphi\php4delphi 10 Seattle.groupproj=C:\Users\Andrew\Documents\GitHub\php4delphi\php4delphi Delphi 10 Seattle.groupproj</Transaction>
-    <Transaction>1899.12.30 00:00:00.000.086,C:\Users\Andrew\Documents\GitHub\php4delphi\php4delphi2010.groupproj=C:\Users\Andrew\Documents\GitHub\php4delphi\php4delphi 10 Seattle.groupproj</Transaction>
-    <Transaction>1899.12.30 00:00:00.000.717,C:\Users\Andrew\Documents\GitHub\php4delphi\ProjectGroup1.groupproj=C:\Users\Andrew\Documents\GitHub\php4delphi\php4delphi2010.groupproj</Transaction>
-    <Transaction>2019.03.04 22:31:53.120,C:\Users\Andrew\Documents\GitHub\php4delphi\packages\php4delphi Delphi 10.1 Berlin.groupproj=C:\Users\Andrew\Documents\GitHub\php4delphi\php4delphi Delphi 10.1 Berlin.groupproj</Transaction>
-    <Transaction>2019.03.04 22:32:03.207,C:\Users\Andrew\Documents\GitHub\php4delphi\packages\php4delphi Delphi 10 Seattle.groupproj=C:\Users\Andrew\Documents\GitHub\php4delphi\packages\php4delphi Delphi 10.1 Berlin.groupproj</Transaction>
-    <Transaction>2019.03.04 22:32:09.673,C:\Users\Andrew\Documents\GitHub\php4delphi\packages\php4delphi Delphi 10.2 Tokyo.groupproj=C:\Users\Andrew\Documents\GitHub\php4delphi\packages\php4delphi Delphi 10 Seattle.groupproj</Transaction>
-    <Transaction>2019.03.04 22:32:17.131,C:\Users\Andrew\Documents\GitHub\php4delphi\packages\php4delphi Delphi XE1.groupproj=C:\Users\Andrew\Documents\GitHub\php4delphi\packages\php4delphi Delphi 10.2 Tokyo.groupproj</Transaction>
-    <Transaction>2019.03.04 22:32:22.720,C:\Users\Andrew\Documents\GitHub\php4delphi\packages\php4delphi Delphi XE2.groupproj=C:\Users\Andrew\Documents\GitHub\php4delphi\packages\php4delphi Delphi XE1.groupproj</Transaction>
-    <Transaction>2019.03.04 22:32:29.457,C:\Users\Andrew\Documents\GitHub\php4delphi\packages\php4delphi Delphi XE3.groupproj=C:\Users\Andrew\Documents\GitHub\php4delphi\packages\php4delphi Delphi XE2.groupproj</Transaction>
-    <Transaction>2019.03.04 22:32:34.993,C:\Users\Andrew\Documents\GitHub\php4delphi\packages\php4delphi Delphi XE4.groupproj=C:\Users\Andrew\Documents\GitHub\php4delphi\packages\php4delphi Delphi XE3.groupproj</Transaction>
-    <Transaction>2019.03.04 22:32:41.465,C:\Users\Andrew\Documents\GitHub\php4delphi\packages\php4delphi Delphi XE5.groupproj=C:\Users\Andrew\Documents\GitHub\php4delphi\packages\php4delphi Delphi XE4.groupproj</Transaction>
-    <Transaction>2019.03.04 22:32:46.928,C:\Users\Andrew\Documents\GitHub\php4delphi\packages\php4delphi Delphi XE6.groupproj=C:\Users\Andrew\Documents\GitHub\php4delphi\packages\php4delphi Delphi XE5.groupproj</Transaction>
-    <Transaction>2019.03.04 22:32:52.359,C:\Users\Andrew\Documents\GitHub\php4delphi\packages\php4delphi Delphi XE7.groupproj=C:\Users\Andrew\Documents\GitHub\php4delphi\packages\php4delphi Delphi XE6.groupproj</Transaction>
-    <Transaction>2019.03.04 22:32:58.134,C:\Users\Andrew\Documents\GitHub\php4delphi\packages\php4delphi Delphi XE8.groupproj=C:\Users\Andrew\Documents\GitHub\php4delphi\packages\php4delphi Delphi XE7.groupproj</Transaction>
-    <Transaction>2019.03.04 22:33:22.418,C:\Users\Andrew\Documents\GitHub\php4delphi\packages\php4delphi Delphi 2011.groupproj=C:\Users\Andrew\Documents\GitHub\php4delphi\packages\php4delphi Delphi XE8.groupproj</Transaction>
-  </Transactions>
-	<Default.Personality>
-		<Projects ActiveProject="C:\Users\Andrew\Documents\GitHub\php4delphi\php4DelphiD2010.dproj"/>
-	</Default.Personality>
-</BorlandProject>
diff --git a/Source/packages/php4delphi Delphi 2011.groupproj.local b/Source/packages/php4delphi Delphi 2011.groupproj.local
deleted file mode 100644
index c2c593f..0000000
--- a/Source/packages/php4delphi Delphi 2011.groupproj.local	
+++ /dev/null
@@ -1,22 +0,0 @@
-﻿<?xml version="1.0" encoding="utf-8"?>
-<BorlandProject>
-	<Transactions>
-    <Transaction>1899.12.30 00:00:00.000.047,C:\Users\Andrew\Documents\GitHub\php4delphi\php4delphi 10 Seattle.groupproj=C:\Users\Andrew\Documents\GitHub\php4delphi\php4delphi Delphi 10 Seattle.groupproj</Transaction>
-    <Transaction>1899.12.30 00:00:00.000.717,C:\Users\Andrew\Documents\GitHub\php4delphi\ProjectGroup1.groupproj=C:\Users\Andrew\Documents\GitHub\php4delphi\php4delphi2010.groupproj</Transaction>
-    <Transaction>1899.12.30 00:00:00.000.086,C:\Users\Andrew\Documents\GitHub\php4delphi\php4delphi2010.groupproj=C:\Users\Andrew\Documents\GitHub\php4delphi\php4delphi 10 Seattle.groupproj</Transaction>
-    <Transaction>2019.03.04 22:31:53.120,C:\Users\Andrew\Documents\GitHub\php4delphi\packages\php4delphi Delphi 10.1 Berlin.groupproj=C:\Users\Andrew\Documents\GitHub\php4delphi\php4delphi Delphi 10.1 Berlin.groupproj</Transaction>
-    <Transaction>2019.03.04 22:32:03.207,C:\Users\Andrew\Documents\GitHub\php4delphi\packages\php4delphi Delphi 10 Seattle.groupproj=C:\Users\Andrew\Documents\GitHub\php4delphi\packages\php4delphi Delphi 10.1 Berlin.groupproj</Transaction>
-    <Transaction>2019.03.04 22:32:09.673,C:\Users\Andrew\Documents\GitHub\php4delphi\packages\php4delphi Delphi 10.2 Tokyo.groupproj=C:\Users\Andrew\Documents\GitHub\php4delphi\packages\php4delphi Delphi 10 Seattle.groupproj</Transaction>
-    <Transaction>2019.03.04 22:32:17.131,C:\Users\Andrew\Documents\GitHub\php4delphi\packages\php4delphi Delphi XE1.groupproj=C:\Users\Andrew\Documents\GitHub\php4delphi\packages\php4delphi Delphi 10.2 Tokyo.groupproj</Transaction>
-    <Transaction>2019.03.04 22:32:22.720,C:\Users\Andrew\Documents\GitHub\php4delphi\packages\php4delphi Delphi XE2.groupproj=C:\Users\Andrew\Documents\GitHub\php4delphi\packages\php4delphi Delphi XE1.groupproj</Transaction>
-    <Transaction>2019.03.04 22:32:29.457,C:\Users\Andrew\Documents\GitHub\php4delphi\packages\php4delphi Delphi XE3.groupproj=C:\Users\Andrew\Documents\GitHub\php4delphi\packages\php4delphi Delphi XE2.groupproj</Transaction>
-    <Transaction>2019.03.04 22:32:34.993,C:\Users\Andrew\Documents\GitHub\php4delphi\packages\php4delphi Delphi XE4.groupproj=C:\Users\Andrew\Documents\GitHub\php4delphi\packages\php4delphi Delphi XE3.groupproj</Transaction>
-    <Transaction>2019.03.04 22:32:41.465,C:\Users\Andrew\Documents\GitHub\php4delphi\packages\php4delphi Delphi XE5.groupproj=C:\Users\Andrew\Documents\GitHub\php4delphi\packages\php4delphi Delphi XE4.groupproj</Transaction>
-    <Transaction>2019.03.04 22:32:46.928,C:\Users\Andrew\Documents\GitHub\php4delphi\packages\php4delphi Delphi XE6.groupproj=C:\Users\Andrew\Documents\GitHub\php4delphi\packages\php4delphi Delphi XE5.groupproj</Transaction>
-    <Transaction>2019.03.04 22:32:52.359,C:\Users\Andrew\Documents\GitHub\php4delphi\packages\php4delphi Delphi XE7.groupproj=C:\Users\Andrew\Documents\GitHub\php4delphi\packages\php4delphi Delphi XE6.groupproj</Transaction>
-    <Transaction>2019.03.04 22:32:58.134,C:\Users\Andrew\Documents\GitHub\php4delphi\packages\php4delphi Delphi XE8.groupproj=C:\Users\Andrew\Documents\GitHub\php4delphi\packages\php4delphi Delphi XE7.groupproj</Transaction>
-  </Transactions>
-	<Default.Personality>
-		<Projects ActiveProject="C:\Users\Andrew\Documents\GitHub\php4delphi\php4DelphiD2010.dproj"/>
-	</Default.Personality>
-</BorlandProject>
diff --git a/Source/packages/php4delphi Delphi 5.bpg b/Source/packages/php4delphi Delphi 5.bpg
new file mode 100644
index 0000000..aa42dc7
--- /dev/null
+++ b/Source/packages/php4delphi Delphi 5.bpg	
@@ -0,0 +1,23 @@
+#------------------------------------------------------------------------------
+VERSION = BWS.01
+#------------------------------------------------------------------------------
+!ifndef ROOT
+ROOT = $(MAKEDIR)\..
+!endif
+#------------------------------------------------------------------------------
+MAKE = $(ROOT)\bin\make.exe -$(MAKEFLAGS) -f$**
+DCC = $(ROOT)\bin\dcc32.exe $**
+BRCC = $(ROOT)\bin\brcc32.exe $**
+#------------------------------------------------------------------------------
+PROJECTS = php4DelphiR5.bpl php4DelphiD5.bpl
+#------------------------------------------------------------------------------
+default: $(PROJECTS)
+#------------------------------------------------------------------------------
+
+php4DelphiR5.bpl: ..\php4DelphiR5.dpk
+  $(DCC)
+
+php4DelphiD5.bpl: ..\php4DelphiD5.dpk
+  $(DCC)
+
+
diff --git a/Source/packages/php4delphi Delphi 7.bpg b/Source/packages/php4delphi Delphi 7.bpg
new file mode 100644
index 0000000..dce47b4
--- /dev/null
+++ b/Source/packages/php4delphi Delphi 7.bpg	
@@ -0,0 +1,23 @@
+#------------------------------------------------------------------------------
+VERSION = BWS.01
+#------------------------------------------------------------------------------
+!ifndef ROOT
+ROOT = $(MAKEDIR)\..
+!endif
+#------------------------------------------------------------------------------
+MAKE = $(ROOT)\bin\make.exe -$(MAKEFLAGS) -f$**
+DCC = $(ROOT)\bin\dcc32.exe $**
+BRCC = $(ROOT)\bin\brcc32.exe $**
+#------------------------------------------------------------------------------
+PROJECTS = php4DelphiR7.bpl php4DelphiD7.bpl
+#------------------------------------------------------------------------------
+default: $(PROJECTS)
+#------------------------------------------------------------------------------
+
+php4DelphiR7.bpl: ..\php4DelphiR7.dpk
+  $(DCC)
+
+php4DelphiD7.bpl: ..\php4DelphiD7.dpk
+  $(DCC)
+
+
diff --git a/Source/packages/php4delphi Delphi XE1.groupproj.local b/Source/packages/php4delphi Delphi XE1.groupproj.local
deleted file mode 100644
index 730de94..0000000
--- a/Source/packages/php4delphi Delphi XE1.groupproj.local	
+++ /dev/null
@@ -1,14 +0,0 @@
-﻿<?xml version="1.0" encoding="utf-8"?>
-<BorlandProject>
-	<Transactions>
-    <Transaction>1899.12.30 00:00:00.000.086,C:\Users\Andrew\Documents\GitHub\php4delphi\php4delphi2010.groupproj=C:\Users\Andrew\Documents\GitHub\php4delphi\php4delphi 10 Seattle.groupproj</Transaction>
-    <Transaction>1899.12.30 00:00:00.000.717,C:\Users\Andrew\Documents\GitHub\php4delphi\ProjectGroup1.groupproj=C:\Users\Andrew\Documents\GitHub\php4delphi\php4delphi2010.groupproj</Transaction>
-    <Transaction>1899.12.30 00:00:00.000.047,C:\Users\Andrew\Documents\GitHub\php4delphi\php4delphi 10 Seattle.groupproj=C:\Users\Andrew\Documents\GitHub\php4delphi\php4delphi Delphi 10 Seattle.groupproj</Transaction>
-    <Transaction>2019.03.04 22:31:53.120,C:\Users\Andrew\Documents\GitHub\php4delphi\packages\php4delphi Delphi 10.1 Berlin.groupproj=C:\Users\Andrew\Documents\GitHub\php4delphi\php4delphi Delphi 10.1 Berlin.groupproj</Transaction>
-    <Transaction>2019.03.04 22:32:03.207,C:\Users\Andrew\Documents\GitHub\php4delphi\packages\php4delphi Delphi 10 Seattle.groupproj=C:\Users\Andrew\Documents\GitHub\php4delphi\packages\php4delphi Delphi 10.1 Berlin.groupproj</Transaction>
-    <Transaction>2019.03.04 22:32:09.673,C:\Users\Andrew\Documents\GitHub\php4delphi\packages\php4delphi Delphi 10.2 Tokyo.groupproj=C:\Users\Andrew\Documents\GitHub\php4delphi\packages\php4delphi Delphi 10 Seattle.groupproj</Transaction>
-  </Transactions>
-	<Default.Personality>
-		<Projects ActiveProject="C:\Users\Andrew\Documents\GitHub\php4delphi\php4DelphiD2010.dproj"/>
-	</Default.Personality>
-</BorlandProject>
diff --git a/Source/packages/php4delphi Delphi XE2.groupproj.local b/Source/packages/php4delphi Delphi XE2.groupproj.local
deleted file mode 100644
index c62f4a8..0000000
--- a/Source/packages/php4delphi Delphi XE2.groupproj.local	
+++ /dev/null
@@ -1,15 +0,0 @@
-﻿<?xml version="1.0" encoding="utf-8"?>
-<BorlandProject>
-	<Transactions>
-    <Transaction>1899.12.30 00:00:00.000.086,C:\Users\Andrew\Documents\GitHub\php4delphi\php4delphi2010.groupproj=C:\Users\Andrew\Documents\GitHub\php4delphi\php4delphi 10 Seattle.groupproj</Transaction>
-    <Transaction>1899.12.30 00:00:00.000.047,C:\Users\Andrew\Documents\GitHub\php4delphi\php4delphi 10 Seattle.groupproj=C:\Users\Andrew\Documents\GitHub\php4delphi\php4delphi Delphi 10 Seattle.groupproj</Transaction>
-    <Transaction>1899.12.30 00:00:00.000.717,C:\Users\Andrew\Documents\GitHub\php4delphi\ProjectGroup1.groupproj=C:\Users\Andrew\Documents\GitHub\php4delphi\php4delphi2010.groupproj</Transaction>
-    <Transaction>2019.03.04 22:31:53.120,C:\Users\Andrew\Documents\GitHub\php4delphi\packages\php4delphi Delphi 10.1 Berlin.groupproj=C:\Users\Andrew\Documents\GitHub\php4delphi\php4delphi Delphi 10.1 Berlin.groupproj</Transaction>
-    <Transaction>2019.03.04 22:32:03.207,C:\Users\Andrew\Documents\GitHub\php4delphi\packages\php4delphi Delphi 10 Seattle.groupproj=C:\Users\Andrew\Documents\GitHub\php4delphi\packages\php4delphi Delphi 10.1 Berlin.groupproj</Transaction>
-    <Transaction>2019.03.04 22:32:09.673,C:\Users\Andrew\Documents\GitHub\php4delphi\packages\php4delphi Delphi 10.2 Tokyo.groupproj=C:\Users\Andrew\Documents\GitHub\php4delphi\packages\php4delphi Delphi 10 Seattle.groupproj</Transaction>
-    <Transaction>2019.03.04 22:32:17.131,C:\Users\Andrew\Documents\GitHub\php4delphi\packages\php4delphi Delphi XE1.groupproj=C:\Users\Andrew\Documents\GitHub\php4delphi\packages\php4delphi Delphi 10.2 Tokyo.groupproj</Transaction>
-  </Transactions>
-	<Default.Personality>
-		<Projects ActiveProject="C:\Users\Andrew\Documents\GitHub\php4delphi\php4DelphiD2010.dproj"/>
-	</Default.Personality>
-</BorlandProject>
diff --git a/Source/packages/php4delphi Delphi XE3.groupproj.local b/Source/packages/php4delphi Delphi XE3.groupproj.local
deleted file mode 100644
index 5380455..0000000
--- a/Source/packages/php4delphi Delphi XE3.groupproj.local	
+++ /dev/null
@@ -1,16 +0,0 @@
-﻿<?xml version="1.0" encoding="utf-8"?>
-<BorlandProject>
-	<Transactions>
-    <Transaction>1899.12.30 00:00:00.000.086,C:\Users\Andrew\Documents\GitHub\php4delphi\php4delphi2010.groupproj=C:\Users\Andrew\Documents\GitHub\php4delphi\php4delphi 10 Seattle.groupproj</Transaction>
-    <Transaction>1899.12.30 00:00:00.000.047,C:\Users\Andrew\Documents\GitHub\php4delphi\php4delphi 10 Seattle.groupproj=C:\Users\Andrew\Documents\GitHub\php4delphi\php4delphi Delphi 10 Seattle.groupproj</Transaction>
-    <Transaction>1899.12.30 00:00:00.000.717,C:\Users\Andrew\Documents\GitHub\php4delphi\ProjectGroup1.groupproj=C:\Users\Andrew\Documents\GitHub\php4delphi\php4delphi2010.groupproj</Transaction>
-    <Transaction>2019.03.04 22:31:53.120,C:\Users\Andrew\Documents\GitHub\php4delphi\packages\php4delphi Delphi 10.1 Berlin.groupproj=C:\Users\Andrew\Documents\GitHub\php4delphi\php4delphi Delphi 10.1 Berlin.groupproj</Transaction>
-    <Transaction>2019.03.04 22:32:03.207,C:\Users\Andrew\Documents\GitHub\php4delphi\packages\php4delphi Delphi 10 Seattle.groupproj=C:\Users\Andrew\Documents\GitHub\php4delphi\packages\php4delphi Delphi 10.1 Berlin.groupproj</Transaction>
-    <Transaction>2019.03.04 22:32:09.673,C:\Users\Andrew\Documents\GitHub\php4delphi\packages\php4delphi Delphi 10.2 Tokyo.groupproj=C:\Users\Andrew\Documents\GitHub\php4delphi\packages\php4delphi Delphi 10 Seattle.groupproj</Transaction>
-    <Transaction>2019.03.04 22:32:17.131,C:\Users\Andrew\Documents\GitHub\php4delphi\packages\php4delphi Delphi XE1.groupproj=C:\Users\Andrew\Documents\GitHub\php4delphi\packages\php4delphi Delphi 10.2 Tokyo.groupproj</Transaction>
-    <Transaction>2019.03.04 22:32:22.720,C:\Users\Andrew\Documents\GitHub\php4delphi\packages\php4delphi Delphi XE2.groupproj=C:\Users\Andrew\Documents\GitHub\php4delphi\packages\php4delphi Delphi XE1.groupproj</Transaction>
-  </Transactions>
-	<Default.Personality>
-		<Projects ActiveProject="C:\Users\Andrew\Documents\GitHub\php4delphi\php4DelphiD2010.dproj"/>
-	</Default.Personality>
-</BorlandProject>
diff --git a/Source/packages/php4delphi Delphi XE4.groupproj.local b/Source/packages/php4delphi Delphi XE4.groupproj.local
deleted file mode 100644
index a7c375a..0000000
--- a/Source/packages/php4delphi Delphi XE4.groupproj.local	
+++ /dev/null
@@ -1,17 +0,0 @@
-﻿<?xml version="1.0" encoding="utf-8"?>
-<BorlandProject>
-	<Transactions>
-    <Transaction>1899.12.30 00:00:00.000.086,C:\Users\Andrew\Documents\GitHub\php4delphi\php4delphi2010.groupproj=C:\Users\Andrew\Documents\GitHub\php4delphi\php4delphi 10 Seattle.groupproj</Transaction>
-    <Transaction>1899.12.30 00:00:00.000.047,C:\Users\Andrew\Documents\GitHub\php4delphi\php4delphi 10 Seattle.groupproj=C:\Users\Andrew\Documents\GitHub\php4delphi\php4delphi Delphi 10 Seattle.groupproj</Transaction>
-    <Transaction>1899.12.30 00:00:00.000.717,C:\Users\Andrew\Documents\GitHub\php4delphi\ProjectGroup1.groupproj=C:\Users\Andrew\Documents\GitHub\php4delphi\php4delphi2010.groupproj</Transaction>
-    <Transaction>2019.03.04 22:31:53.120,C:\Users\Andrew\Documents\GitHub\php4delphi\packages\php4delphi Delphi 10.1 Berlin.groupproj=C:\Users\Andrew\Documents\GitHub\php4delphi\php4delphi Delphi 10.1 Berlin.groupproj</Transaction>
-    <Transaction>2019.03.04 22:32:03.207,C:\Users\Andrew\Documents\GitHub\php4delphi\packages\php4delphi Delphi 10 Seattle.groupproj=C:\Users\Andrew\Documents\GitHub\php4delphi\packages\php4delphi Delphi 10.1 Berlin.groupproj</Transaction>
-    <Transaction>2019.03.04 22:32:09.673,C:\Users\Andrew\Documents\GitHub\php4delphi\packages\php4delphi Delphi 10.2 Tokyo.groupproj=C:\Users\Andrew\Documents\GitHub\php4delphi\packages\php4delphi Delphi 10 Seattle.groupproj</Transaction>
-    <Transaction>2019.03.04 22:32:17.131,C:\Users\Andrew\Documents\GitHub\php4delphi\packages\php4delphi Delphi XE1.groupproj=C:\Users\Andrew\Documents\GitHub\php4delphi\packages\php4delphi Delphi 10.2 Tokyo.groupproj</Transaction>
-    <Transaction>2019.03.04 22:32:22.720,C:\Users\Andrew\Documents\GitHub\php4delphi\packages\php4delphi Delphi XE2.groupproj=C:\Users\Andrew\Documents\GitHub\php4delphi\packages\php4delphi Delphi XE1.groupproj</Transaction>
-    <Transaction>2019.03.04 22:32:29.457,C:\Users\Andrew\Documents\GitHub\php4delphi\packages\php4delphi Delphi XE3.groupproj=C:\Users\Andrew\Documents\GitHub\php4delphi\packages\php4delphi Delphi XE2.groupproj</Transaction>
-  </Transactions>
-	<Default.Personality>
-		<Projects ActiveProject="C:\Users\Andrew\Documents\GitHub\php4delphi\php4DelphiD2010.dproj"/>
-	</Default.Personality>
-</BorlandProject>
diff --git a/Source/packages/php4delphi Delphi XE5.groupproj.local b/Source/packages/php4delphi Delphi XE5.groupproj.local
deleted file mode 100644
index 47e6273..0000000
--- a/Source/packages/php4delphi Delphi XE5.groupproj.local	
+++ /dev/null
@@ -1,18 +0,0 @@
-﻿<?xml version="1.0" encoding="utf-8"?>
-<BorlandProject>
-	<Transactions>
-    <Transaction>1899.12.30 00:00:00.000.086,C:\Users\Andrew\Documents\GitHub\php4delphi\php4delphi2010.groupproj=C:\Users\Andrew\Documents\GitHub\php4delphi\php4delphi 10 Seattle.groupproj</Transaction>
-    <Transaction>1899.12.30 00:00:00.000.047,C:\Users\Andrew\Documents\GitHub\php4delphi\php4delphi 10 Seattle.groupproj=C:\Users\Andrew\Documents\GitHub\php4delphi\php4delphi Delphi 10 Seattle.groupproj</Transaction>
-    <Transaction>1899.12.30 00:00:00.000.717,C:\Users\Andrew\Documents\GitHub\php4delphi\ProjectGroup1.groupproj=C:\Users\Andrew\Documents\GitHub\php4delphi\php4delphi2010.groupproj</Transaction>
-    <Transaction>2019.03.04 22:31:53.120,C:\Users\Andrew\Documents\GitHub\php4delphi\packages\php4delphi Delphi 10.1 Berlin.groupproj=C:\Users\Andrew\Documents\GitHub\php4delphi\php4delphi Delphi 10.1 Berlin.groupproj</Transaction>
-    <Transaction>2019.03.04 22:32:03.207,C:\Users\Andrew\Documents\GitHub\php4delphi\packages\php4delphi Delphi 10 Seattle.groupproj=C:\Users\Andrew\Documents\GitHub\php4delphi\packages\php4delphi Delphi 10.1 Berlin.groupproj</Transaction>
-    <Transaction>2019.03.04 22:32:09.673,C:\Users\Andrew\Documents\GitHub\php4delphi\packages\php4delphi Delphi 10.2 Tokyo.groupproj=C:\Users\Andrew\Documents\GitHub\php4delphi\packages\php4delphi Delphi 10 Seattle.groupproj</Transaction>
-    <Transaction>2019.03.04 22:32:17.131,C:\Users\Andrew\Documents\GitHub\php4delphi\packages\php4delphi Delphi XE1.groupproj=C:\Users\Andrew\Documents\GitHub\php4delphi\packages\php4delphi Delphi 10.2 Tokyo.groupproj</Transaction>
-    <Transaction>2019.03.04 22:32:22.720,C:\Users\Andrew\Documents\GitHub\php4delphi\packages\php4delphi Delphi XE2.groupproj=C:\Users\Andrew\Documents\GitHub\php4delphi\packages\php4delphi Delphi XE1.groupproj</Transaction>
-    <Transaction>2019.03.04 22:32:29.457,C:\Users\Andrew\Documents\GitHub\php4delphi\packages\php4delphi Delphi XE3.groupproj=C:\Users\Andrew\Documents\GitHub\php4delphi\packages\php4delphi Delphi XE2.groupproj</Transaction>
-    <Transaction>2019.03.04 22:32:34.993,C:\Users\Andrew\Documents\GitHub\php4delphi\packages\php4delphi Delphi XE4.groupproj=C:\Users\Andrew\Documents\GitHub\php4delphi\packages\php4delphi Delphi XE3.groupproj</Transaction>
-  </Transactions>
-	<Default.Personality>
-		<Projects ActiveProject="C:\Users\Andrew\Documents\GitHub\php4delphi\php4DelphiD2010.dproj"/>
-	</Default.Personality>
-</BorlandProject>
diff --git a/Source/packages/php4delphi Delphi XE6.groupproj.local b/Source/packages/php4delphi Delphi XE6.groupproj.local
deleted file mode 100644
index 2c6ab26..0000000
--- a/Source/packages/php4delphi Delphi XE6.groupproj.local	
+++ /dev/null
@@ -1,19 +0,0 @@
-﻿<?xml version="1.0" encoding="utf-8"?>
-<BorlandProject>
-	<Transactions>
-    <Transaction>1899.12.30 00:00:00.000.717,C:\Users\Andrew\Documents\GitHub\php4delphi\ProjectGroup1.groupproj=C:\Users\Andrew\Documents\GitHub\php4delphi\php4delphi2010.groupproj</Transaction>
-    <Transaction>1899.12.30 00:00:00.000.086,C:\Users\Andrew\Documents\GitHub\php4delphi\php4delphi2010.groupproj=C:\Users\Andrew\Documents\GitHub\php4delphi\php4delphi 10 Seattle.groupproj</Transaction>
-    <Transaction>1899.12.30 00:00:00.000.047,C:\Users\Andrew\Documents\GitHub\php4delphi\php4delphi 10 Seattle.groupproj=C:\Users\Andrew\Documents\GitHub\php4delphi\php4delphi Delphi 10 Seattle.groupproj</Transaction>
-    <Transaction>2019.03.04 22:31:53.120,C:\Users\Andrew\Documents\GitHub\php4delphi\packages\php4delphi Delphi 10.1 Berlin.groupproj=C:\Users\Andrew\Documents\GitHub\php4delphi\php4delphi Delphi 10.1 Berlin.groupproj</Transaction>
-    <Transaction>2019.03.04 22:32:03.207,C:\Users\Andrew\Documents\GitHub\php4delphi\packages\php4delphi Delphi 10 Seattle.groupproj=C:\Users\Andrew\Documents\GitHub\php4delphi\packages\php4delphi Delphi 10.1 Berlin.groupproj</Transaction>
-    <Transaction>2019.03.04 22:32:09.673,C:\Users\Andrew\Documents\GitHub\php4delphi\packages\php4delphi Delphi 10.2 Tokyo.groupproj=C:\Users\Andrew\Documents\GitHub\php4delphi\packages\php4delphi Delphi 10 Seattle.groupproj</Transaction>
-    <Transaction>2019.03.04 22:32:17.131,C:\Users\Andrew\Documents\GitHub\php4delphi\packages\php4delphi Delphi XE1.groupproj=C:\Users\Andrew\Documents\GitHub\php4delphi\packages\php4delphi Delphi 10.2 Tokyo.groupproj</Transaction>
-    <Transaction>2019.03.04 22:32:22.720,C:\Users\Andrew\Documents\GitHub\php4delphi\packages\php4delphi Delphi XE2.groupproj=C:\Users\Andrew\Documents\GitHub\php4delphi\packages\php4delphi Delphi XE1.groupproj</Transaction>
-    <Transaction>2019.03.04 22:32:29.457,C:\Users\Andrew\Documents\GitHub\php4delphi\packages\php4delphi Delphi XE3.groupproj=C:\Users\Andrew\Documents\GitHub\php4delphi\packages\php4delphi Delphi XE2.groupproj</Transaction>
-    <Transaction>2019.03.04 22:32:34.993,C:\Users\Andrew\Documents\GitHub\php4delphi\packages\php4delphi Delphi XE4.groupproj=C:\Users\Andrew\Documents\GitHub\php4delphi\packages\php4delphi Delphi XE3.groupproj</Transaction>
-    <Transaction>2019.03.04 22:32:41.465,C:\Users\Andrew\Documents\GitHub\php4delphi\packages\php4delphi Delphi XE5.groupproj=C:\Users\Andrew\Documents\GitHub\php4delphi\packages\php4delphi Delphi XE4.groupproj</Transaction>
-  </Transactions>
-	<Default.Personality>
-		<Projects ActiveProject="C:\Users\Andrew\Documents\GitHub\php4delphi\php4DelphiD2010.dproj"/>
-	</Default.Personality>
-</BorlandProject>
diff --git a/Source/packages/php4delphi Delphi XE7.groupproj.local b/Source/packages/php4delphi Delphi XE7.groupproj.local
deleted file mode 100644
index 9691c31..0000000
--- a/Source/packages/php4delphi Delphi XE7.groupproj.local	
+++ /dev/null
@@ -1,20 +0,0 @@
-﻿<?xml version="1.0" encoding="utf-8"?>
-<BorlandProject>
-	<Transactions>
-    <Transaction>1899.12.30 00:00:00.000.086,C:\Users\Andrew\Documents\GitHub\php4delphi\php4delphi2010.groupproj=C:\Users\Andrew\Documents\GitHub\php4delphi\php4delphi 10 Seattle.groupproj</Transaction>
-    <Transaction>1899.12.30 00:00:00.000.717,C:\Users\Andrew\Documents\GitHub\php4delphi\ProjectGroup1.groupproj=C:\Users\Andrew\Documents\GitHub\php4delphi\php4delphi2010.groupproj</Transaction>
-    <Transaction>1899.12.30 00:00:00.000.047,C:\Users\Andrew\Documents\GitHub\php4delphi\php4delphi 10 Seattle.groupproj=C:\Users\Andrew\Documents\GitHub\php4delphi\php4delphi Delphi 10 Seattle.groupproj</Transaction>
-    <Transaction>2019.03.04 22:31:53.120,C:\Users\Andrew\Documents\GitHub\php4delphi\packages\php4delphi Delphi 10.1 Berlin.groupproj=C:\Users\Andrew\Documents\GitHub\php4delphi\php4delphi Delphi 10.1 Berlin.groupproj</Transaction>
-    <Transaction>2019.03.04 22:32:03.207,C:\Users\Andrew\Documents\GitHub\php4delphi\packages\php4delphi Delphi 10 Seattle.groupproj=C:\Users\Andrew\Documents\GitHub\php4delphi\packages\php4delphi Delphi 10.1 Berlin.groupproj</Transaction>
-    <Transaction>2019.03.04 22:32:09.673,C:\Users\Andrew\Documents\GitHub\php4delphi\packages\php4delphi Delphi 10.2 Tokyo.groupproj=C:\Users\Andrew\Documents\GitHub\php4delphi\packages\php4delphi Delphi 10 Seattle.groupproj</Transaction>
-    <Transaction>2019.03.04 22:32:17.131,C:\Users\Andrew\Documents\GitHub\php4delphi\packages\php4delphi Delphi XE1.groupproj=C:\Users\Andrew\Documents\GitHub\php4delphi\packages\php4delphi Delphi 10.2 Tokyo.groupproj</Transaction>
-    <Transaction>2019.03.04 22:32:22.720,C:\Users\Andrew\Documents\GitHub\php4delphi\packages\php4delphi Delphi XE2.groupproj=C:\Users\Andrew\Documents\GitHub\php4delphi\packages\php4delphi Delphi XE1.groupproj</Transaction>
-    <Transaction>2019.03.04 22:32:29.457,C:\Users\Andrew\Documents\GitHub\php4delphi\packages\php4delphi Delphi XE3.groupproj=C:\Users\Andrew\Documents\GitHub\php4delphi\packages\php4delphi Delphi XE2.groupproj</Transaction>
-    <Transaction>2019.03.04 22:32:34.993,C:\Users\Andrew\Documents\GitHub\php4delphi\packages\php4delphi Delphi XE4.groupproj=C:\Users\Andrew\Documents\GitHub\php4delphi\packages\php4delphi Delphi XE3.groupproj</Transaction>
-    <Transaction>2019.03.04 22:32:41.465,C:\Users\Andrew\Documents\GitHub\php4delphi\packages\php4delphi Delphi XE5.groupproj=C:\Users\Andrew\Documents\GitHub\php4delphi\packages\php4delphi Delphi XE4.groupproj</Transaction>
-    <Transaction>2019.03.04 22:32:46.928,C:\Users\Andrew\Documents\GitHub\php4delphi\packages\php4delphi Delphi XE6.groupproj=C:\Users\Andrew\Documents\GitHub\php4delphi\packages\php4delphi Delphi XE5.groupproj</Transaction>
-  </Transactions>
-	<Default.Personality>
-		<Projects ActiveProject="C:\Users\Andrew\Documents\GitHub\php4delphi\php4DelphiD2010.dproj"/>
-	</Default.Personality>
-</BorlandProject>
diff --git a/Source/packages/php4delphi Delphi XE8.groupproj.local b/Source/packages/php4delphi Delphi XE8.groupproj.local
deleted file mode 100644
index fded362..0000000
--- a/Source/packages/php4delphi Delphi XE8.groupproj.local	
+++ /dev/null
@@ -1,21 +0,0 @@
-﻿<?xml version="1.0" encoding="utf-8"?>
-<BorlandProject>
-	<Transactions>
-    <Transaction>1899.12.30 00:00:00.000.047,C:\Users\Andrew\Documents\GitHub\php4delphi\php4delphi 10 Seattle.groupproj=C:\Users\Andrew\Documents\GitHub\php4delphi\php4delphi Delphi 10 Seattle.groupproj</Transaction>
-    <Transaction>1899.12.30 00:00:00.000.717,C:\Users\Andrew\Documents\GitHub\php4delphi\ProjectGroup1.groupproj=C:\Users\Andrew\Documents\GitHub\php4delphi\php4delphi2010.groupproj</Transaction>
-    <Transaction>1899.12.30 00:00:00.000.086,C:\Users\Andrew\Documents\GitHub\php4delphi\php4delphi2010.groupproj=C:\Users\Andrew\Documents\GitHub\php4delphi\php4delphi 10 Seattle.groupproj</Transaction>
-    <Transaction>2019.03.04 22:31:53.120,C:\Users\Andrew\Documents\GitHub\php4delphi\packages\php4delphi Delphi 10.1 Berlin.groupproj=C:\Users\Andrew\Documents\GitHub\php4delphi\php4delphi Delphi 10.1 Berlin.groupproj</Transaction>
-    <Transaction>2019.03.04 22:32:03.207,C:\Users\Andrew\Documents\GitHub\php4delphi\packages\php4delphi Delphi 10 Seattle.groupproj=C:\Users\Andrew\Documents\GitHub\php4delphi\packages\php4delphi Delphi 10.1 Berlin.groupproj</Transaction>
-    <Transaction>2019.03.04 22:32:09.673,C:\Users\Andrew\Documents\GitHub\php4delphi\packages\php4delphi Delphi 10.2 Tokyo.groupproj=C:\Users\Andrew\Documents\GitHub\php4delphi\packages\php4delphi Delphi 10 Seattle.groupproj</Transaction>
-    <Transaction>2019.03.04 22:32:17.131,C:\Users\Andrew\Documents\GitHub\php4delphi\packages\php4delphi Delphi XE1.groupproj=C:\Users\Andrew\Documents\GitHub\php4delphi\packages\php4delphi Delphi 10.2 Tokyo.groupproj</Transaction>
-    <Transaction>2019.03.04 22:32:22.720,C:\Users\Andrew\Documents\GitHub\php4delphi\packages\php4delphi Delphi XE2.groupproj=C:\Users\Andrew\Documents\GitHub\php4delphi\packages\php4delphi Delphi XE1.groupproj</Transaction>
-    <Transaction>2019.03.04 22:32:29.457,C:\Users\Andrew\Documents\GitHub\php4delphi\packages\php4delphi Delphi XE3.groupproj=C:\Users\Andrew\Documents\GitHub\php4delphi\packages\php4delphi Delphi XE2.groupproj</Transaction>
-    <Transaction>2019.03.04 22:32:34.993,C:\Users\Andrew\Documents\GitHub\php4delphi\packages\php4delphi Delphi XE4.groupproj=C:\Users\Andrew\Documents\GitHub\php4delphi\packages\php4delphi Delphi XE3.groupproj</Transaction>
-    <Transaction>2019.03.04 22:32:41.465,C:\Users\Andrew\Documents\GitHub\php4delphi\packages\php4delphi Delphi XE5.groupproj=C:\Users\Andrew\Documents\GitHub\php4delphi\packages\php4delphi Delphi XE4.groupproj</Transaction>
-    <Transaction>2019.03.04 22:32:46.928,C:\Users\Andrew\Documents\GitHub\php4delphi\packages\php4delphi Delphi XE6.groupproj=C:\Users\Andrew\Documents\GitHub\php4delphi\packages\php4delphi Delphi XE5.groupproj</Transaction>
-    <Transaction>2019.03.04 22:32:52.359,C:\Users\Andrew\Documents\GitHub\php4delphi\packages\php4delphi Delphi XE7.groupproj=C:\Users\Andrew\Documents\GitHub\php4delphi\packages\php4delphi Delphi XE6.groupproj</Transaction>
-  </Transactions>
-	<Default.Personality>
-		<Projects ActiveProject="C:\Users\Andrew\Documents\GitHub\php4delphi\php4DelphiD2010.dproj"/>
-	</Default.Personality>
-</BorlandProject>
diff --git a/Source/php4App.dproj.local b/Source/php4App.dproj.local
deleted file mode 100644
index b3811b7..0000000
--- a/Source/php4App.dproj.local
+++ /dev/null
@@ -1,2 +0,0 @@
-﻿<?xml version="1.0" encoding="utf-8"?>
-<BorlandProject/>
diff --git a/Source/php4App.identcache b/Source/php4App.identcache
deleted file mode 100644
index 303be0800985cc7e22649d7940d5f7d672a24a32..0000000000000000000000000000000000000000
GIT binary patch
diff --git a/Source/php4App.stat b/Source/php4App.stat
deleted file mode 100644
index fd9c33f..0000000
--- a/Source/php4App.stat
+++ /dev/null
@@ -1,10 +0,0 @@
-[Stats]
-EditorSecs=3
-DesignerSecs=1
-InspectorSecs=1
-CompileSecs=724
-OtherSecs=68
-StartTime=21.09.2018 13:22:04
-RealKeys=0
-EffectiveKeys=0
-DebugSecs=1
diff --git a/Source/php4AppUnit.pas b/Source/php4AppUnit.pas
index b2b78c1..5e6feee 100644
--- a/Source/php4AppUnit.pas
+++ b/Source/php4AppUnit.pas
@@ -217,10 +217,6 @@ procedure PrepareResult(RequestID : integer; TSRMLS_D : pointer);
   data: ^ppzval;
   cnt : integer;
   InfoBlock : TPHPInfoBlock;
-  {$IFDEF PHP5}
-  EG : pzend_executor_globals;
-  {$ENDIF}
-
 begin
   InfoBlock := TPHPInfoBlock(RequestID);
    ht := GetSymbolsTable;
@@ -713,7 +709,7 @@ procedure StopEngine;
        sapi_shutdown;
        {$IF not Defined(PHP550) and not Defined(PHP560)}
        tsrm_shutdown();
-       {$ENDIF}
+       {$ifend}
      except
      end;
    end;
diff --git a/Source/php4Applications/PHP 4.4.6/php4App.dll b/Source/php4Applications/PHP 4.4.6/php4App.dll
deleted file mode 100644
index 9ed7aae13e758078b2a32fe309d14496fc7ee2de..0000000000000000000000000000000000000000
GIT binary patch
diff --git a/Source/php4Applications/PHP 5.2.11/php4App.dll b/Source/php4Applications/PHP 5.2.11/php4App.dll
deleted file mode 100644
index f5445b0e4ae9e140e673d2602b40cc655f5622a3..0000000000000000000000000000000000000000
GIT binary patch
diff --git a/Source/php4Applications/PHP 5.3.0/php4App.dll b/Source/php4Applications/PHP 5.3.0/php4App.dll
deleted file mode 100644
index 2efba3b2800a05157f96211c84dacaadaa3fff8d..0000000000000000000000000000000000000000
GIT binary patch
diff --git a/Source/php4Applications/PHP4/php4App.dll b/Source/php4Applications/PHP4/php4App.dll
deleted file mode 100644
index 62a5982a3e3ed682787ca5816877d265baef3ff1..0000000000000000000000000000000000000000
GIT binary patch
diff --git a/Source/php4Applications/PHP511/php4App.dll b/Source/php4Applications/PHP511/php4App.dll
deleted file mode 100644
index d02c89182caa73741870896bf47ab1900f9fb6cd..0000000000000000000000000000000000000000
GIT binary patch
diff --git a/Source/php4Applications/PHP512/php4App.dll b/Source/php4Applications/PHP512/php4App.dll
deleted file mode 100644
index aa4ea5bfda664db36971774a6dcc4577f38adb09..0000000000000000000000000000000000000000
GIT binary patch
diff --git a/Source/php4DelphiD2005.dpk b/Source/php4DelphiD2005.dpk
index c306478..9df15fd 100644
--- a/Source/php4DelphiD2005.dpk
+++ b/Source/php4DelphiD2005.dpk
@@ -30,7 +30,7 @@ package php4DelphiD2005;
 {$DESIGNONLY}
 {$IMPLICITBUILD OFF}
 
-rrequires
+requires
   rtl,
   vcl,
   designide,
@@ -38,11 +38,11 @@ rrequires
   vclx,
   php4DelphiR2005;
 
-ocontains
+contains
   PHPProjectWizard in 'PHPProjectWizard.pas',
   php4DelphiReg in 'php4DelphiReg.pas',
   php4DelphiWeb in 'php4DelphiWeb.pas',
   phpWeb in 'phpWeb.pas',
   phpAbout in 'phpAbout.pas' {dlgAbout};
 
-d.
+end.
diff --git a/Source/php4DelphiD2005.dproj.local b/Source/php4DelphiD2005.dproj.local
deleted file mode 100644
index b3811b7..0000000
--- a/Source/php4DelphiD2005.dproj.local
+++ /dev/null
@@ -1,2 +0,0 @@
-﻿<?xml version="1.0" encoding="utf-8"?>
-<BorlandProject/>
diff --git a/Source/php4DelphiD2005.stat b/Source/php4DelphiD2005.stat
deleted file mode 100644
index 9ec5214..0000000
--- a/Source/php4DelphiD2005.stat
+++ /dev/null
@@ -1,10 +0,0 @@
-[Stats]
-EditorSecs=1
-DesignerSecs=1
-InspectorSecs=1
-CompileSecs=1
-OtherSecs=3
-StartTime=21.09.2018 3:07:29
-RealKeys=0
-EffectiveKeys=0
-DebugSecs=1
diff --git a/Source/php4DelphiD2007.dpk b/Source/php4DelphiD2007.dpk
index 1810861..c112701 100644
--- a/Source/php4DelphiD2007.dpk
+++ b/Source/php4DelphiD2007.dpk
@@ -30,7 +30,7 @@ package php4DelphiD2007;
 {$DESIGNONLY}
 {$IMPLICITBUILD OFF}
 
-rrequires
+requires
   rtl,
   vcl,
   designide,
@@ -38,11 +38,11 @@ rrequires
   vclx,
   php4DelphiR2007;
 
-ocontains
+contains
   PHPProjectWizard in 'PHPProjectWizard.pas',
   php4DelphiReg in 'php4DelphiReg.pas',
   php4DelphiWeb in 'php4DelphiWeb.pas',
   phpWeb in 'phpWeb.pas',
   phpAbout in 'phpAbout.pas' {dlgAbout};
 
-d.
+end.
diff --git a/Source/php4DelphiD2007.dproj.local b/Source/php4DelphiD2007.dproj.local
deleted file mode 100644
index b3811b7..0000000
--- a/Source/php4DelphiD2007.dproj.local
+++ /dev/null
@@ -1,2 +0,0 @@
-﻿<?xml version="1.0" encoding="utf-8"?>
-<BorlandProject/>
diff --git a/Source/php4DelphiD2007.stat b/Source/php4DelphiD2007.stat
deleted file mode 100644
index 6bfe8ad..0000000
--- a/Source/php4DelphiD2007.stat
+++ /dev/null
@@ -1,10 +0,0 @@
-[Stats]
-EditorSecs=1
-DesignerSecs=1
-InspectorSecs=1
-CompileSecs=1
-OtherSecs=3
-StartTime=21.09.2018 3:07:40
-RealKeys=0
-EffectiveKeys=0
-DebugSecs=1
diff --git a/Source/php4DelphiD2009.dpk b/Source/php4DelphiD2009.dpk
index d9f82a3..3627877 100644
--- a/Source/php4DelphiD2009.dpk
+++ b/Source/php4DelphiD2009.dpk
@@ -1,7 +1,6 @@
 package php4DelphiD2009;
 
 {$R *.res}
-{$IFDEF IMPLICITBUILDING This IFDEF should not be used by users}
 {$ALIGN 8}
 {$ASSERTIONS ON}
 {$BOOLEVAL OFF}
@@ -12,24 +11,22 @@ package php4DelphiD2009;
 {$LOCALSYMBOLS ON}
 {$LONGSTRINGS ON}
 {$OPENSTRINGS ON}
-{$OPTIMIZATION OFF}
+{$OPTIMIZATION ON}
 {$OVERFLOWCHECKS OFF}
 {$RANGECHECKS OFF}
-{$REFERENCEINFO ON}
+{$REFERENCEINFO OFF}
 {$SAFEDIVIDE OFF}
-{$STACKFRAMES ON}
+{$STACKFRAMES OFF}
 {$TYPEDADDRESS OFF}
 {$VARSTRINGCHECKS ON}
 {$WRITEABLECONST OFF}
 {$MINENUMSIZE 1}
 {$IMAGEBASE $400000}
-{$DEFINE DEBUG}
-{$ENDIF IMPLICITBUILDING}
 {$DESCRIPTION 'php4Delphi (design-time)'}
 {$DESIGNONLY}
 {$IMPLICITBUILD OFF}
 
-rrequires
+requires
   rtl,
   vcl,
   designide,
@@ -37,11 +34,11 @@ rrequires
   vclx,
   php4DelphiR2009;
 
-ocontains
+contains
   PHPProjectWizard in 'PHPProjectWizard.pas',
   php4DelphiReg in 'php4DelphiReg.pas',
   php4DelphiWeb in 'php4DelphiWeb.pas',
   phpWeb in 'phpWeb.pas',
   phpAbout in 'phpAbout.pas' {dlgAbout};
 
-d.
+end.
diff --git a/Source/php4DelphiD2009.dproj b/Source/php4DelphiD2009.dproj
index 440917d..f096ad0 100644
--- a/Source/php4DelphiD2009.dproj
+++ b/Source/php4DelphiD2009.dproj
@@ -1,123 +1,131 @@
-﻿<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-    <PropertyGroup>
-        <ProjectGuid>{65B66BBA-1F79-4212-AC10-21298E0BC3B0}</ProjectGuid>
-        <MainSource>php4DelphiD2009.dpk</MainSource>
-        <Base>True</Base>
-        <Config Condition="'$(Config)'==''">Debug</Config>
-        <TargetedPlatforms>1</TargetedPlatforms>
-        <AppType>Package</AppType>
-        <FrameworkType>VCL</FrameworkType>
-        <ProjectVersion>18.2</ProjectVersion>
-        <Platform Condition="'$(Platform)'==''">Win32</Platform>
-    </PropertyGroup>
-    <PropertyGroup Condition="'$(Config)'=='Base' or '$(Base)'!=''">
-        <Base>true</Base>
-    </PropertyGroup>
-    <PropertyGroup Condition="('$(Platform)'=='Android' and '$(Base)'=='true') or '$(Base_Android)'!=''">
-        <Base_Android>true</Base_Android>
-        <CfgParent>Base</CfgParent>
-        <Base>true</Base>
-    </PropertyGroup>
-    <PropertyGroup Condition="('$(Platform)'=='Win32' and '$(Base)'=='true') or '$(Base_Win32)'!=''">
-        <Base_Win32>true</Base_Win32>
-        <CfgParent>Base</CfgParent>
-        <Base>true</Base>
-    </PropertyGroup>
-    <PropertyGroup Condition="('$(Platform)'=='Win64' and '$(Base)'=='true') or '$(Base_Win64)'!=''">
-        <Base_Win64>true</Base_Win64>
-        <CfgParent>Base</CfgParent>
-        <Base>true</Base>
-    </PropertyGroup>
-    <PropertyGroup Condition="'$(Config)'=='Release' or '$(Cfg_1)'!=''">
-        <Cfg_1>true</Cfg_1>
-        <CfgParent>Base</CfgParent>
-        <Base>true</Base>
-    </PropertyGroup>
-    <PropertyGroup Condition="'$(Config)'=='Debug' or '$(Cfg_2)'!=''">
-        <Cfg_2>true</Cfg_2>
-        <CfgParent>Base</CfgParent>
-        <Base>true</Base>
-    </PropertyGroup>
-    <PropertyGroup Condition="'$(Base)'!=''">
-        <DCC_ImageBase>00400000</DCC_ImageBase>
-        <DCC_K>false</DCC_K>
-        <DCC_DebugInformation>1</DCC_DebugInformation>
-        <DCC_Namespace>Vcl;Vcl.Imaging;Vcl.Touch;Vcl.Samples;Vcl.Shell;System;Xml;Data;Datasnap;Web;Soap;$(DCC_Namespace)</DCC_Namespace>
-        <VerInfo_Locale>1058</VerInfo_Locale>
-        <DesignOnlyPackage>true</DesignOnlyPackage>
-        <SanitizedProjectName>php4DelphiD2009</SanitizedProjectName>
-        <DCC_S>false</DCC_S>
-        <DCC_F>false</DCC_F>
-        <DCC_E>false</DCC_E>
-        <GenPackage>true</GenPackage>
-        <GenDll>true</GenDll>
-        <DCC_Description>php4Delphi (design-time)</DCC_Description>
-        <DCC_N>false</DCC_N>
-        <DCC_OutputNeverBuildDcps>true</DCC_OutputNeverBuildDcps>
-        <VerInfo_Keys>CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments=;CFBundleName=</VerInfo_Keys>
-    </PropertyGroup>
-    <PropertyGroup Condition="'$(Base_Android)'!=''">
-        <EnabledSysJars>android-support-v4.dex.jar;cloud-messaging.dex.jar;fmx.dex.jar;google-analytics-v2.dex.jar;google-play-billing.dex.jar;google-play-licensing.dex.jar;google-play-services.dex.jar</EnabledSysJars>
-        <VerInfo_Keys>package=com.embarcadero.$(MSBuildProjectName);label=$(MSBuildProjectName);versionCode=1;versionName=1.0.0;persistent=False;restoreAnyVersion=False;installLocation=auto;largeHeap=False;theme=TitleBar;hardwareAccelerated=true;apiKey=</VerInfo_Keys>
-        <BT_BuildType>Debug</BT_BuildType>
-    </PropertyGroup>
-    <PropertyGroup Condition="'$(Base_Win32)'!=''">
-        <VerInfo_IncludeVerInfo>true</VerInfo_IncludeVerInfo>
-        <Icon_MainIcon>php4DelphiD2009_Icon.ico</Icon_MainIcon>
-        <VerInfo_Locale>1033</VerInfo_Locale>
-        <BT_BuildType>Debug</BT_BuildType>
-        <VerInfo_Keys>CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments=;ProgramID=com.embarcadero.$(ModuleName)</VerInfo_Keys>
-        <DCC_Namespace>Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace)</DCC_Namespace>
-    </PropertyGroup>
-    <PropertyGroup Condition="'$(Base_Win64)'!=''">
-        <Icon_MainIcon>php4DelphiD2009_Icon.ico</Icon_MainIcon>
-    </PropertyGroup>
-    <PropertyGroup Condition="'$(Cfg_1)'!=''">
-        <DCC_Define>RELEASE;$(DCC_Define)</DCC_Define>
-        <DCC_LocalDebugSymbols>false</DCC_LocalDebugSymbols>
-        <DCC_SymbolReferenceInfo>0</DCC_SymbolReferenceInfo>
-        <DCC_DebugInformation>0</DCC_DebugInformation>
-    </PropertyGroup>
-    <PropertyGroup Condition="'$(Cfg_2)'!=''">
-        <DCC_Define>DEBUG;$(DCC_Define)</DCC_Define>
-        <DCC_GenerateStackFrames>true</DCC_GenerateStackFrames>
-        <DCC_Optimize>false</DCC_Optimize>
-    </PropertyGroup>
-    <ItemGroup>
-        <DelphiCompile Include="$(MainSource)">
-            <MainSource>MainSource</MainSource>
-        </DelphiCompile>
-        <BuildConfiguration Include="Debug">
-            <Key>Cfg_2</Key>
-            <CfgParent>Base</CfgParent>
-        </BuildConfiguration>
-        <BuildConfiguration Include="Base">
-            <Key>Base</Key>
-        </BuildConfiguration>
-        <BuildConfiguration Include="Release">
-            <Key>Cfg_1</Key>
-            <CfgParent>Base</CfgParent>
-        </BuildConfiguration>
-    </ItemGroup>
-    <ProjectExtensions>
-        <Borland.Personality>Delphi.Personality.12</Borland.Personality>
-        <Borland.ProjectType>Package</Borland.ProjectType>
-        <BorlandProject>
-            <Delphi.Personality>
-                <Source>
-                    <Source Name="MainSource">php4DelphiD2009.dpk</Source>
-                </Source>
-            </Delphi.Personality>
-            <Platforms>
-                <Platform value="Android">False</Platform>
-                <Platform value="iOSDevice32">False</Platform>
-                <Platform value="iOSSimulator">False</Platform>
-                <Platform value="Win32">True</Platform>
-                <Platform value="Win64">False</Platform>
-            </Platforms>
-        </BorlandProject>
-        <ProjectFileVersion>12</ProjectFileVersion>
-    </ProjectExtensions>
-    <Import Project="$(BDS)\Bin\CodeGear.Delphi.Targets" Condition="Exists('$(BDS)\Bin\CodeGear.Delphi.Targets')"/>
-    <Import Project="$(APPDATA)\Embarcadero\$(BDSAPPDATABASEDIR)\$(PRODUCTVERSION)\UserTools.proj" Condition="Exists('$(APPDATA)\Embarcadero\$(BDSAPPDATABASEDIR)\$(PRODUCTVERSION)\UserTools.proj')"/>
-</Project>
+﻿	<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+		<PropertyGroup>
+			<ProjectGuid>{65B66BBA-1F79-4212-AC10-21298E0BC3B0}</ProjectGuid>
+			<MainSource>php4DelphiD2009.dpk</MainSource>
+			<Base>True</Base>
+			<Config Condition="'$(Config)'==''">Debug</Config>
+			<TargetedPlatforms>1</TargetedPlatforms>
+			<AppType>Package</AppType>
+			<FrameworkType>VCL</FrameworkType>
+			<ProjectVersion>18.2</ProjectVersion>
+			<Platform Condition="'$(Platform)'==''">Win32</Platform>
+			<DCC_DCCCompiler>DCC32</DCC_DCCCompiler>
+		</PropertyGroup>
+		<PropertyGroup Condition="'$(Config)'=='Base' or '$(Base)'!=''">
+			<Base>true</Base>
+		</PropertyGroup>
+		<PropertyGroup Condition="'$(Config)'=='Release' or '$(Cfg_1)'!=''">
+			<Cfg_1>true</Cfg_1>
+			<CfgParent>Base</CfgParent>
+			<Base>true</Base>
+		</PropertyGroup>
+		<PropertyGroup Condition="'$(Config)'=='Debug' or '$(Cfg_2)'!=''">
+			<Cfg_2>true</Cfg_2>
+			<CfgParent>Base</CfgParent>
+			<Base>true</Base>
+		</PropertyGroup>
+		<PropertyGroup Condition="'$(Base)'!=''">
+			<DCC_SymbolReferenceInfo>0</DCC_SymbolReferenceInfo>
+			<DCC_DependencyCheckOutputName>..\..\..\..\Public\Documents\RAD Studio\6.0\Bpl\php4DelphiD2009.bpl</DCC_DependencyCheckOutputName>
+			<DCC_ImageBase>00400000</DCC_ImageBase>
+			<DCC_K>false</DCC_K>
+			<DCC_Namespace>Vcl;Vcl.Imaging;Vcl.Touch;Vcl.Samples;Vcl.Shell;System;Xml;Data;Datasnap;Web;Soap;$(DCC_Namespace)</DCC_Namespace>
+			<VerInfo_Locale>1058</VerInfo_Locale>
+			<DesignOnlyPackage>true</DesignOnlyPackage>
+			<SanitizedProjectName>php4DelphiD2009</SanitizedProjectName>
+			<DCC_S>false</DCC_S>
+			<DCC_F>false</DCC_F>
+			<DCC_E>false</DCC_E>
+			<GenPackage>true</GenPackage>
+			<GenDll>true</GenDll>
+			<DCC_Description>php4Delphi (design-time)</DCC_Description>
+			<DCC_N>false</DCC_N>
+			<DCC_OutputNeverBuildDcps>true</DCC_OutputNeverBuildDcps>
+			<VerInfo_Keys>CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments=;CFBundleName=</VerInfo_Keys>
+		</PropertyGroup>
+		<PropertyGroup Condition="'$(Cfg_1)'!=''">
+			<DCC_Define>RELEASE;$(DCC_Define)</DCC_Define>
+			<DCC_LocalDebugSymbols>false</DCC_LocalDebugSymbols>
+			<DCC_SymbolReferenceInfo>0</DCC_SymbolReferenceInfo>
+			<DCC_DebugInformation>0</DCC_DebugInformation>
+		</PropertyGroup>
+		<PropertyGroup Condition="'$(Cfg_2)'!=''">
+			<DCC_Define>DEBUG;$(DCC_Define)</DCC_Define>
+			<DCC_GenerateStackFrames>true</DCC_GenerateStackFrames>
+			<DCC_Optimize>false</DCC_Optimize>
+		</PropertyGroup>
+		<ItemGroup>
+			<DelphiCompile Include="php4DelphiD2009.dpk">
+				<MainSource>MainSource</MainSource>
+			</DelphiCompile>
+			<DCCReference Include="rtl.dcp"/>
+			<DCCReference Include="vcl.dcp"/>
+			<DCCReference Include="designide.dcp"/>
+			<DCCReference Include="vclactnband.dcp"/>
+			<DCCReference Include="vclx.dcp"/>
+			<DCCReference Include="php4DelphiR2009.dcp"/>
+			<BuildConfiguration Include="Base">
+				<Key>Base</Key>
+			</BuildConfiguration>
+			<BuildConfiguration Include="Debug">
+				<Key>Cfg_2</Key>
+				<CfgParent>Base</CfgParent>
+			</BuildConfiguration>
+			<BuildConfiguration Include="Release">
+				<Key>Cfg_1</Key>
+				<CfgParent>Base</CfgParent>
+			</BuildConfiguration>
+		</ItemGroup>
+		<Import Project="$(BDS)\Bin\CodeGear.Delphi.Targets" Condition="Exists('$(BDS)\Bin\CodeGear.Delphi.Targets')"/>
+		<ProjectExtensions>
+			<Borland.Personality>Delphi.Personality.12</Borland.Personality>
+			<Borland.ProjectType>Package</Borland.ProjectType>
+			<BorlandProject>
+				<Delphi.Personality>
+					<Source>
+						<Source Name="MainSource">php4DelphiD2009.dpk</Source>
+					</Source>
+					<Parameters>
+						<Parameters Name="UseLauncher">False</Parameters>
+						<Parameters Name="LoadAllSymbols">True</Parameters>
+						<Parameters Name="LoadUnspecifiedSymbols">False</Parameters>
+					</Parameters>
+					<VersionInfo>
+						<VersionInfo Name="IncludeVerInfo">False</VersionInfo>
+						<VersionInfo Name="AutoIncBuild">False</VersionInfo>
+						<VersionInfo Name="MajorVer">1</VersionInfo>
+						<VersionInfo Name="MinorVer">0</VersionInfo>
+						<VersionInfo Name="Release">0</VersionInfo>
+						<VersionInfo Name="Build">0</VersionInfo>
+						<VersionInfo Name="Debug">False</VersionInfo>
+						<VersionInfo Name="PreRelease">False</VersionInfo>
+						<VersionInfo Name="Special">False</VersionInfo>
+						<VersionInfo Name="Private">False</VersionInfo>
+						<VersionInfo Name="DLL">False</VersionInfo>
+						<VersionInfo Name="Locale">1058</VersionInfo>
+						<VersionInfo Name="CodePage">1251</VersionInfo>
+					</VersionInfo>
+					<VersionInfoKeys>
+						<VersionInfoKeys Name="CompanyName"/>
+						<VersionInfoKeys Name="FileDescription"/>
+						<VersionInfoKeys Name="FileVersion">1.0.0.0</VersionInfoKeys>
+						<VersionInfoKeys Name="InternalName"/>
+						<VersionInfoKeys Name="LegalCopyright"/>
+						<VersionInfoKeys Name="LegalTrademarks"/>
+						<VersionInfoKeys Name="OriginalFilename"/>
+						<VersionInfoKeys Name="ProductName"/>
+						<VersionInfoKeys Name="ProductVersion">1.0.0.0</VersionInfoKeys>
+						<VersionInfoKeys Name="Comments"/>
+					</VersionInfoKeys>
+				</Delphi.Personality>
+				<Platforms>
+					<Platform value="Android">False</Platform>
+					<Platform value="iOSDevice32">False</Platform>
+					<Platform value="iOSSimulator">False</Platform>
+					<Platform value="Win32">True</Platform>
+					<Platform value="Win64">False</Platform>
+				</Platforms>
+			</BorlandProject>
+			<ProjectFileVersion>12</ProjectFileVersion>
+		</ProjectExtensions>
+	</Project>
diff --git a/Source/php4DelphiD2009.dproj.local b/Source/php4DelphiD2009.dproj.local
deleted file mode 100644
index b3811b7..0000000
--- a/Source/php4DelphiD2009.dproj.local
+++ /dev/null
@@ -1,2 +0,0 @@
-﻿<?xml version="1.0" encoding="utf-8"?>
-<BorlandProject/>
diff --git a/Source/php4DelphiD2009.stat b/Source/php4DelphiD2009.stat
deleted file mode 100644
index 7cf7048..0000000
--- a/Source/php4DelphiD2009.stat
+++ /dev/null
@@ -1,10 +0,0 @@
-[Stats]
-EditorSecs=1
-DesignerSecs=1
-InspectorSecs=1
-CompileSecs=1
-OtherSecs=3
-StartTime=21.09.2018 13:22:02
-RealKeys=0
-EffectiveKeys=0
-DebugSecs=1
diff --git a/Source/php4DelphiD2010.dpk b/Source/php4DelphiD2010.dpk
index 6d19017..f322623 100644
--- a/Source/php4DelphiD2010.dpk
+++ b/Source/php4DelphiD2010.dpk
@@ -34,27 +34,15 @@ requires
   vcl,
   designide,
   vclactnband,
-  vclx;
+  vclx,
+  php4DelphiR2010;
 
 contains
   PHPProjectWizard in 'PHPProjectWizard.pas',
-  { Components Requirements }
-  DelphiFunctions in 'DelphiFunctions.pas',
-  phpLibrary in 'phpLibrary.pas',
-  PHPCommon in 'phpCommon.pas',
-  phpFunctions in 'phpFunctions.pas',
-  ZENDTypes in 'ZENDTypes.pas',
-  phpClass in 'phpClass.pas',
-  php4delphi in 'php4delphi.pas',
-  phpModules in 'phpModules.pas',
-  phpAPI in 'phpAPI.pas',
-  ZENDAPI in 'ZENDAPI.pas',
-  PHPTypes in 'PHPTypes.pas',
-  { Components Requirements }
   php4DelphiReg in 'php4DelphiReg.pas',
   php4DelphiWeb in 'php4DelphiWeb.pas',
   phpWeb in 'phpWeb.pas',
-  phpAbout in 'phpAbout.pas' { dlgAbout };
+  phpAbout in 'phpAbout.pas' {dlgAbout};
 
 end.
 
diff --git a/Source/php4DelphiD2010.dproj.local b/Source/php4DelphiD2010.dproj.local
deleted file mode 100644
index a169e93..0000000
--- a/Source/php4DelphiD2010.dproj.local
+++ /dev/null
@@ -1,6 +0,0 @@
-﻿<?xml version="1.0" encoding="utf-8"?>
-<BorlandProject>
-	<Transactions>
-    <Transaction>1899.12.30 00:00:00.000.520,D:\переустановил\Рабочий стол 08.07.4016\soulengine-5554e3db061d08b94f439be26ed071a74c30071c\php4delphi\php4DelphiD2010.dproj=D:\переустановил\Рабочий стол 08.07.4016\soulengine-5554e3db061d08b94f439be26ed071a74c30071c\php4delphi\php4DelphiD2010.dproj</Transaction>
-  </Transactions>
-</BorlandProject>
diff --git a/Source/php4DelphiD2010.identcache b/Source/php4DelphiD2010.identcache
deleted file mode 100644
index 4f6504a0b4d282d4dec9190c7477d605440ffac2..0000000000000000000000000000000000000000
GIT binary patch
diff --git a/Source/php4DelphiD2010.stat b/Source/php4DelphiD2010.stat
deleted file mode 100644
index 7701441..0000000
--- a/Source/php4DelphiD2010.stat
+++ /dev/null
@@ -1,10 +0,0 @@
-[Stats]
-EditorSecs=240
-DesignerSecs=1
-InspectorSecs=1
-CompileSecs=45492
-OtherSecs=256
-StartTime=04.03.2019 21:55:53
-RealKeys=0
-EffectiveKeys=0
-DebugSecs=1
diff --git a/Source/php4DelphiD5.dproj.local b/Source/php4DelphiD5.dproj.local
deleted file mode 100644
index b3811b7..0000000
--- a/Source/php4DelphiD5.dproj.local
+++ /dev/null
@@ -1,2 +0,0 @@
-﻿<?xml version="1.0" encoding="utf-8"?>
-<BorlandProject/>
diff --git a/Source/php4DelphiD5.stat b/Source/php4DelphiD5.stat
deleted file mode 100644
index 3137e8d..0000000
--- a/Source/php4DelphiD5.stat
+++ /dev/null
@@ -1,10 +0,0 @@
-[Stats]
-EditorSecs=80
-DesignerSecs=1
-InspectorSecs=1
-CompileSecs=8334
-OtherSecs=82
-StartTime=21.09.2018 3:07:20
-RealKeys=0
-EffectiveKeys=0
-DebugSecs=1
diff --git a/Source/php4DelphiD6.dpk b/Source/php4DelphiD6.dpk
index fb713db..a1312f7 100644
--- a/Source/php4DelphiD6.dpk
+++ b/Source/php4DelphiD6.dpk
@@ -30,16 +30,17 @@ package php4DelphiD6;
 {$DESIGNONLY}
 {$IMPLICITBUILD OFF}
 
-rrequires
+requires
   rtl,
+  vcl,
   designide,
   php4DelphiR6;
 
-ocontains
+contains
   PHPProjectWizard in 'PHPProjectWizard.pas',
   php4DelphiReg in 'php4DelphiReg.pas',
   phpWeb in 'phpWeb.pas',
   php4DelphiWeb in 'php4DelphiWeb.pas',
   phpAbout in 'phpAbout.pas' {dlgAbout};
 
-d.
+end.
diff --git a/Source/php4DelphiD6.dproj.local b/Source/php4DelphiD6.dproj.local
deleted file mode 100644
index b3811b7..0000000
--- a/Source/php4DelphiD6.dproj.local
+++ /dev/null
@@ -1,2 +0,0 @@
-﻿<?xml version="1.0" encoding="utf-8"?>
-<BorlandProject/>
diff --git a/Source/php4DelphiD6.stat b/Source/php4DelphiD6.stat
deleted file mode 100644
index 5f3a5ae..0000000
--- a/Source/php4DelphiD6.stat
+++ /dev/null
@@ -1,10 +0,0 @@
-[Stats]
-EditorSecs=2
-DesignerSecs=1
-InspectorSecs=1
-CompileSecs=1
-OtherSecs=3
-StartTime=21.09.2018 3:07:24
-RealKeys=0
-EffectiveKeys=0
-DebugSecs=1
diff --git a/Source/php4DelphiD7.cfg b/Source/php4DelphiD7.cfg
new file mode 100644
index 0000000..290f5ea
--- /dev/null
+++ b/Source/php4DelphiD7.cfg
@@ -0,0 +1,40 @@
+-$A8
+-$B-
+-$C+
+-$D+
+-$E-
+-$F-
+-$G+
+-$H+
+-$I+
+-$J-
+-$K-
+-$L+
+-$M-
+-$N+
+-$O-
+-$P+
+-$Q-
+-$R-
+-$S-
+-$T-
+-$U-
+-$V+
+-$W+
+-$X+
+-$YD
+-$Z1
+-cg
+-AWinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE;
+-H+
+-W+
+-M
+-$M16384,1048576
+-K$00400000
+-LE"c:\program files (x86)\borland\delphi7\Projects\Bpl"
+-LN"c:\program files (x86)\borland\delphi7\Projects\Bpl"
+-DDEBUG
+-Z
+-w-UNSAFE_TYPE
+-w-UNSAFE_CODE
+-w-UNSAFE_CAST
diff --git a/Source/php4DelphiD7.dof b/Source/php4DelphiD7.dof
new file mode 100644
index 0000000..bc67b09
--- /dev/null
+++ b/Source/php4DelphiD7.dof
@@ -0,0 +1,136 @@
+[FileVersion]
+Version=7.0
+[Compiler]
+A=8
+B=0
+C=1
+D=1
+E=0
+F=0
+G=1
+H=1
+I=1
+J=0
+K=0
+L=1
+M=0
+N=1
+O=0
+P=1
+Q=0
+R=0
+S=0
+T=0
+U=0
+V=1
+W=1
+X=1
+Y=1
+Z=1
+ShowHints=1
+ShowWarnings=1
+UnitAliases=WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE;
+NamespacePrefix=
+SymbolDeprecated=1
+SymbolLibrary=1
+SymbolPlatform=1
+UnitLibrary=1
+UnitPlatform=1
+UnitDeprecated=1
+HResultCompat=1
+HidingMember=1
+HiddenVirtual=1
+Garbage=1
+BoundsError=1
+ZeroNilCompat=1
+StringConstTruncated=1
+ForLoopVarVarPar=1
+TypedConstVarPar=1
+AsgToTypedConst=1
+CaseLabelRange=1
+ForVariable=1
+ConstructingAbstract=1
+ComparisonFalse=1
+ComparisonTrue=1
+ComparingSignedUnsigned=1
+CombiningSignedUnsigned=1
+UnsupportedConstruct=1
+FileOpen=1
+FileOpenUnitSrc=1
+BadGlobalSymbol=1
+DuplicateConstructorDestructor=1
+InvalidDirective=1
+PackageNoLink=1
+PackageThreadVar=1
+ImplicitImport=1
+HPPEMITIgnored=1
+NoRetVal=1
+UseBeforeDef=1
+ForLoopVarUndef=1
+UnitNameMismatch=1
+NoCFGFileFound=1
+MessageDirective=1
+ImplicitVariants=1
+UnicodeToLocale=1
+LocaleToUnicode=1
+ImagebaseMultiple=1
+SuspiciousTypecast=1
+PrivatePropAccessor=1
+UnsafeType=0
+UnsafeCode=0
+UnsafeCast=0
+[Linker]
+MapFile=0
+OutputObjs=0
+ConsoleApp=1
+DebugInfo=0
+RemoteSymbols=0
+MinStackSize=16384
+MaxStackSize=1048576
+ImageBase=4194304
+ExeDescription=php4Delphi (design-time)
+[Directories]
+OutputDir=
+UnitOutputDir=
+PackageDLLOutputDir=
+PackageDCPOutputDir=
+SearchPath=
+Packages=
+Conditionals=DEBUG
+DebugSourceDirs=
+UsePackages=0
+[Parameters]
+RunParams=
+HostApplication=
+Launcher=
+UseLauncher=0
+DebugCWD=
+[Language]
+ActiveLang=
+ProjectLang=
+RootDir=
+[Version Info]
+IncludeVerInfo=1
+AutoIncBuild=0
+MajorVer=1
+MinorVer=0
+Release=0
+Build=0
+Debug=0
+PreRelease=0
+Special=0
+Private=0
+DLL=0
+Locale=1058
+CodePage=1251
+[Version Info Keys]
+CompanyName=
+FileDescription=
+FileVersion=1.0.0.0
+InternalName=
+LegalCopyright=
+LegalTrademarks=
+OriginalFilename=
+ProductName=
+ProductVersion=1.0.0.0
+Comments=
diff --git a/Source/php4DelphiD7.dproj.local b/Source/php4DelphiD7.dproj.local
deleted file mode 100644
index b3811b7..0000000
--- a/Source/php4DelphiD7.dproj.local
+++ /dev/null
@@ -1,2 +0,0 @@
-﻿<?xml version="1.0" encoding="utf-8"?>
-<BorlandProject/>
diff --git a/Source/php4DelphiD7.stat b/Source/php4DelphiD7.stat
deleted file mode 100644
index 40ad9b8..0000000
--- a/Source/php4DelphiD7.stat
+++ /dev/null
@@ -1,10 +0,0 @@
-[Stats]
-EditorSecs=57
-DesignerSecs=1
-InspectorSecs=1
-CompileSecs=20209
-OtherSecs=85
-StartTime=21.09.2018 13:19:38
-RealKeys=0
-EffectiveKeys=0
-DebugSecs=1
diff --git a/Source/php4DelphiR2005.dpk b/Source/php4DelphiR2005.dpk
index 4385116..bdd3e86 100644
--- a/Source/php4DelphiR2005.dpk
+++ b/Source/php4DelphiR2005.dpk
@@ -30,22 +30,20 @@ package php4DelphiR2005;
 {$RUNONLY}
 {$IMPLICITBUILD OFF}
 
-rrequires
+requires
   rtl,
   vcl;
 
-ocontains
+contains
   ZENDAPI in 'ZENDAPI.pas',
   DelphiFunctions in 'DelphiFunctions.pas',
   php4delphi in 'php4delphi.pas',
   PHPAPI in 'PHPAPI.pas',
   phpModules in 'phpModules.pas',
   PHPLibrary in 'PHPLibrary.pas',
-  phpCustomLibrary in 'phpCustomLibrary.pas',
   PHPFunctions in 'PHPFunctions.pas',
   PHPTypes in 'PHPTypes.pas',
   ZENDTypes in 'ZENDTypes.pas',
   phpClass in 'phpClass.pas',
   PHPCommon in 'PHPCommon.pas';
-
-d.
+end.
diff --git a/Source/php4DelphiR2005.dproj.local b/Source/php4DelphiR2005.dproj.local
deleted file mode 100644
index b3811b7..0000000
--- a/Source/php4DelphiR2005.dproj.local
+++ /dev/null
@@ -1,2 +0,0 @@
-﻿<?xml version="1.0" encoding="utf-8"?>
-<BorlandProject/>
diff --git a/Source/php4DelphiR2005.stat b/Source/php4DelphiR2005.stat
deleted file mode 100644
index 55185f1..0000000
--- a/Source/php4DelphiR2005.stat
+++ /dev/null
@@ -1,10 +0,0 @@
-[Stats]
-EditorSecs=1
-DesignerSecs=1
-InspectorSecs=1
-CompileSecs=1
-OtherSecs=1
-StartTime=21.09.2018 3:08:04
-RealKeys=0
-EffectiveKeys=0
-DebugSecs=1
diff --git a/Source/php4DelphiR2006.dpk b/Source/php4DelphiR2006.dpk
index 124371d..6bb00b2 100644
--- a/Source/php4DelphiR2006.dpk
+++ b/Source/php4DelphiR2006.dpk
@@ -30,22 +30,21 @@ package php4DelphiR2006;
 {$RUNONLY}
 {$IMPLICITBUILD OFF}
 
-rrequires
+requires
   rtl,
   vcl;
 
-ocontains
+contains
   ZENDAPI in 'ZENDAPI.pas',
   DelphiFunctions in 'DelphiFunctions.pas',
   php4delphi in 'php4delphi.pas',
   PHPAPI in 'PHPAPI.pas',
   phpModules in 'phpModules.pas',
   PHPLibrary in 'PHPLibrary.pas',
-  phpCustomLibrary in 'phpCustomLibrary.pas',
   PHPFunctions in 'PHPFunctions.pas',
   PHPTypes in 'PHPTypes.pas',
   ZENDTypes in 'ZENDTypes.pas',
   phpClass in 'phpClass.pas',
   PHPCommon in 'PHPCommon.pas';
 
-d.
+end.
diff --git a/Source/php4DelphiR2006.dproj.local b/Source/php4DelphiR2006.dproj.local
deleted file mode 100644
index b3811b7..0000000
--- a/Source/php4DelphiR2006.dproj.local
+++ /dev/null
@@ -1,2 +0,0 @@
-﻿<?xml version="1.0" encoding="utf-8"?>
-<BorlandProject/>
diff --git a/Source/php4DelphiR2006.stat b/Source/php4DelphiR2006.stat
deleted file mode 100644
index 3cba0bc..0000000
--- a/Source/php4DelphiR2006.stat
+++ /dev/null
@@ -1,10 +0,0 @@
-[Stats]
-EditorSecs=1
-DesignerSecs=1
-InspectorSecs=1
-CompileSecs=1
-OtherSecs=1
-StartTime=21.09.2018 3:08:05
-RealKeys=0
-EffectiveKeys=0
-DebugSecs=1
diff --git a/Source/php4DelphiR2007.dpk b/Source/php4DelphiR2007.dpk
index bd7459e..05939e5 100644
--- a/Source/php4DelphiR2007.dpk
+++ b/Source/php4DelphiR2007.dpk
@@ -30,22 +30,21 @@ package php4DelphiR2007;
 {$RUNONLY}
 {$IMPLICITBUILD OFF}
 
-rrequires
+requires
   rtl,
   vcl;
 
-ocontains
+contains
   ZENDAPI in 'ZENDAPI.pas',
   DelphiFunctions in 'DelphiFunctions.pas',
   php4delphi in 'php4delphi.pas',
   PHPAPI in 'PHPAPI.pas',
   phpModules in 'phpModules.pas',
   PHPLibrary in 'PHPLibrary.pas',
-  phpCustomLibrary in 'phpCustomLibrary.pas',
   PHPFunctions in 'PHPFunctions.pas',
   PHPTypes in 'PHPTypes.pas',
   ZENDTypes in 'ZENDTypes.pas',
   phpClass in 'phpClass.pas',
   PHPCommon in 'PHPCommon.pas';
 
-d.
+end.
diff --git a/Source/php4DelphiR2007.dproj.local b/Source/php4DelphiR2007.dproj.local
deleted file mode 100644
index b3811b7..0000000
--- a/Source/php4DelphiR2007.dproj.local
+++ /dev/null
@@ -1,2 +0,0 @@
-﻿<?xml version="1.0" encoding="utf-8"?>
-<BorlandProject/>
diff --git a/Source/php4DelphiR2007.stat b/Source/php4DelphiR2007.stat
deleted file mode 100644
index 6544ade..0000000
--- a/Source/php4DelphiR2007.stat
+++ /dev/null
@@ -1,10 +0,0 @@
-[Stats]
-EditorSecs=1
-DesignerSecs=1
-InspectorSecs=1
-CompileSecs=1
-OtherSecs=1
-StartTime=21.09.2018 3:08:16
-RealKeys=0
-EffectiveKeys=0
-DebugSecs=1
diff --git a/Source/php4DelphiR2009.dpk b/Source/php4DelphiR2009.dpk
index ec35688..e7e09aa 100644
--- a/Source/php4DelphiR2009.dpk
+++ b/Source/php4DelphiR2009.dpk
@@ -2,7 +2,6 @@ package php4DelphiR2009;
 
 {$R *.res}
 {$R 'php4delphi.dcr'}
-{$IFDEF IMPLICITBUILDING This IFDEF should not be used by users}
 {$ALIGN 8}
 {$ASSERTIONS ON}
 {$BOOLEVAL OFF}
@@ -13,39 +12,36 @@ package php4DelphiR2009;
 {$LOCALSYMBOLS ON}
 {$LONGSTRINGS ON}
 {$OPENSTRINGS ON}
-{$OPTIMIZATION OFF}
+{$OPTIMIZATION ON}
 {$OVERFLOWCHECKS OFF}
 {$RANGECHECKS OFF}
-{$REFERENCEINFO ON}
+{$REFERENCEINFO OFF}
 {$SAFEDIVIDE OFF}
-{$STACKFRAMES ON}
+{$STACKFRAMES OFF}
 {$TYPEDADDRESS OFF}
 {$VARSTRINGCHECKS ON}
 {$WRITEABLECONST OFF}
 {$MINENUMSIZE 1}
 {$IMAGEBASE $400000}
-{$DEFINE DEBUG}
-{$ENDIF IMPLICITBUILDING}
 {$DESCRIPTION 'php4Delphi (run-rime)'}
 {$RUNONLY}
 {$IMPLICITBUILD OFF}
 
-rrequires
+requires
   rtl,
   vcl;
 
-ocontains
+contains
   ZENDAPI in 'ZENDAPI.pas',
   DelphiFunctions in 'DelphiFunctions.pas',
   php4delphi in 'php4delphi.pas',
   PHPAPI in 'PHPAPI.pas',
   phpModules in 'phpModules.pas',
   PHPLibrary in 'PHPLibrary.pas',
-  phpCustomLibrary in 'phpCustomLibrary.pas',
   PHPFunctions in 'PHPFunctions.pas',
   PHPTypes in 'PHPTypes.pas',
   ZENDTypes in 'ZENDTypes.pas',
   phpClass in 'phpClass.pas',
   PHPCommon in 'PHPCommon.pas';
 
-d.
+end.
diff --git a/Source/php4DelphiR2009.dproj b/Source/php4DelphiR2009.dproj
index 818ccc6..1f38f11 100644
--- a/Source/php4DelphiR2009.dproj
+++ b/Source/php4DelphiR2009.dproj
@@ -1,110 +1,139 @@
-﻿<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-    <PropertyGroup>
-        <ProjectGuid>{B0FA1B58-2442-42C7-83BD-6DD3D0CE3CF8}</ProjectGuid>
-        <MainSource>php4DelphiR2009.dpk</MainSource>
-        <Base>True</Base>
-        <Config Condition="'$(Config)'==''">Debug</Config>
-        <TargetedPlatforms>1</TargetedPlatforms>
-        <AppType>Package</AppType>
-        <FrameworkType>VCL</FrameworkType>
-        <ProjectVersion>18.2</ProjectVersion>
-        <Platform Condition="'$(Platform)'==''">Win32</Platform>
-    </PropertyGroup>
-    <PropertyGroup Condition="'$(Config)'=='Base' or '$(Base)'!=''">
-        <Base>true</Base>
-    </PropertyGroup>
-    <PropertyGroup Condition="('$(Platform)'=='Android' and '$(Base)'=='true') or '$(Base_Android)'!=''">
-        <Base_Android>true</Base_Android>
-        <CfgParent>Base</CfgParent>
-        <Base>true</Base>
-    </PropertyGroup>
-    <PropertyGroup Condition="('$(Platform)'=='Win32' and '$(Base)'=='true') or '$(Base_Win32)'!=''">
-        <Base_Win32>true</Base_Win32>
-        <CfgParent>Base</CfgParent>
-        <Base>true</Base>
-    </PropertyGroup>
-    <PropertyGroup Condition="'$(Config)'=='Release' or '$(Cfg_1)'!=''">
-        <Cfg_1>true</Cfg_1>
-        <CfgParent>Base</CfgParent>
-        <Base>true</Base>
-    </PropertyGroup>
-    <PropertyGroup Condition="'$(Config)'=='Debug' or '$(Cfg_2)'!=''">
-        <Cfg_2>true</Cfg_2>
-        <CfgParent>Base</CfgParent>
-        <Base>true</Base>
-    </PropertyGroup>
-    <PropertyGroup Condition="'$(Base)'!=''">
-        <DCC_DebugInformation>1</DCC_DebugInformation>
-        <DCC_Description>php4Delphi (run-rime)</DCC_Description>
-        <DCC_Namespace>Vcl;Vcl.Imaging;Vcl.Touch;Vcl.Samples;Vcl.Shell;System;Xml;Data;Datasnap;Web;Soap;$(DCC_Namespace)</DCC_Namespace>
-        <SanitizedProjectName>php4DelphiR2009</SanitizedProjectName>
-        <DCC_OutputNeverBuildDcps>true</DCC_OutputNeverBuildDcps>
-        <VerInfo_Locale>1049</VerInfo_Locale>
-        <DCC_N>false</DCC_N>
-        <GenPackage>true</GenPackage>
-        <GenDll>true</GenDll>
-        <RuntimeOnlyPackage>true</RuntimeOnlyPackage>
-        <DCC_F>false</DCC_F>
-        <VerInfo_Keys>CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments=;CFBundleName=</VerInfo_Keys>
-        <DCC_ImageBase>00400000</DCC_ImageBase>
-        <DCC_S>false</DCC_S>
-        <DCC_K>false</DCC_K>
-        <DCC_E>false</DCC_E>
-    </PropertyGroup>
-    <PropertyGroup Condition="'$(Base_Android)'!=''">
-        <EnabledSysJars>android-support-v4.dex.jar;cloud-messaging.dex.jar;fmx.dex.jar;google-analytics-v2.dex.jar;google-play-billing.dex.jar;google-play-licensing.dex.jar;google-play-services.dex.jar</EnabledSysJars>
-    </PropertyGroup>
-    <PropertyGroup Condition="'$(Base_Win32)'!=''">
-        <Icon_MainIcon>php4DelphiR2009_Icon.ico</Icon_MainIcon>
-        <VerInfo_Locale>1033</VerInfo_Locale>
-        <VerInfo_IncludeVerInfo>true</VerInfo_IncludeVerInfo>
-        <VerInfo_Keys>CompanyName=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductVersion=1.0.0.0;Comments=;ProgramID=com.embarcadero.$(ModuleName);FileDescription=$(ModuleName);ProductName=$(ModuleName)</VerInfo_Keys>
-        <DCC_Namespace>Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace)</DCC_Namespace>
-    </PropertyGroup>
-    <PropertyGroup Condition="'$(Cfg_1)'!=''">
-        <DCC_SymbolReferenceInfo>0</DCC_SymbolReferenceInfo>
-        <DCC_LocalDebugSymbols>false</DCC_LocalDebugSymbols>
-        <DCC_Define>RELEASE;$(DCC_Define)</DCC_Define>
-        <DCC_DebugInformation>0</DCC_DebugInformation>
-    </PropertyGroup>
-    <PropertyGroup Condition="'$(Cfg_2)'!=''">
-        <DCC_GenerateStackFrames>true</DCC_GenerateStackFrames>
-        <DCC_Optimize>false</DCC_Optimize>
-        <DCC_Define>DEBUG;$(DCC_Define)</DCC_Define>
-    </PropertyGroup>
-    <ItemGroup>
-        <DelphiCompile Include="$(MainSource)">
-            <MainSource>MainSource</MainSource>
-        </DelphiCompile>
-        <DCCReference Include="php4delphi.dcr"/>
-        <BuildConfiguration Include="Debug">
-            <Key>Cfg_2</Key>
-            <CfgParent>Base</CfgParent>
-        </BuildConfiguration>
-        <BuildConfiguration Include="Base">
-            <Key>Base</Key>
-        </BuildConfiguration>
-        <BuildConfiguration Include="Release">
-            <Key>Cfg_1</Key>
-            <CfgParent>Base</CfgParent>
-        </BuildConfiguration>
-    </ItemGroup>
-    <ProjectExtensions>
-        <Borland.Personality>Delphi.Personality.12</Borland.Personality>
-        <Borland.ProjectType>Package</Borland.ProjectType>
-        <BorlandProject>
-            <Delphi.Personality>
-                <Source>
-                    <Source Name="MainSource">php4DelphiR2009.dpk</Source>
-                </Source>
-            </Delphi.Personality>
-            <Platforms>
-                <Platform value="Android">False</Platform>
-                <Platform value="Win32">True</Platform>
-            </Platforms>
-        </BorlandProject>
-        <ProjectFileVersion>12</ProjectFileVersion>
-    </ProjectExtensions>
-    <Import Project="$(BDS)\Bin\CodeGear.Delphi.Targets" Condition="Exists('$(BDS)\Bin\CodeGear.Delphi.Targets')"/>
-    <Import Project="$(APPDATA)\Embarcadero\$(BDSAPPDATABASEDIR)\$(PRODUCTVERSION)\UserTools.proj" Condition="Exists('$(APPDATA)\Embarcadero\$(BDSAPPDATABASEDIR)\$(PRODUCTVERSION)\UserTools.proj')"/>
-</Project>
+﻿	<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+		<PropertyGroup>
+			<ProjectGuid>{B0FA1B58-2442-42C7-83BD-6DD3D0CE3CF8}</ProjectGuid>
+			<MainSource>php4DelphiR2009.dpk</MainSource>
+			<Base>True</Base>
+			<Config Condition="'$(Config)'==''">Debug</Config>
+			<TargetedPlatforms>1</TargetedPlatforms>
+			<AppType>Package</AppType>
+			<FrameworkType>VCL</FrameworkType>
+			<ProjectVersion>18.2</ProjectVersion>
+			<Platform Condition="'$(Platform)'==''">Win32</Platform>
+			<DCC_DCCCompiler>DCC32</DCC_DCCCompiler>
+		</PropertyGroup>
+		<PropertyGroup Condition="'$(Config)'=='Base' or '$(Base)'!=''">
+			<Base>true</Base>
+		</PropertyGroup>
+		<PropertyGroup Condition="'$(Config)'=='Release' or '$(Cfg_1)'!=''">
+			<Cfg_1>true</Cfg_1>
+			<CfgParent>Base</CfgParent>
+			<Base>true</Base>
+		</PropertyGroup>
+		<PropertyGroup Condition="'$(Config)'=='Debug' or '$(Cfg_2)'!=''">
+			<Cfg_2>true</Cfg_2>
+			<CfgParent>Base</CfgParent>
+			<Base>true</Base>
+		</PropertyGroup>
+		<PropertyGroup Condition="'$(Base)'!=''">
+			<DCC_SymbolReferenceInfo>0</DCC_SymbolReferenceInfo>
+			<DesignOnlyPackage>false</DesignOnlyPackage>
+			<DCC_DependencyCheckOutputName>..\..\..\..\Public\Documents\RAD Studio\6.0\Bpl\php4DelphiR2009.bpl</DCC_DependencyCheckOutputName>
+			<DCC_Description>php4Delphi (run-rime)</DCC_Description>
+			<DCC_Namespace>Vcl;Vcl.Imaging;Vcl.Touch;Vcl.Samples;Vcl.Shell;System;Xml;Data;Datasnap;Web;Soap;$(DCC_Namespace)</DCC_Namespace>
+			<SanitizedProjectName>php4DelphiR2009</SanitizedProjectName>
+			<DCC_OutputNeverBuildDcps>true</DCC_OutputNeverBuildDcps>
+			<VerInfo_Locale>1049</VerInfo_Locale>
+			<DCC_N>false</DCC_N>
+			<GenPackage>true</GenPackage>
+			<GenDll>true</GenDll>
+			<RuntimeOnlyPackage>true</RuntimeOnlyPackage>
+			<DCC_F>false</DCC_F>
+			<VerInfo_Keys>CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments=;CFBundleName=</VerInfo_Keys>
+			<DCC_ImageBase>00400000</DCC_ImageBase>
+			<DCC_S>false</DCC_S>
+			<DCC_K>false</DCC_K>
+			<DCC_E>false</DCC_E>
+		</PropertyGroup>
+		<PropertyGroup Condition="'$(Cfg_1)'!=''">
+			<DCC_SymbolReferenceInfo>0</DCC_SymbolReferenceInfo>
+			<DCC_LocalDebugSymbols>false</DCC_LocalDebugSymbols>
+			<DCC_Define>RELEASE;$(DCC_Define)</DCC_Define>
+			<DCC_DebugInformation>0</DCC_DebugInformation>
+		</PropertyGroup>
+		<PropertyGroup Condition="'$(Cfg_2)'!=''">
+			<DCC_GenerateStackFrames>true</DCC_GenerateStackFrames>
+			<DCC_Optimize>false</DCC_Optimize>
+			<DCC_Define>DEBUG;$(DCC_Define)</DCC_Define>
+		</PropertyGroup>
+		<ItemGroup>
+			<DelphiCompile Include="php4DelphiR2009.dpk">
+				<MainSource>MainSource</MainSource>
+			</DelphiCompile>
+			<DCCReference Include="php4delphi.dcr"/>
+			<DCCReference Include="rtl.dcp"/>
+			<DCCReference Include="vcl.dcp"/>
+			<DCCReference Include="ZENDAPI.pas"/>
+			<DCCReference Include="DelphiFunctions.pas"/>
+			<DCCReference Include="php4delphi.pas"/>
+			<DCCReference Include="PHPAPI.pas"/>
+			<DCCReference Include="phpModules.pas"/>
+			<DCCReference Include="PHPLibrary.pas"/>
+			<DCCReference Include="phpCustomLibrary.pas"/>
+			<DCCReference Include="PHPFunctions.pas"/>
+			<DCCReference Include="PHPTypes.pas"/>
+			<DCCReference Include="ZENDTypes.pas"/>
+			<DCCReference Include="phpClass.pas"/>
+			<DCCReference Include="PHPCommon.pas"/>
+			<DCCReference Include="php4delphi.dcr"/>
+			<BuildConfiguration Include="Base">
+				<Key>Base</Key>
+			</BuildConfiguration>
+			<BuildConfiguration Include="Debug">
+				<Key>Cfg_2</Key>
+				<CfgParent>Base</CfgParent>
+			</BuildConfiguration>
+			<BuildConfiguration Include="Release">
+				<Key>Cfg_1</Key>
+				<CfgParent>Base</CfgParent>
+			</BuildConfiguration>
+		</ItemGroup>
+		<Import Project="$(BDS)\Bin\CodeGear.Delphi.Targets" Condition="Exists('$(BDS)\Bin\CodeGear.Delphi.Targets')"/>
+		<ProjectExtensions>
+			<Borland.Personality>Delphi.Personality.12</Borland.Personality>
+			<Borland.ProjectType>Package</Borland.ProjectType>
+			<BorlandProject>
+				<Delphi.Personality>
+					<Source>
+						<Source Name="MainSource">php4DelphiR2009.dpk</Source>
+					</Source>
+					<Parameters>
+						<Parameters Name="UseLauncher">False</Parameters>
+						<Parameters Name="LoadAllSymbols">True</Parameters>
+						<Parameters Name="LoadUnspecifiedSymbols">False</Parameters>
+					</Parameters>
+					<VersionInfo>
+						<VersionInfo Name="IncludeVerInfo">True</VersionInfo>
+						<VersionInfo Name="AutoIncBuild">False</VersionInfo>
+						<VersionInfo Name="MajorVer">1</VersionInfo>
+						<VersionInfo Name="MinorVer">0</VersionInfo>
+						<VersionInfo Name="Release">0</VersionInfo>
+						<VersionInfo Name="Build">0</VersionInfo>
+						<VersionInfo Name="Debug">False</VersionInfo>
+						<VersionInfo Name="PreRelease">False</VersionInfo>
+						<VersionInfo Name="Special">False</VersionInfo>
+						<VersionInfo Name="Private">False</VersionInfo>
+						<VersionInfo Name="DLL">False</VersionInfo>
+						<VersionInfo Name="Locale">1058</VersionInfo>
+						<VersionInfo Name="CodePage">1251</VersionInfo>
+					</VersionInfo>
+					<VersionInfoKeys>
+						<VersionInfoKeys Name="CompanyName"/>
+						<VersionInfoKeys Name="FileDescription"/>
+						<VersionInfoKeys Name="FileVersion">1.0.0.0</VersionInfoKeys>
+						<VersionInfoKeys Name="InternalName"/>
+						<VersionInfoKeys Name="LegalCopyright"/>
+						<VersionInfoKeys Name="LegalTrademarks"/>
+						<VersionInfoKeys Name="OriginalFilename"/>
+						<VersionInfoKeys Name="ProductName"/>
+						<VersionInfoKeys Name="ProductVersion">1.0.0.0</VersionInfoKeys>
+						<VersionInfoKeys Name="Comments"/>
+					</VersionInfoKeys>
+				</Delphi.Personality>
+				<Platforms>
+					<Platform value="Android">False</Platform>
+					<Platform value="Win32">True</Platform>
+				</Platforms>
+			</BorlandProject>
+			<ProjectFileVersion>12</ProjectFileVersion>
+		</ProjectExtensions>
+	</Project>
diff --git a/Source/php4DelphiR2009.dproj.local b/Source/php4DelphiR2009.dproj.local
deleted file mode 100644
index b3811b7..0000000
--- a/Source/php4DelphiR2009.dproj.local
+++ /dev/null
@@ -1,2 +0,0 @@
-﻿<?xml version="1.0" encoding="utf-8"?>
-<BorlandProject/>
diff --git a/Source/php4DelphiR2009.res b/Source/php4DelphiR2009.res
index b946c3cf4737f4cfe63fa0bc6b919aa29fe155e5..4ed2b323e18cf6de8d1fcabf8a5f7f57159fa833 100644
GIT binary patch
diff --git a/Source/php4DelphiR2009.stat b/Source/php4DelphiR2009.stat
deleted file mode 100644
index 32ee432..0000000
--- a/Source/php4DelphiR2009.stat
+++ /dev/null
@@ -1,10 +0,0 @@
-[Stats]
-EditorSecs=1
-DesignerSecs=1
-InspectorSecs=1
-CompileSecs=1
-OtherSecs=1
-StartTime=21.09.2018 3:08:17
-RealKeys=0
-EffectiveKeys=0
-DebugSecs=1
diff --git a/Source/php4DelphiR2010.dproj.local b/Source/php4DelphiR2010.dproj.local
deleted file mode 100644
index 2c5c945..0000000
--- a/Source/php4DelphiR2010.dproj.local
+++ /dev/null
@@ -1,6 +0,0 @@
-﻿<?xml version="1.0" encoding="utf-8"?>
-<BorlandProject>
-	<Transactions>
-    <Transaction>1899.12.30 00:00:00.000.755,C:\Users\User\Desktop\soulengine-5554e3db061d08b94f439be26ed071a74c30071c\php4delphi\php4DelphiR2010.dproj=C:\Users\User\Desktop\soulengine-5554e3db061d08b94f439be26ed071a74c30071c\php4delphi\php4DelphiR2010.dproj</Transaction>
-  </Transactions>
-</BorlandProject>
diff --git a/Source/php4DelphiR2010.identcache b/Source/php4DelphiR2010.identcache
deleted file mode 100644
index 1dac930ecb535057e1680df202d4aaf389edca0a..0000000000000000000000000000000000000000
GIT binary patch
diff --git a/Source/php4DelphiR2010.stat b/Source/php4DelphiR2010.stat
deleted file mode 100644
index 92d1072..0000000
--- a/Source/php4DelphiR2010.stat
+++ /dev/null
@@ -1,10 +0,0 @@
-[Stats]
-EditorSecs=4262
-DesignerSecs=1
-InspectorSecs=3
-CompileSecs=138371
-OtherSecs=477
-StartTime=29.07.4016 22:02:01
-RealKeys=0
-EffectiveKeys=0
-DebugSecs=1
diff --git a/Source/php4DelphiR5.dpk b/Source/php4DelphiR5.dpk
index e1c6298..555ae25 100644
--- a/Source/php4DelphiR5.dpk
+++ b/Source/php4DelphiR5.dpk
@@ -38,13 +38,12 @@ contains
   DelphiFunctions in 'DelphiFunctions.pas',
   php4delphi in 'php4delphi.pas',
   PHPAPI in 'PHPAPI.pas',
+  phpModules in 'phpModules.pas',
   PHPLibrary in 'PHPLibrary.pas',
-  phpCustomLibrary in 'phpCustomLibrary.pas',
-  phpFunctions in 'phpFunctions.pas',
+  PHPFunctions in 'PHPFunctions.pas',
   PHPTypes in 'PHPTypes.pas',
   ZENDTypes in 'ZENDTypes.pas',
   phpClass in 'phpClass.pas',
-  phpModules in 'phpModules.pas',
   PHPCommon in 'PHPCommon.pas';
 
 END.
diff --git a/Source/php4DelphiR5.dproj.local b/Source/php4DelphiR5.dproj.local
deleted file mode 100644
index b3811b7..0000000
--- a/Source/php4DelphiR5.dproj.local
+++ /dev/null
@@ -1,2 +0,0 @@
-﻿<?xml version="1.0" encoding="utf-8"?>
-<BorlandProject/>
diff --git a/Source/php4DelphiR5.identcache b/Source/php4DelphiR5.identcache
deleted file mode 100644
index ad5b648ef899d1efd57807697fcece7e57628518..0000000000000000000000000000000000000000
GIT binary patch
diff --git a/Source/php4DelphiR5.stat b/Source/php4DelphiR5.stat
deleted file mode 100644
index 7e8d660..0000000
--- a/Source/php4DelphiR5.stat
+++ /dev/null
@@ -1,10 +0,0 @@
-[Stats]
-EditorSecs=96
-DesignerSecs=1
-InspectorSecs=1
-CompileSecs=9481
-OtherSecs=55
-StartTime=21.09.2018 3:07:56
-RealKeys=0
-EffectiveKeys=0
-DebugSecs=1
diff --git a/Source/php4DelphiR6.dpk b/Source/php4DelphiR6.dpk
index b96a100..78e7aa7 100644
--- a/Source/php4DelphiR6.dpk
+++ b/Source/php4DelphiR6.dpk
@@ -30,22 +30,21 @@ package php4DelphiR6;
 {$RUNONLY}
 {$IMPLICITBUILD OFF}
 
-rrequires
+requires
   rtl,
   vcl;
 
-ocontains
+contains
   ZENDAPI in 'ZENDAPI.pas',
   DelphiFunctions in 'DelphiFunctions.pas',
   php4delphi in 'php4delphi.pas',
   PHPAPI in 'PHPAPI.pas',
   phpModules in 'phpModules.pas',
   PHPLibrary in 'PHPLibrary.pas',
-  phpCustomLibrary in 'phpCustomLibrary.pas',
   PHPFunctions in 'PHPFunctions.pas',
-  ZendTypes in 'ZendTypes.pas',
-  phpTypes in 'phpTypes.pas',
+  PHPTypes in 'PHPTypes.pas',
+  ZENDTypes in 'ZENDTypes.pas',
   phpClass in 'phpClass.pas',
   PHPCommon in 'PHPCommon.pas';
 
-d.
+end.
diff --git a/Source/php4DelphiR6.dproj.local b/Source/php4DelphiR6.dproj.local
deleted file mode 100644
index b3811b7..0000000
--- a/Source/php4DelphiR6.dproj.local
+++ /dev/null
@@ -1,2 +0,0 @@
-﻿<?xml version="1.0" encoding="utf-8"?>
-<BorlandProject/>
diff --git a/Source/php4DelphiR6.stat b/Source/php4DelphiR6.stat
deleted file mode 100644
index 0c40d2a..0000000
--- a/Source/php4DelphiR6.stat
+++ /dev/null
@@ -1,10 +0,0 @@
-[Stats]
-EditorSecs=1
-DesignerSecs=1
-InspectorSecs=1
-CompileSecs=1
-OtherSecs=1
-StartTime=21.09.2018 3:07:52
-RealKeys=0
-EffectiveKeys=0
-DebugSecs=1
diff --git a/Source/php4DelphiR7.cfg b/Source/php4DelphiR7.cfg
new file mode 100644
index 0000000..290f5ea
--- /dev/null
+++ b/Source/php4DelphiR7.cfg
@@ -0,0 +1,40 @@
+-$A8
+-$B-
+-$C+
+-$D+
+-$E-
+-$F-
+-$G+
+-$H+
+-$I+
+-$J-
+-$K-
+-$L+
+-$M-
+-$N+
+-$O-
+-$P+
+-$Q-
+-$R-
+-$S-
+-$T-
+-$U-
+-$V+
+-$W+
+-$X+
+-$YD
+-$Z1
+-cg
+-AWinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE;
+-H+
+-W+
+-M
+-$M16384,1048576
+-K$00400000
+-LE"c:\program files (x86)\borland\delphi7\Projects\Bpl"
+-LN"c:\program files (x86)\borland\delphi7\Projects\Bpl"
+-DDEBUG
+-Z
+-w-UNSAFE_TYPE
+-w-UNSAFE_CODE
+-w-UNSAFE_CAST
diff --git a/Source/php4DelphiR7.dof b/Source/php4DelphiR7.dof
new file mode 100644
index 0000000..f3d0e61
--- /dev/null
+++ b/Source/php4DelphiR7.dof
@@ -0,0 +1,136 @@
+[FileVersion]
+Version=7.0
+[Compiler]
+A=8
+B=0
+C=1
+D=1
+E=0
+F=0
+G=1
+H=1
+I=1
+J=0
+K=0
+L=1
+M=0
+N=1
+O=0
+P=1
+Q=0
+R=0
+S=0
+T=0
+U=0
+V=1
+W=1
+X=1
+Y=1
+Z=1
+ShowHints=1
+ShowWarnings=1
+UnitAliases=WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE;
+NamespacePrefix=
+SymbolDeprecated=1
+SymbolLibrary=1
+SymbolPlatform=1
+UnitLibrary=1
+UnitPlatform=1
+UnitDeprecated=1
+HResultCompat=1
+HidingMember=1
+HiddenVirtual=1
+Garbage=1
+BoundsError=1
+ZeroNilCompat=1
+StringConstTruncated=1
+ForLoopVarVarPar=1
+TypedConstVarPar=1
+AsgToTypedConst=1
+CaseLabelRange=1
+ForVariable=1
+ConstructingAbstract=1
+ComparisonFalse=1
+ComparisonTrue=1
+ComparingSignedUnsigned=1
+CombiningSignedUnsigned=1
+UnsupportedConstruct=1
+FileOpen=1
+FileOpenUnitSrc=1
+BadGlobalSymbol=1
+DuplicateConstructorDestructor=1
+InvalidDirective=1
+PackageNoLink=1
+PackageThreadVar=1
+ImplicitImport=1
+HPPEMITIgnored=1
+NoRetVal=1
+UseBeforeDef=1
+ForLoopVarUndef=1
+UnitNameMismatch=1
+NoCFGFileFound=1
+MessageDirective=1
+ImplicitVariants=1
+UnicodeToLocale=1
+LocaleToUnicode=1
+ImagebaseMultiple=1
+SuspiciousTypecast=1
+PrivatePropAccessor=1
+UnsafeType=0
+UnsafeCode=0
+UnsafeCast=0
+[Linker]
+MapFile=0
+OutputObjs=0
+ConsoleApp=1
+DebugInfo=0
+RemoteSymbols=0
+MinStackSize=16384
+MaxStackSize=1048576
+ImageBase=4194304
+ExeDescription=php4Delphi (run-rime)
+[Directories]
+OutputDir=
+UnitOutputDir=
+PackageDLLOutputDir=
+PackageDCPOutputDir=
+SearchPath=
+Packages=
+Conditionals=DEBUG
+DebugSourceDirs=
+UsePackages=0
+[Parameters]
+RunParams=
+HostApplication=
+Launcher=
+UseLauncher=0
+DebugCWD=
+[Language]
+ActiveLang=
+ProjectLang=
+RootDir=
+[Version Info]
+IncludeVerInfo=1
+AutoIncBuild=0
+MajorVer=1
+MinorVer=0
+Release=0
+Build=0
+Debug=0
+PreRelease=0
+Special=0
+Private=0
+DLL=0
+Locale=1058
+CodePage=1251
+[Version Info Keys]
+CompanyName=
+FileDescription=
+FileVersion=1.0.0.0
+InternalName=
+LegalCopyright=
+LegalTrademarks=
+OriginalFilename=
+ProductName=
+ProductVersion=1.0.0.0
+Comments=
diff --git a/Source/php4DelphiR7.dpk b/Source/php4DelphiR7.dpk
index cbc7fef..dc295fa 100644
--- a/Source/php4DelphiR7.dpk
+++ b/Source/php4DelphiR7.dpk
@@ -41,7 +41,6 @@ contains
   PHPAPI in 'PHPAPI.pas',
   phpModules in 'phpModules.pas',
   PHPLibrary in 'PHPLibrary.pas',
-  phpCustomLibrary in 'phpCustomLibrary.pas',
   PHPFunctions in 'PHPFunctions.pas',
   PHPTypes in 'PHPTypes.pas',
   ZENDTypes in 'ZENDTypes.pas',
diff --git a/Source/php4DelphiR7.dproj.local b/Source/php4DelphiR7.dproj.local
deleted file mode 100644
index b3811b7..0000000
--- a/Source/php4DelphiR7.dproj.local
+++ /dev/null
@@ -1,2 +0,0 @@
-﻿<?xml version="1.0" encoding="utf-8"?>
-<BorlandProject/>
diff --git a/Source/php4DelphiR7.identcache b/Source/php4DelphiR7.identcache
deleted file mode 100644
index 5416a4118405a623d0c0f6bb70852ad19a744896..0000000000000000000000000000000000000000
GIT binary patch
diff --git a/Source/php4DelphiR7.stat b/Source/php4DelphiR7.stat
deleted file mode 100644
index d2541d1..0000000
--- a/Source/php4DelphiR7.stat
+++ /dev/null
@@ -1,10 +0,0 @@
-[Stats]
-EditorSecs=157
-DesignerSecs=1
-InspectorSecs=1
-CompileSecs=5944
-OtherSecs=23
-StartTime=21.09.2018 3:08:01
-RealKeys=0
-EffectiveKeys=0
-DebugSecs=1
diff --git a/Source/php4delphi.pas b/Source/php4delphi.pas
index d1fa8cf..c999320 100644
--- a/Source/php4delphi.pas
+++ b/Source/php4delphi.pas
@@ -36,13 +36,50 @@
 interface
 
 uses
-  Windows, Messages, SysUtils, System.Types, Classes, VCL.Graphics,
-  PHPCommon, WinApi.WinSock,
+  Windows, Messages, SysUtils,
+  {$if CompilerVersion > 21}
+  System.Types,
+  {$else}
+  Types,
+  {$ifend}
+   Classes,
+  {$if defined(REGISTER_COLOURS) or defined(php_side_handler)}
+
+  {$if defined(LCL) or (defined(VCL) and (CompilerVersion < 22))}
+  Graphics,
+  {$ifdef php_side_handler}
+  Dialogs,
+  {$endif}
+{$elseif defined(KYLIX)}
+  QGraphics,
+  {$ifdef php_side_handler}
+  QDialogs,
+  {$endif}
+{$elseif defined(FMX)}
+  FMX.GraphConsts,
+  {$ifdef php_side_handler}
+  FMX.Dialogs,
+  {$endif}
+{$elseif defined(VCL)}
+  VCL.Graphics,
+  {$ifdef php_side_handler}
+  VCL.Dialogs,
+  {$endif}
+{$ifend}
+  {$ENDIF}
+  PHPCommon,
+  {$if CompilerVersion > 21}
+  WinApi.WinSock,
+  {$else}
+  WinSock,
+  {$ifend}
+
   ZendTypes, PHPTypes, PHPAPI, ZENDAPI,
-  DelphiFunctions, phpFunctions, strUtils, varUtils,
-  {$IFDEF PHP_UNICODE}WideStrUtils, {$ENDIF}
-  {$IFDEF php_side_handler} {$IFDEF FMX}FMX.Dialogs{$ELSE}VCL.Dialogs{$ENDIF}, {$ENDIF}
-  System.UITypes;
+  DelphiFunctions, phpFunctions, strUtils, varUtils
+  {$IFDEF PHP_UNICODE}, WideStrUtils{$ENDIF}
+  {$if CompilerVersion > 21}
+  , System.UITypes
+  {$ifend};
 
 type
 
@@ -197,7 +234,11 @@   TPHPEngine = class(TPHPComponent, IUnknown, IPHPEngine)
   private
     FINIPath : zend_ustr;
     FOnEngineStartup  : TNotifyEvent;
+    {$if CompilerVersion > 21}
     FAddMods          : TArray<Pzend_module_entry>;
+    {$else}
+    FAddMods          : array of Pzend_module_entry;
+    {$ifend}
     FOnEngineShutdown : TNotifyEvent;
     FEngineActive     : boolean;
     FHandleErrors     : boolean;
@@ -1739,7 +1780,7 @@ procedure TPHPEngine.ShutdownEngine;
     except
 
     end;
-    {$ENDIF}
+    {$ifend}
     FHash.Clear;
    finally
      FEngineActive := false;
@@ -1854,9 +1895,9 @@ procedure TPHPEngine.StartupPHP;
    if not PHPLoaded then
     begin
       if FDLLFolder <> '' then
-         DLLName := IncludeTrailingBackSlash(FDLLFolder) + PHPWin
+         DLLName := IncludeTrailingBackSlash(FDLLFolder) + PHPlp
            else
-             DLLName := PHPWin;
+             DLLName := PHPlp;
       LoadPHP(DLLName);
       if FReportDLLError then
        begin
diff --git a/Source/phpClass.pas b/Source/phpClass.pas
index 3770112..0c9f39b 100644
--- a/Source/phpClass.pas
+++ b/Source/phpClass.pas
@@ -643,6 +643,7 @@ function TClassProperty.GetAsInteger: integer;
 var
  c: CharPtr;
 begin
+{$if CompilerVersion > 21}
   c := FormatSettings.DecimalSeparator;
   try
     FormatSettings.DecimalSeparator := '.';
@@ -650,6 +651,15 @@ function TClassProperty.GetAsInteger: integer;
   finally
    FormatSettings.DecimalSeparator := c;
   end;
+{$else}
+  c := DecimalSeparator;
+  try
+    DecimalSeparator := '.';
+    Result := Round(ValueToFloat(FValue));
+  finally
+   DecimalSeparator := c;
+  end;
+{$ifend}
 end;
 
 function TClassProperty.GetDisplayName: string;
@@ -677,6 +687,7 @@ procedure TClassProperty.SetAsInteger(const Value: integer);
 var
  c: CharPtr;
 begin
+{$if CompilerVersion > 21}
   c := FormatSettings.DecimalSeparator;
   try
    FormatSettings.DecimalSeparator := '.';
@@ -684,6 +695,15 @@ procedure TClassProperty.SetAsInteger(const Value: integer);
   finally
    FormatSettings.DecimalSeparator := c;
   end;
+{$else}
+  c := DecimalSeparator;
+  try
+   DecimalSeparator := '.';
+   FValue := IntToStr(Value);
+  finally
+   DecimalSeparator := c;
+  end;
+{$ifend}
 end;
 
 
diff --git a/Source/phpModules.pas b/Source/phpModules.pas
index 6c12fa1..fdff4f1 100644
--- a/Source/phpModules.pas
+++ b/Source/phpModules.pas
@@ -16,7 +16,17 @@
 
 interface
  uses
-   SyncObjs, {$IFNDEF FPC} Windows, {$ELSE} LCLType,LCLIntf,dynlibs,LCLProc,{$ENDIF} SysUtils, Types, Classes, VCL.Forms, VCL.Consts,
+   SyncObjs, {$IFNDEF FPC} Windows, {$ELSE} LCLType,LCLIntf,dynlibs,LCLProc,{$ENDIF} SysUtils, Types, Classes,
+   {$if defined(VCL) and (CompilerVersion > 21)}
+   VCL.Forms, VCL.Consts,
+   {$elseif defined(FMX)}
+   FMX.Forms, FMX.Consts,
+   {$elseif defined(KYLIX)}
+   QForms, QConsts,
+   {$elseif defined(VCL) or defined(LCL)}
+   Forms, Consts,
+   {$ifend}
+
    PHPCommon,
    {$IFDEF VERSION6}RTLConsts, Variants,{$ENDIF} ZendAPI, phpAPI,
    phpFunctions,
@@ -456,7 +466,7 @@ constructor TPHPExtension.Create(AOwner: TComponent);
     try
       if Assigned(OnCreate) and OldCreateOrder then OnCreate(Self);
     except
-      VCL.Forms.Application.HandleException(Self);
+      Forms.Application.HandleException(Self);
     end;
   end;
 end;
@@ -467,13 +477,13 @@ constructor TPHPExtension.Create(AOwner: TComponent);
 procedure DoneVCLApplication;
 begin
   try
-   VCL.Forms.Application.OnException := nil;
+   Forms.Application.OnException := nil;
    {$IFDEF WINDOWS}
-   if VCL.Forms.Application.Handle <> 0 then ShowOwnedPopups(VCL.Forms.Application.Handle, False);
+   if Forms.Application.Handle <> 0 then ShowOwnedPopups(Forms.Application.Handle, False);
    {$ELSE}
-   VCL.Forms.Application.ShowHint := False;
-   VCL.Forms.Application.Destroying;
-   VCL.Forms.Application.DestroyComponents;
+   Forms.Application.ShowHint := False;
+   Forms.Application.Destroying;
+   Forms.Application.DestroyComponents;
    {$ENDIF}
   except
   end; 
@@ -607,7 +617,7 @@ procedure TPHPApplication.OnExceptionHandler(Sender: TObject;
 
 procedure TPHPApplication.Run;
 begin
-  VCL.Forms.Application.OnException := OnExceptionHandler;
+  Forms.Application.OnException := OnExceptionHandler;
 end;
 
 
diff --git a/php4Delphi.pdf b/php4Delphi.pdf
deleted file mode 100644
index b88790c9594403975fa8ad4e010168f618d7117a..0000000000000000000000000000000000000000
GIT binary patch

From e6cb7b4053d7e98856a3bd9f0b59dfcbbbc34942 Mon Sep 17 00:00:00 2001
From: lion <levzenin@pm.me>
Date: Sat, 18 Jul 2020 18:16:52 +0300
Subject: [PATCH 30/35] readme.txt -> README.md: /r/

---
 readme.txt => README.md | 502 ++++++++++++++++++++--------------------
 1 file changed, 251 insertions(+), 251 deletions(-)
 rename readme.txt => README.md (94%)

diff --git a/readme.txt b/README.md
similarity index 94%
rename from readme.txt
rename to README.md
index f24d7d9..353fc1e 100644
--- a/readme.txt
+++ b/README.md
@@ -1,251 +1,251 @@
-                     PHP4Delphi library                       
-PHP - Delphi interface and PHP extensions development framework                  
-
-{ $Id: readme.txt,v 7.4 07/2020 delphi32 Exp $ } 
-
-PHP4Delphi is a Delphi interface to PHP for Delphi {2007, ..., Berlin}
-
-PHP4Delphi consists of 3 big subprojects:
-
-1. PHP scripting (using PHP as a scripting language in Delphi applications)
-PHP4Delphi allows to execute the PHP scripts within the Delphi program using 
-TpsvPHP component directly without a WebServer. 
-It is a PHP extension that enables you to write client-side GUI applications. 
-One of the goals behind it was to prove that PHP is a capable general-purpose scripting 
-language that is suited for more than just Web applications. 
-It is used by "Delphi for PHP" from CodeGear.
-
-2. PHP extensions development framework (using Delphi to extend PHP functionality)
-Visual Development Framework gives possibility to create custom PHP
-Extensions using Delphi. 
-PHP extension, in the most basic of terms, is a set of instructions that is
-designed to add functionality to PHP.
-
-3. PHP4Applications (integrate PHP in any application)
-Supports C, C++, Visual Basic, VBA, C#, Delphi, Delphi .NET, Visual Basic .NET etc. 
-
-
-More detail information available in php4Delphi manual php4Delphi.pdf
-
-
-This is a source-only release of php4Delphi. It includes
-design-time and run-time packages for Delphi 2007 through Delphi Berlin
-
-
-
-History:
-7.4 Mar 2019
-
-* Compatible with PHP 5.5.0
-* Compatible with PHP 5.6.0
-* Compatible with PHP 5.6.x
-* Compatible with Delphi 2011, XE8, Seattle, Berlin
-* Added unicode support
-
-7.3 Jan 2019
-
-* Compatible with PHP 5.4.0
-
-7.2 Oct 2009
-
-* Compatible with Delphi 2010
-* Compatible with PHP 5.2.11
-* Compatible with PHP 5.3.0 (VC6 and VC9 editions : see PHP.INC for more details)
-
-7.1 Oct 2008
-
-* Compatible with Delphi 2009
-
-7.0 Apr 2007
-
-* Compatible with Delphi 2007
-* Compatible with PHP 5.2.1
-* Compatible with PHP 4.4.6
-* Thread safe TpsvPHP component
-* New component TPHPEngine introduced
-* RunCode method reimplemented to solve "black horror" of pipes.
-* Not fully compatible with previous version due to multithreading, but migration is easy.
-
-6.2 Feb 2006
-
-* Compatible with PHP 5.2.0
-* Compatible with Delphi 2006
-* Compatible with PHP 5.1.1
-* Compatible with PHP 5.1.2
-* Code reorganized, some crap was removed
-* Added headers support (Michael Maroszek)
-* New demo projects
-* PHP4Applications revisited
-
-6.1
-
-* Compatible with PHP 5.0.4
-* Compatible with PHP 5.1.0b3
-* Compatible with Delphi 2005
-
-6.0
-
-* Translated Zend II API
-* New PHP Object Model support
-* PHP classes support for PHP4 and PHP5
-* New demo projects
-* TPHPClass component compatible with PHP4 and PHP5
-* Added new property DLLFolder to psvPHP component
-* New component PHPSystemLibrary
-
-5.5 fix 1
-
-* New property RegisterGlobals (boolean) added to psvPHP component
-* New property MaxExecutionTime (integer) added to psvPHP component - Maximum execution time of each script, in seconds
-* New property MaxInputTime (integer) added to psvPHP component - Maximum amount of time each script may spend parsing request data
-* New property SafeMode (boolean) added to psvPHP component
-* New property SafeModeGid (boolean) added to psvPHP component -  When safe_mode is on, UID/GID checks are bypassed when
-  including files from this directory and its subdirectories. (directory must also be in include_path or full path must
-  be used when including)
-* Memory leak fixed in phpModules unit
-* php_class demo project errors fixed
-* psvPHP can load now PHP modules using dl() function
-
-5.5
-
-* New component TPHPClass added (only for PHP 4)
-* Added support of PHP 5
-* Improved speed of unloading of the PHP extensions under Apache 
-* Decreased size of the compiled modules (based on API only and developed using Visual FrameWork)
-* ZendAPI unit is splitted to ZendAPI and ZendTypes units
-* PHPAPI unit is splitted to  PHPAPI and PHPTypes units
-* New version of php4App - php4Applications subproject. 
-  php4Applications allows to use php scripts in VB, C, C++, etc applications.
-  Demo projects for Delphi, VC and MS Word included.
-* New property UseDelimiters added to TpsvPHP component. If UseDelimiters = true (by default) the
-  syntax of RunCode method parameter ACode should include standard script delimiters "<?" and "?>"
-  to make RunCode and Execute method compatible.
-* New parameters for OnScriptError event (error type, file name and line number)
-
-5.4
-
-* Minor bugs fixed
-* Documentation improved 
-* New property IniPath (folder where php.ini located) added to TpsvPHP component
-* New functions translated in ZendAPI unit
-
-5.3
-* Added new public property ExecuteMethod to psvPHP component. 
-  if ExecuteMethod is emGet, psvPHP receives variables as $_GET["variable"],
-  if ExecuteMethod is emServer (default), psvPHP receives variables as $variable.
-  Can be used to debug real PHP scripts with GET parameters.
-* Added possibility to access published property of Delphi components from PHP
-* Fixed problem with loading of PHP extension compiled wihout PHP4DELPHI_AUTOLOAD
-  option.
-
-5.2
-* Added dynamic attachement of all exported functions from php4ts.dll
-  in PHPAPI.pas
-* New function for safe dynamic functions linking PHPStubInit and ZendStubInit
-  This functions can be used if you are planning to work with beta-version of PHP,
-  for example
-* New unit zend_dynamic_array.pas
-* New unit logos.pas
-
-5.0.3
-* Fixed bug when php function without parameters does not return value.
-* New classes: TZendVariable and TZendValue in  phpFunctions.pas
-* New subproject: php4App
-  Using php4App you can integrate PHP not only with Delphi, but with VB, for example
-
-5.0.2 
-* Fixed problem with assembler code in ZENDAPI.pas for Delphi 7
-
-5.0.1
-* Fixed problem with number of parameters of zend_getparameters_ex function
-
-5.0
-* First version written in Delphi
-
-
-1.0 - 4.0  
-* php4Delphi was written in C as a DLL with simple Delphi wrapper
- 
-
-Before using php4Delphi library:
-
-If you have no PHP installed, you have to download and 
-install PHP separately. It is not included in the package.
-You can download the latest version of PHP from
-http://www.php.net/downloads.php
-
-ZEND API documentation available at http://www.zend.com
-PHP  API documentation available at http://www.php.net
-
-You need to ensure that the dlls which php uses can be found. 
-php4ts.dll is always used. If you are using any php extension dlls then you
-will need those as well. 
-To make sure that the dlls can be found, you can either copy them to the 
-system directory (e.g. winnt/system32 or  windows/system).
-
-Copy the file, php.ini-dist to your %WINDOWS% directory on
-Windows 95/98 or to your %SYSTEMROOT% directory under Windows NT,
-Windows 2000 or Windows XP and rename it to php.ini. Your %WINDOWS% or
-%SYSTEMROOT% directory is typically:
-c:\windows for Windows 95/98
-c:\winnt or c:\winnt40 for NT/2000/XP servers
-
-How to install php4Delphi library:
-
-Delphi 2007 & up:
-
-Uninstall previous installed version of php4Delphi Library from Delphi 2007 IDE.
-Remove previously compiled php4Delphi packages from your hard disk.
-
-Select PHP version you are going to use. php4Delphi supports PHP 5.x, 
-but not at the same time. You have to compile php4Delphi for selected target version of PHP.
-
-Open PHP.INC file.
-If you are using PHP5:
-a) Uncomment (remove dot) from definition of suitable php, VC, Visual Library and architecture version
-b) Uncomment (remove dot) from definition of prefered features in the feature block of the PHP.INC file
-c) Save PHP.INC file
-
-Use "File\Open..." menu item of Delphi IDE to open php4Delphi runtime
-choose suitable Runtime package php4DelphiR(Your Delphi Version).dpk; In "Package..." window click "Compile" button to
-compile packages. 
-Put compiled BPL file into directory that is accessible through the search PATH (i.e. DOS
-"PATH" environment variable; 
-for example, in the Windows\System directory).
-
-After compiling php4Delphi run-time package you must install design-time
-package into the IDE.
-
-Use "File\Open..." menu item to open design-time package php4DelphiD(Your Delphi Version).dpk
-In "Package..." window click "Compile" button to compile the package
-and then click "Install" button to register php4Delphi Library 
-components on the component palette. 
-
-
-Since this is a freeware you are strongly encouraged to look 
-at the source code and improve on the components if you want to. 
-Of course I would appreciate it if you would send me back the 
-changes and bug fixes you have made. 
-
-For more information on the PHP Group and the PHP project,
-please see <http://www.php.net>.
-
-
-PHP4Delphi forum
-http://sourceforge.net/forum/forum.php?forum_id=324242
-
-Authors:                                              
-Serhiy Perevoznyk                                     
-Belgium
-serge_perevoznyk@hotmail.com
-http://users.telenet.be/ws36637
-http://delphi32.blogspot.com
-
-Lew Zienin
-Poland
-levzenin@pm.me
-
-Nikita Ganzikov
-Ukraine
-pig-l@mail.ru
-
+# PHP4Delphi library                       
+
+PHP - Delphi interface and PHP extensions development framework                  
+
+{ $Id: readme.txt,v 7.4 07/2020 delphi32 Exp $ } 
+
+PHP4Delphi is a Delphi interface to PHP for Delphi {2007, ..., Berlin}
+
+PHP4Delphi consists of 3 big subprojects:
+
+1. PHP scripting (using PHP as a scripting language in Delphi applications)
+PHP4Delphi allows to execute the PHP scripts within the Delphi program using 
+TpsvPHP component directly without a WebServer. 
+It is a PHP extension that enables you to write client-side GUI applications. 
+One of the goals behind it was to prove that PHP is a capable general-purpose scripting 
+language that is suited for more than just Web applications. 
+It is used by "Delphi for PHP" from CodeGear.
+
+2. PHP extensions development framework (using Delphi to extend PHP functionality)
+Visual Development Framework gives possibility to create custom PHP
+Extensions using Delphi. 
+PHP extension, in the most basic of terms, is a set of instructions that is
+designed to add functionality to PHP.
+
+3. PHP4Applications (integrate PHP in any application)
+Supports C, C++, Visual Basic, VBA, C#, Delphi, Delphi .NET, Visual Basic .NET etc. 
+
+
+More detail information available in php4Delphi manual php4Delphi.pdf
+
+
+This is a source-only release of php4Delphi. It includes
+design-time and run-time packages for Delphi 2007 through Delphi Berlin
+
+
+
+# History
+
+7.4 Mar 2019
+
+* Compatible with PHP 5.5.0
+* Compatible with PHP 5.6.0
+* Compatible with PHP 5.6.x
+* Compatible with Delphi 2011, XE8, Seattle, Berlin
+* Added unicode support
+
+7.3 Jan 2019
+
+* Compatible with PHP 5.4.0
+
+7.2 Oct 2009
+
+* Compatible with Delphi 2010
+* Compatible with PHP 5.2.11
+* Compatible with PHP 5.3.0 (VC6 and VC9 editions : see PHP.INC for more details)
+
+7.1 Oct 2008
+
+* Compatible with Delphi 2009
+
+7.0 Apr 2007
+
+* Compatible with Delphi 2007
+* Compatible with PHP 5.2.1
+* Compatible with PHP 4.4.6
+* Thread safe TpsvPHP component
+* New component TPHPEngine introduced
+* RunCode method reimplemented to solve "black horror" of pipes.
+* Not fully compatible with previous version due to multithreading, but migration is easy.
+
+6.2 Feb 2006
+
+* Compatible with PHP 5.2.0
+* Compatible with Delphi 2006
+* Compatible with PHP 5.1.1
+* Compatible with PHP 5.1.2
+* Code reorganized, some crap was removed
+* Added headers support (Michael Maroszek)
+* New demo projects
+* PHP4Applications revisited
+
+6.1
+
+* Compatible with PHP 5.0.4
+* Compatible with PHP 5.1.0b3
+* Compatible with Delphi 2005
+
+6.0
+
+* Translated Zend II API
+* New PHP Object Model support
+* PHP classes support for PHP4 and PHP5
+* New demo projects
+* TPHPClass component compatible with PHP4 and PHP5
+* Added new property DLLFolder to psvPHP component
+* New component PHPSystemLibrary
+
+5.5 fix 1
+
+* New property RegisterGlobals (boolean) added to psvPHP component
+* New property MaxExecutionTime (integer) added to psvPHP component - Maximum execution time of each script, in seconds
+* New property MaxInputTime (integer) added to psvPHP component - Maximum amount of time each script may spend parsing request data
+* New property SafeMode (boolean) added to psvPHP component
+* New property SafeModeGid (boolean) added to psvPHP component -  When safe_mode is on, UID/GID checks are bypassed when
+  including files from this directory and its subdirectories. (directory must also be in include_path or full path must
+  be used when including)
+* Memory leak fixed in phpModules unit
+* php_class demo project errors fixed
+* psvPHP can load now PHP modules using dl() function
+
+5.5
+
+* New component TPHPClass added (only for PHP 4)
+* Added support of PHP 5
+* Improved speed of unloading of the PHP extensions under Apache 
+* Decreased size of the compiled modules (based on API only and developed using Visual FrameWork)
+* ZendAPI unit is splitted to ZendAPI and ZendTypes units
+* PHPAPI unit is splitted to  PHPAPI and PHPTypes units
+* New version of php4App - php4Applications subproject. 
+  php4Applications allows to use php scripts in VB, C, C++, etc applications.
+  Demo projects for Delphi, VC and MS Word included.
+* New property UseDelimiters added to TpsvPHP component. If UseDelimiters = true (by default) the
+  syntax of RunCode method parameter ACode should include standard script delimiters "<?" and "?>"
+  to make RunCode and Execute method compatible.
+* New parameters for OnScriptError event (error type, file name and line number)
+
+5.4
+
+* Minor bugs fixed
+* Documentation improved 
+* New property IniPath (folder where php.ini located) added to TpsvPHP component
+* New functions translated in ZendAPI unit
+
+5.3
+* Added new public property ExecuteMethod to psvPHP component. 
+  if ExecuteMethod is emGet, psvPHP receives variables as $_GET["variable"],
+  if ExecuteMethod is emServer (default), psvPHP receives variables as $variable.
+  Can be used to debug real PHP scripts with GET parameters.
+* Added possibility to access published property of Delphi components from PHP
+* Fixed problem with loading of PHP extension compiled wihout PHP4DELPHI_AUTOLOAD
+  option.
+
+5.2
+* Added dynamic attachement of all exported functions from php4ts.dll
+  in PHPAPI.pas
+* New function for safe dynamic functions linking PHPStubInit and ZendStubInit
+  This functions can be used if you are planning to work with beta-version of PHP,
+  for example
+* New unit zend_dynamic_array.pas
+* New unit logos.pas
+
+5.0.3
+* Fixed bug when php function without parameters does not return value.
+* New classes: TZendVariable and TZendValue in  phpFunctions.pas
+* New subproject: php4App
+  Using php4App you can integrate PHP not only with Delphi, but with VB, for example
+
+5.0.2 
+* Fixed problem with assembler code in ZENDAPI.pas for Delphi 7
+
+5.0.1
+* Fixed problem with number of parameters of zend_getparameters_ex function
+
+5.0
+* First version written in Delphi
+
+
+1.0 - 4.0  
+* php4Delphi was written in C as a DLL with simple Delphi wrapper
+ 
+# Prerequisites
+Before using php4Delphi library:
+
+If you have no PHP installed, you have to download and 
+install PHP separately. It is not included in the package.
+You can download the latest version of PHP from
+http://www.php.net/downloads.php
+
+ZEND API documentation available at http://www.zend.com
+PHP  API documentation available at http://www.php.net
+
+You need to ensure that the dlls which php uses can be found. 
+php4ts.dll is always used. If you are using any php extension dlls then you
+will need those as well. 
+To make sure that the dlls can be found, you can either copy them to the 
+system directory (e.g. winnt/system32 or  windows/system).
+
+Copy the file, php.ini-dist to your %WINDOWS% directory on
+Windows 95/98 or to your %SYSTEMROOT% directory under Windows NT,
+Windows 2000 or Windows XP and rename it to php.ini. Your %WINDOWS% or
+%SYSTEMROOT% directory is typically:
+c:\windows for Windows 95/98
+c:\winnt or c:\winnt40 for NT/2000/XP servers
+
+# Building
+Uninstall previous installed version of php4Delphi Library from Delphi IDE.
+Remove previously compiled php4Delphi packages from your hard disk.
+
+Select PHP version you are going to use. php4Delphi supports PHP 5.x, 
+but not at the same time. You have to compile php4Delphi for selected target version of PHP.
+
+Open PHP.INC file.
+If you are using PHP5:
+a) Uncomment (remove dot) from definition of suitable php, VC and widgetset version
+b) Uncomment (remove dot) from definition of prefered features in the feature block of the PHP.INC file
+c) Save PHP.INC file
+
+Use "File\Open..." menu item of Delphi IDE to open php4Delphi runtime
+choose suitable Runtime package php4DelphiR(Your Delphi Version).dpk; In "Package..." window click "Compile" button to
+compile packages. 
+Put compiled BPL file into directory that is accessible through the search PATH (i.e. DOS
+"PATH" environment variable; 
+for example, in the Windows\System directory).
+
+After compiling php4Delphi run-time package you must install design-time
+package into the IDE.
+
+Use "File\Open..." menu item to open design-time package php4DelphiD(Your Delphi Version).dpk
+In "Package..." window click "Compile" button to compile the package
+and then click "Install" button to register php4Delphi Library 
+components on the component palette. 
+
+# Credits
+
+Since this is a freeware you are strongly encouraged to look 
+at the source code and improve on the components if you want to. 
+Of course I would appreciate it if you would send me back the 
+changes and bug fixes you have made. 
+
+For more information on the PHP Group and the PHP project,
+please see <http://www.php.net>.
+
+
+PHP4Delphi forum
+http://sourceforge.net/forum/forum.php?forum_id=324242
+
+Authors:                                              
+Serhiy Perevoznyk                                     
+Belgium
+serge_perevoznyk@hotmail.com
+http://users.telenet.be/ws36637
+http://delphi32.blogspot.com
+
+Lew Zienin
+Poland
+levzenin@pm.me
+
+Nikita Ganzikov
+Ukraine
+pig-l@mail.ru
+

From d2be1db4239bba4b4aafe771d8a95d8ea63209cf Mon Sep 17 00:00:00 2001
From: lion <levzenin@pm.me>
Date: Sun, 19 Jul 2020 00:46:46 +0300
Subject: [PATCH 31/35] added: Delphi 10.3 Rio support

---
 Source/ConverterBackup/php4DelphiR2010.dproj  |  122 ++
 .../php4DelphiR2010.dproj.2007                |  120 ++
 Source/DelphiFunctions.pas                    |    1 +
 .../php4Applications/Delphi/Project1.dpr      |    4 +-
 .../php4Applications/Delphi/Unit1.pas         |    3 +-
 Source/Demos/psvPHP/console/phpcon.dpr        |   13 +-
 Source/Demos/psvPHP/console/phpcon.dproj      | 1085 ++++++++---------
 Source/Demos/psvPHP/console/test.php          |   11 +-
 Source/PHP.INC                                |    8 +-
 Source/PHPAPI.pas                             |    8 +-
 Source/PHPTypes.pas                           |    2 +
 Source/ZENDAPI.pas                            |   32 +-
 Source/ZendTypes.pas                          |   64 +-
 .../php4delphi Delphi 10.3 Rio.groupproj      |   48 +
 Source/php4App.dll                            |  Bin 2192384 -> 0 bytes
 Source/php4AppIntf.pas                        |  Bin 1952 -> 3988 bytes
 Source/php4DelphiDRio.dpk                     |   48 +
 Source/php4DelphiDRio.dproj                   |  799 ++++++++++++
 Source/php4DelphiRRio.dpk                     |   50 +
 Source/php4DelphiRRio.dproj                   |  806 ++++++++++++
 Source/php4delphi.pas                         |   13 +-
 Source/phpModules.pas                         |   48 +-
 22 files changed, 2640 insertions(+), 645 deletions(-)
 create mode 100644 Source/ConverterBackup/php4DelphiR2010.dproj
 create mode 100644 Source/ConverterBackup/php4DelphiR2010.dproj.2007
 create mode 100644 Source/packages/php4delphi Delphi 10.3 Rio.groupproj
 delete mode 100644 Source/php4App.dll
 create mode 100644 Source/php4DelphiDRio.dpk
 create mode 100644 Source/php4DelphiDRio.dproj
 create mode 100644 Source/php4DelphiRRio.dpk
 create mode 100644 Source/php4DelphiRRio.dproj

diff --git a/Source/ConverterBackup/php4DelphiR2010.dproj b/Source/ConverterBackup/php4DelphiR2010.dproj
new file mode 100644
index 0000000..113eeaf
--- /dev/null
+++ b/Source/ConverterBackup/php4DelphiR2010.dproj
@@ -0,0 +1,122 @@
+﻿	<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+		<PropertyGroup>
+			<ProjectGuid>{DB360964-FCA5-4943-AD27-13C4B2BC0549}</ProjectGuid>
+			<MainSource>php4DelphiR2010.dpk</MainSource>
+			<Config Condition="'$(Config)'==''">Debug</Config>
+			<DCC_DCCCompiler>DCC32</DCC_DCCCompiler>
+			<ProjectVersion>12.0</ProjectVersion>
+		</PropertyGroup>
+		<PropertyGroup Condition="'$(Config)'=='Base' or '$(Base)'!=''">
+			<Base>true</Base>
+		</PropertyGroup>
+		<PropertyGroup Condition="'$(Config)'=='Release' or '$(Cfg_1)'!=''">
+			<Cfg_1>true</Cfg_1>
+			<CfgParent>Base</CfgParent>
+			<Base>true</Base>
+		</PropertyGroup>
+		<PropertyGroup Condition="'$(Config)'=='Debug' or '$(Cfg_2)'!=''">
+			<Cfg_2>true</Cfg_2>
+			<CfgParent>Base</CfgParent>
+			<Base>true</Base>
+		</PropertyGroup>
+		<PropertyGroup Condition="'$(Base)'!=''">
+			<DCC_DependencyCheckOutputName>..\..\..\..\..\..\Public\Documents\RAD Studio\6.0\Bpl\php4DelphiR2010.bpl</DCC_DependencyCheckOutputName>
+			<DCC_ImageBase>00400000</DCC_ImageBase>
+			<GenPackage>true</GenPackage>
+			<DCC_Platform>x86</DCC_Platform>
+			<DCC_Description>php4Delphi (run-rime)</DCC_Description>
+			<RuntimeOnlyPackage>true</RuntimeOnlyPackage>
+			<DCC_E>false</DCC_E>
+			<DCC_S>false</DCC_S>
+			<DCC_OutputNeverBuildDcps>true</DCC_OutputNeverBuildDcps>
+			<GenDll>true</GenDll>
+			<DCC_F>false</DCC_F>
+			<DCC_K>false</DCC_K>
+			<DCC_N>false</DCC_N>
+		</PropertyGroup>
+		<PropertyGroup Condition="'$(Cfg_1)'!=''">
+			<DCC_LocalDebugSymbols>false</DCC_LocalDebugSymbols>
+			<DCC_Define>RELEASE;$(DCC_Define)</DCC_Define>
+			<DCC_SymbolReferenceInfo>0</DCC_SymbolReferenceInfo>
+			<DCC_DebugInformation>false</DCC_DebugInformation>
+		</PropertyGroup>
+		<PropertyGroup Condition="'$(Cfg_2)'!=''">
+			<DCC_Define>DEBUG;$(DCC_Define)</DCC_Define>
+		</PropertyGroup>
+		<ItemGroup>
+			<DelphiCompile Include="php4DelphiR2010.dpk">
+				<MainSource>MainSource</MainSource>
+			</DelphiCompile>
+			<DCCReference Include="php4delphi.dcr"/>
+			<DCCReference Include="rtl.dcp"/>
+			<DCCReference Include="vcl.dcp"/>
+			<DCCReference Include="ZENDAPI.pas"/>
+			<DCCReference Include="DelphiFunctions.pas"/>
+			<DCCReference Include="php4delphi.pas"/>
+			<DCCReference Include="PHPAPI.pas"/>
+			<DCCReference Include="phpModules.pas"/>
+			<DCCReference Include="PHPLibrary.pas"/>
+			<DCCReference Include="PHPFunctions.pas"/>
+			<DCCReference Include="PHPTypes.pas"/>
+			<DCCReference Include="ZENDTypes.pas"/>
+			<DCCReference Include="phpClass.pas"/>
+			<DCCReference Include="PHPCommon.pas"/>
+			<DCCReference Include="php4delphi.dcr"/>
+			<BuildConfiguration Include="Base">
+				<Key>Base</Key>
+			</BuildConfiguration>
+			<BuildConfiguration Include="Debug">
+				<Key>Cfg_2</Key>
+				<CfgParent>Base</CfgParent>
+			</BuildConfiguration>
+			<BuildConfiguration Include="Release">
+				<Key>Cfg_1</Key>
+				<CfgParent>Base</CfgParent>
+			</BuildConfiguration>
+		</ItemGroup>
+		<Import Project="$(BDS)\Bin\CodeGear.Delphi.Targets" Condition="Exists('$(BDS)\Bin\CodeGear.Delphi.Targets')"/>
+		<ProjectExtensions>
+			<Borland.Personality>Delphi.Personality.12</Borland.Personality>
+			<Borland.ProjectType>Package</Borland.ProjectType>
+			<BorlandProject>
+				<Delphi.Personality>
+					<Source>
+						<Source Name="MainSource">php4DelphiR2010.dpk</Source>
+					</Source>
+					<Parameters>
+						<Parameters Name="UseLauncher">False</Parameters>
+						<Parameters Name="LoadAllSymbols">True</Parameters>
+						<Parameters Name="LoadUnspecifiedSymbols">False</Parameters>
+					</Parameters>
+					<VersionInfo>
+						<VersionInfo Name="IncludeVerInfo">False</VersionInfo>
+						<VersionInfo Name="AutoIncBuild">False</VersionInfo>
+						<VersionInfo Name="MajorVer">1</VersionInfo>
+						<VersionInfo Name="MinorVer">0</VersionInfo>
+						<VersionInfo Name="Release">0</VersionInfo>
+						<VersionInfo Name="Build">0</VersionInfo>
+						<VersionInfo Name="Debug">False</VersionInfo>
+						<VersionInfo Name="PreRelease">False</VersionInfo>
+						<VersionInfo Name="Special">False</VersionInfo>
+						<VersionInfo Name="Private">False</VersionInfo>
+						<VersionInfo Name="DLL">False</VersionInfo>
+						<VersionInfo Name="Locale">1058</VersionInfo>
+						<VersionInfo Name="CodePage">1251</VersionInfo>
+					</VersionInfo>
+					<VersionInfoKeys>
+						<VersionInfoKeys Name="CompanyName"/>
+						<VersionInfoKeys Name="FileDescription"/>
+						<VersionInfoKeys Name="FileVersion">1.0.0.0</VersionInfoKeys>
+						<VersionInfoKeys Name="InternalName"/>
+						<VersionInfoKeys Name="LegalCopyright"/>
+						<VersionInfoKeys Name="LegalTrademarks"/>
+						<VersionInfoKeys Name="OriginalFilename"/>
+						<VersionInfoKeys Name="ProductName"/>
+						<VersionInfoKeys Name="ProductVersion">1.0.0.0</VersionInfoKeys>
+						<VersionInfoKeys Name="Comments"/>
+					</VersionInfoKeys>
+				</Delphi.Personality>
+			</BorlandProject>
+			<ProjectFileVersion>12</ProjectFileVersion>
+		</ProjectExtensions>
+	</Project>
diff --git a/Source/ConverterBackup/php4DelphiR2010.dproj.2007 b/Source/ConverterBackup/php4DelphiR2010.dproj.2007
new file mode 100644
index 0000000..3d746af
--- /dev/null
+++ b/Source/ConverterBackup/php4DelphiR2010.dproj.2007
@@ -0,0 +1,120 @@
+﻿	<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+		<PropertyGroup>
+			<ProjectGuid>{DB360964-FCA5-4943-AD27-13C4B2BC0549}</ProjectGuid>
+			<MainSource>php4DelphiR2010.dpk</MainSource>
+			<Config Condition="'$(Config)'==''">Debug</Config>
+			<DCC_DCCCompiler>DCC32</DCC_DCCCompiler>
+		</PropertyGroup>
+		<PropertyGroup Condition="'$(Config)'=='Base' or '$(Base)'!=''">
+			<Base>true</Base>
+		</PropertyGroup>
+		<PropertyGroup Condition="'$(Config)'=='Release' or '$(Cfg_1)'!=''">
+			<Cfg_1>true</Cfg_1>
+			<CfgParent>Base</CfgParent>
+			<Base>true</Base>
+		</PropertyGroup>
+		<PropertyGroup Condition="'$(Config)'=='Debug' or '$(Cfg_2)'!=''">
+			<Cfg_2>true</Cfg_2>
+			<CfgParent>Base</CfgParent>
+			<Base>true</Base>
+		</PropertyGroup>
+		<PropertyGroup Condition="'$(Base)'!=''">
+			<DCC_DependencyCheckOutputName>..\..\..\..\..\..\Public\Documents\RAD Studio\6.0\Bpl\php4DelphiR2010.bpl</DCC_DependencyCheckOutputName>
+			<DCC_ImageBase>00400000</DCC_ImageBase>
+			<GenPackage>true</GenPackage>
+			<DCC_Platform>x86</DCC_Platform>
+			<DCC_Description>php4Delphi (run-rime)</DCC_Description>
+			<RuntimeOnlyPackage>true</RuntimeOnlyPackage>
+			<DCC_E>false</DCC_E>
+			<DCC_S>false</DCC_S>
+			<DCC_OutputNeverBuildDcps>true</DCC_OutputNeverBuildDcps>
+			<GenDll>true</GenDll>
+			<DCC_F>false</DCC_F>
+			<DCC_K>false</DCC_K>
+			<DCC_N>false</DCC_N>
+		</PropertyGroup>
+		<PropertyGroup Condition="'$(Cfg_1)'!=''">
+			<DCC_LocalDebugSymbols>false</DCC_LocalDebugSymbols>
+			<DCC_Define>RELEASE;$(DCC_Define)</DCC_Define>
+			<DCC_SymbolReferenceInfo>0</DCC_SymbolReferenceInfo>
+			<DCC_DebugInformation>false</DCC_DebugInformation>
+		</PropertyGroup>
+		<PropertyGroup Condition="'$(Cfg_2)'!=''">
+			<DCC_Define>DEBUG;$(DCC_Define)</DCC_Define>
+		</PropertyGroup>
+		<ItemGroup>
+			<DelphiCompile Include="php4DelphiR2010.dpk">
+				<MainSource>MainSource</MainSource>
+			</DelphiCompile>
+			<DCCReference Include="php4delphi.dcr"/>
+			<DCCReference Include="rtl.dcp"/>
+			<DCCReference Include="vcl.dcp"/>
+			<DCCReference Include="ZENDAPI.pas"/>
+			<DCCReference Include="DelphiFunctions.pas"/>
+			<DCCReference Include="php4delphi.pas"/>
+			<DCCReference Include="PHPAPI.pas"/>
+			<DCCReference Include="phpModules.pas"/>
+			<DCCReference Include="PHPLibrary.pas"/>
+			<DCCReference Include="PHPFunctions.pas"/>
+			<DCCReference Include="PHPTypes.pas"/>
+			<DCCReference Include="ZENDTypes.pas"/>
+			<DCCReference Include="phpClass.pas"/>
+			<DCCReference Include="PHPCommon.pas"/>
+			<BuildConfiguration Include="Base">
+				<Key>Base</Key>
+			</BuildConfiguration>
+			<BuildConfiguration Include="Debug">
+				<Key>Cfg_2</Key>
+				<CfgParent>Base</CfgParent>
+			</BuildConfiguration>
+			<BuildConfiguration Include="Release">
+				<Key>Cfg_1</Key>
+				<CfgParent>Base</CfgParent>
+			</BuildConfiguration>
+		</ItemGroup>
+		<Import Project="$(BDS)\Bin\CodeGear.Delphi.Targets" Condition="Exists('$(BDS)\Bin\CodeGear.Delphi.Targets')"/>
+		<ProjectExtensions>
+			<Borland.Personality>Delphi.Personality.12</Borland.Personality>
+			<Borland.ProjectType>Package</Borland.ProjectType>
+			<BorlandProject>
+				<Delphi.Personality>
+					<Source>
+						<Source Name="MainSource">php4DelphiR2010.dpk</Source>
+					</Source>
+					<Parameters>
+						<Parameters Name="UseLauncher">False</Parameters>
+						<Parameters Name="LoadAllSymbols">True</Parameters>
+						<Parameters Name="LoadUnspecifiedSymbols">False</Parameters>
+					</Parameters>
+					<VersionInfo>
+						<VersionInfo Name="IncludeVerInfo">False</VersionInfo>
+						<VersionInfo Name="AutoIncBuild">False</VersionInfo>
+						<VersionInfo Name="MajorVer">1</VersionInfo>
+						<VersionInfo Name="MinorVer">0</VersionInfo>
+						<VersionInfo Name="Release">0</VersionInfo>
+						<VersionInfo Name="Build">0</VersionInfo>
+						<VersionInfo Name="Debug">False</VersionInfo>
+						<VersionInfo Name="PreRelease">False</VersionInfo>
+						<VersionInfo Name="Special">False</VersionInfo>
+						<VersionInfo Name="Private">False</VersionInfo>
+						<VersionInfo Name="DLL">False</VersionInfo>
+						<VersionInfo Name="Locale">1058</VersionInfo>
+						<VersionInfo Name="CodePage">1251</VersionInfo>
+					</VersionInfo>
+					<VersionInfoKeys>
+						<VersionInfoKeys Name="CompanyName"/>
+						<VersionInfoKeys Name="FileDescription"/>
+						<VersionInfoKeys Name="FileVersion">1.0.0.0</VersionInfoKeys>
+						<VersionInfoKeys Name="InternalName"/>
+						<VersionInfoKeys Name="LegalCopyright"/>
+						<VersionInfoKeys Name="LegalTrademarks"/>
+						<VersionInfoKeys Name="OriginalFilename"/>
+						<VersionInfoKeys Name="ProductName"/>
+						<VersionInfoKeys Name="ProductVersion">1.0.0.0</VersionInfoKeys>
+						<VersionInfoKeys Name="Comments"/>
+					</VersionInfoKeys>
+				</Delphi.Personality>
+			</BorlandProject>
+			<ProjectFileVersion>12</ProjectFileVersion>
+		</ProjectExtensions>
+	</Project>
diff --git a/Source/DelphiFunctions.pas b/Source/DelphiFunctions.pas
index 11163b2..23892b4 100644
--- a/Source/DelphiFunctions.pas
+++ b/Source/DelphiFunctions.pas
@@ -16,6 +16,7 @@
 
 interface
 uses
+  Dialogs,
   SysUtils, Classes,
   ZendTypes, ZendAPI, PHPTypes, PHPAPI, typinfo;
 
diff --git a/Source/Demos Delphi 2009 (WideString support)/php4Applications/Delphi/Project1.dpr b/Source/Demos Delphi 2009 (WideString support)/php4Applications/Delphi/Project1.dpr
index dfa3f13..0114347 100644
--- a/Source/Demos Delphi 2009 (WideString support)/php4Applications/Delphi/Project1.dpr	
+++ b/Source/Demos Delphi 2009 (WideString support)/php4Applications/Delphi/Project1.dpr	
@@ -2,7 +2,9 @@ program Project1;
 
 uses
   Forms,
-  Unit1 in 'Unit1.pas' {Form1};
+  Unit1 in 'Unit1.pas' {Form1},
+  php4AppIntf in '..\..\..\php4AppIntf.pas',
+  ZendTypes in '..\..\..\ZendTypes.pas';
 
 {$R *.RES}
 
diff --git a/Source/Demos Delphi 2009 (WideString support)/php4Applications/Delphi/Unit1.pas b/Source/Demos Delphi 2009 (WideString support)/php4Applications/Delphi/Unit1.pas
index 10d384c..b5d3415 100644
--- a/Source/Demos Delphi 2009 (WideString support)/php4Applications/Delphi/Unit1.pas	
+++ b/Source/Demos Delphi 2009 (WideString support)/php4Applications/Delphi/Unit1.pas	
@@ -15,7 +15,8 @@ interface
 
 uses
   Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
-  StdCtrls, PHP4AppIntf;
+  StdCtrls,
+  php4AppIntf;
 
 type
   TForm1 = class(TForm)
diff --git a/Source/Demos/psvPHP/console/phpcon.dpr b/Source/Demos/psvPHP/console/phpcon.dpr
index dd42a80..59005ac 100644
--- a/Source/Demos/psvPHP/console/phpcon.dpr
+++ b/Source/Demos/psvPHP/console/phpcon.dpr
@@ -15,7 +15,7 @@ program phpcon;
 
 uses
   SysUtils,
-  VCL.Dialogs,
+  Dialogs,
   php4delphi,
   zendAPI,
   ZENDTypes;
@@ -23,6 +23,7 @@ uses
 var
  php    : TpsvPHP;
  Engine : TPHPEngine;
+ ft     : Byte = 0;
 
 procedure gui_message(ht: integer; return_value: pzval;
   return_value_ptr: pzval; this_ptr: pzval; return_value_used: integer;
@@ -55,9 +56,13 @@ begin
  php := TpsvPHP.Create(nil);
  if ParamCount = 1 then
  begin
-  php.FileName := zend_ustr(ParamStr(1));
-  write(php.Execute);
- end
+ php.FileName := zend_ustr(ParamStr(1));
+  if FileExists(ParamStr(1)) then
+    ft := 1;
+ end;
+
+ if ft = 1 then
+  write(php.Execute)
  else
  begin
   writeLn(Format('Usage: %s <filename.php>', [ParamStr(0)]));
diff --git a/Source/Demos/psvPHP/console/phpcon.dproj b/Source/Demos/psvPHP/console/phpcon.dproj
index caf51d6..3847e22 100644
--- a/Source/Demos/psvPHP/console/phpcon.dproj
+++ b/Source/Demos/psvPHP/console/phpcon.dproj
@@ -1,574 +1,511 @@
-﻿<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-    <PropertyGroup>
-        <ProjectGuid>{BDB76098-EDD6-4A5A-AF30-D7A6B0BCF914}</ProjectGuid>
-        <MainSource>phpcon.dpr</MainSource>
-        <Base>True</Base>
-        <Config Condition="'$(Config)'==''">Debug</Config>
-        <TargetedPlatforms>3</TargetedPlatforms>
-        <AppType>Console</AppType>
-        <FrameworkType>None</FrameworkType>
-        <ProjectVersion>18.2</ProjectVersion>
-        <Platform Condition="'$(Platform)'==''">Win32</Platform>
-    </PropertyGroup>
-    <PropertyGroup Condition="'$(Config)'=='Base' or '$(Base)'!=''">
-        <Base>true</Base>
-    </PropertyGroup>
-    <PropertyGroup Condition="('$(Platform)'=='Android' and '$(Base)'=='true') or '$(Base_Android)'!=''">
-        <Base_Android>true</Base_Android>
-        <CfgParent>Base</CfgParent>
-        <Base>true</Base>
-    </PropertyGroup>
-    <PropertyGroup Condition="('$(Platform)'=='Win32' and '$(Base)'=='true') or '$(Base_Win32)'!=''">
-        <Base_Win32>true</Base_Win32>
-        <CfgParent>Base</CfgParent>
-        <Base>true</Base>
-    </PropertyGroup>
-    <PropertyGroup Condition="('$(Platform)'=='Win64' and '$(Base)'=='true') or '$(Base_Win64)'!=''">
-        <Base_Win64>true</Base_Win64>
-        <CfgParent>Base</CfgParent>
-        <Base>true</Base>
-    </PropertyGroup>
-    <PropertyGroup Condition="'$(Config)'=='Release' or '$(Cfg_1)'!=''">
-        <Cfg_1>true</Cfg_1>
-        <CfgParent>Base</CfgParent>
-        <Base>true</Base>
-    </PropertyGroup>
-    <PropertyGroup Condition="('$(Platform)'=='Win32' and '$(Cfg_1)'=='true') or '$(Cfg_1_Win32)'!=''">
-        <Cfg_1_Win32>true</Cfg_1_Win32>
-        <CfgParent>Cfg_1</CfgParent>
-        <Cfg_1>true</Cfg_1>
-        <Base>true</Base>
-    </PropertyGroup>
-    <PropertyGroup Condition="('$(Platform)'=='Win64' and '$(Cfg_1)'=='true') or '$(Cfg_1_Win64)'!=''">
-        <Cfg_1_Win64>true</Cfg_1_Win64>
-        <CfgParent>Cfg_1</CfgParent>
-        <Cfg_1>true</Cfg_1>
-        <Base>true</Base>
-    </PropertyGroup>
-    <PropertyGroup Condition="'$(Config)'=='Debug' or '$(Cfg_2)'!=''">
-        <Cfg_2>true</Cfg_2>
-        <CfgParent>Base</CfgParent>
-        <Base>true</Base>
-    </PropertyGroup>
-    <PropertyGroup Condition="('$(Platform)'=='Win32' and '$(Cfg_2)'=='true') or '$(Cfg_2_Win32)'!=''">
-        <Cfg_2_Win32>true</Cfg_2_Win32>
-        <CfgParent>Cfg_2</CfgParent>
-        <Cfg_2>true</Cfg_2>
-        <Base>true</Base>
-    </PropertyGroup>
-    <PropertyGroup Condition="('$(Platform)'=='Win64' and '$(Cfg_2)'=='true') or '$(Cfg_2_Win64)'!=''">
-        <Cfg_2_Win64>true</Cfg_2_Win64>
-        <CfgParent>Cfg_2</CfgParent>
-        <Cfg_2>true</Cfg_2>
-        <Base>true</Base>
-    </PropertyGroup>
-    <PropertyGroup Condition="'$(Base)'!=''">
-        <DCC_UnitSearchPath>..\..\..\;$(DCC_UnitSearchPath)</DCC_UnitSearchPath>
-        <DCC_ExeOutput>C:\elsewere</DCC_ExeOutput>
-        <DCC_F>false</DCC_F>
-        <VerInfo_Locale>1058</VerInfo_Locale>
-        <DCC_E>false</DCC_E>
-        <DCC_ImageBase>00400000</DCC_ImageBase>
-        <DCC_Namespace>System;Xml;Data;Datasnap;Web;Soap;$(DCC_Namespace)</DCC_Namespace>
-        <Icon_MainIcon>$(BDS)\bin\delphi_PROJECTICON.ico</Icon_MainIcon>
-        <SanitizedProjectName>phpcon</SanitizedProjectName>
-        <VerInfo_Keys>CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments=;CFBundleName=</VerInfo_Keys>
-        <DCC_S>false</DCC_S>
-        <DCC_N>false</DCC_N>
-        <DCC_K>false</DCC_K>
-        <Icns_MainIcns>$(BDS)\bin\delphi_PROJECTICNS.icns</Icns_MainIcns>
-    </PropertyGroup>
-    <PropertyGroup Condition="'$(Base_Android)'!=''">
-        <EnabledSysJars>android-support-v4.dex.jar;cloud-messaging.dex.jar;fmx.dex.jar;google-analytics-v2.dex.jar;google-play-billing.dex.jar;google-play-licensing.dex.jar;google-play-services.dex.jar</EnabledSysJars>
-        <AUP_READ_CALENDAR>true</AUP_READ_CALENDAR>
-        <Android_SplashImage426>$(BDS)\bin\Artwork\Android\FM_SplashImage_426x320.png</Android_SplashImage426>
-        <AUP_READ_EXTERNAL_STORAGE>true</AUP_READ_EXTERNAL_STORAGE>
-        <Android_SplashImage470>$(BDS)\bin\Artwork\Android\FM_SplashImage_470x320.png</Android_SplashImage470>
-        <AUP_CAMERA>true</AUP_CAMERA>
-        <Android_LauncherIcon96>$(BDS)\bin\Artwork\Android\FM_LauncherIcon_96x96.png</Android_LauncherIcon96>
-        <Android_LauncherIcon36>$(BDS)\bin\Artwork\Android\FM_LauncherIcon_36x36.png</Android_LauncherIcon36>
-        <AUP_ACCESS_FINE_LOCATION>true</AUP_ACCESS_FINE_LOCATION>
-        <AUP_ACCESS_COARSE_LOCATION>true</AUP_ACCESS_COARSE_LOCATION>
-        <Android_LauncherIcon72>$(BDS)\bin\Artwork\Android\FM_LauncherIcon_72x72.png</Android_LauncherIcon72>
-        <AUP_CALL_PHONE>true</AUP_CALL_PHONE>
-        <AUP_INTERNET>true</AUP_INTERNET>
-        <VerInfo_Keys>package=com.embarcadero.$(MSBuildProjectName);label=$(MSBuildProjectName);versionCode=1;versionName=1.0.0;persistent=False;restoreAnyVersion=False;installLocation=auto;largeHeap=False;theme=TitleBar;hardwareAccelerated=true;apiKey=</VerInfo_Keys>
-        <BT_BuildType>Debug</BT_BuildType>
-        <AUP_READ_PHONE_STATE>true</AUP_READ_PHONE_STATE>
-        <AUP_WRITE_EXTERNAL_STORAGE>true</AUP_WRITE_EXTERNAL_STORAGE>
-        <Android_SplashImage640>$(BDS)\bin\Artwork\Android\FM_SplashImage_640x480.png</Android_SplashImage640>
-        <Android_SplashImage960>$(BDS)\bin\Artwork\Android\FM_SplashImage_960x720.png</Android_SplashImage960>
-        <Android_LauncherIcon48>$(BDS)\bin\Artwork\Android\FM_LauncherIcon_48x48.png</Android_LauncherIcon48>
-        <Android_LauncherIcon144>$(BDS)\bin\Artwork\Android\FM_LauncherIcon_144x144.png</Android_LauncherIcon144>
-        <AUP_WRITE_CALENDAR>true</AUP_WRITE_CALENDAR>
-    </PropertyGroup>
-    <PropertyGroup Condition="'$(Base_Win32)'!=''">
-        <DCC_ExeOutput>C:\elsewere\x32</DCC_ExeOutput>
-        <Manifest_File>(None)</Manifest_File>
-        <VerInfo_Locale>1033</VerInfo_Locale>
-        <DCC_Namespace>Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace)</DCC_Namespace>
-        <BT_BuildType>Debug</BT_BuildType>
-        <VerInfo_Keys>CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments=;ProgramID=com.embarcadero.$(MSBuildProjectName)</VerInfo_Keys>
-    </PropertyGroup>
-    <PropertyGroup Condition="'$(Base_Win64)'!=''">
-        <VerInfo_Locale>1033</VerInfo_Locale>
-        <DCC_ExeOutput>C:\elsewere\x64</DCC_ExeOutput>
-        <DCC_Namespace>Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;$(DCC_Namespace)</DCC_Namespace>
-        <Manifest_File>(None)</Manifest_File>
-        <BT_BuildType>Debug</BT_BuildType>
-        <VerInfo_Keys>CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments=</VerInfo_Keys>
-    </PropertyGroup>
-    <PropertyGroup Condition="'$(Cfg_1)'!=''">
-        <DCC_DebugInformation>0</DCC_DebugInformation>
-        <DCC_LocalDebugSymbols>false</DCC_LocalDebugSymbols>
-        <DCC_SymbolReferenceInfo>0</DCC_SymbolReferenceInfo>
-        <DCC_Define>RELEASE;$(DCC_Define)</DCC_Define>
-    </PropertyGroup>
-    <PropertyGroup Condition="'$(Cfg_1_Win32)'!=''">
-        <VerInfo_Locale>1033</VerInfo_Locale>
-        <VerInfo_Keys>CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments=;ProgramID=com.embarcadero.$(MSBuildProjectName)</VerInfo_Keys>
-    </PropertyGroup>
-    <PropertyGroup Condition="'$(Cfg_1_Win64)'!=''">
-        <VerInfo_Locale>1033</VerInfo_Locale>
-        <VerInfo_Keys>CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments=</VerInfo_Keys>
-    </PropertyGroup>
-    <PropertyGroup Condition="'$(Cfg_2)'!=''">
-        <DCC_GenerateStackFrames>true</DCC_GenerateStackFrames>
-        <DCC_Define>DEBUG;$(DCC_Define)</DCC_Define>
-        <DCC_Optimize>false</DCC_Optimize>
-    </PropertyGroup>
-    <PropertyGroup Condition="'$(Cfg_2_Win32)'!=''">
-        <Debugger_RunParams>info.php</Debugger_RunParams>
-    </PropertyGroup>
-    <PropertyGroup Condition="'$(Cfg_2_Win64)'!=''">
-        <Debugger_RunParams>info.php</Debugger_RunParams>
-        <VerInfo_Locale>1033</VerInfo_Locale>
-        <VerInfo_Keys>CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments=</VerInfo_Keys>
-    </PropertyGroup>
-    <ItemGroup>
-        <DelphiCompile Include="$(MainSource)">
-            <MainSource>MainSource</MainSource>
-        </DelphiCompile>
-        <BuildConfiguration Include="Debug">
-            <Key>Cfg_2</Key>
-            <CfgParent>Base</CfgParent>
-        </BuildConfiguration>
-        <BuildConfiguration Include="Base">
-            <Key>Base</Key>
-        </BuildConfiguration>
-        <BuildConfiguration Include="Release">
-            <Key>Cfg_1</Key>
-            <CfgParent>Base</CfgParent>
-        </BuildConfiguration>
-    </ItemGroup>
-    <ProjectExtensions>
-        <Borland.Personality>Delphi.Personality.12</Borland.Personality>
-        <Borland.ProjectType/>
-        <BorlandProject>
-            <Delphi.Personality>
-                <Source>
-                    <Source Name="MainSource">phpcon.dpr</Source>
-                </Source>
-                <Excluded_Packages>
-                    <Excluded_Packages Name="$(BDSBIN)\bcboffice2k240.bpl">Embarcadero C++Builder Office 2000 Servers Package</Excluded_Packages>
-                    <Excluded_Packages Name="$(BDSBIN)\dcloffice2k240.bpl">Microsoft Office 2000 Sample Automation Server Wrapper Components</Excluded_Packages>
-                    <Excluded_Packages Name="$(BDSBIN)\dclofficexp240.bpl">Microsoft Office XP Sample Automation Server Wrapper Components</Excluded_Packages>
-                </Excluded_Packages>
-            </Delphi.Personality>
-            <Platforms>
-                <Platform value="Android">False</Platform>
-                <Platform value="Win32">True</Platform>
-                <Platform value="Win64">True</Platform>
-            </Platforms>
-            <Deployment Version="3">
-                <DeployFile LocalName="$(BDS)\Redist\osx32\libcgunwind.1.0.dylib" Class="DependencyModule">
-                    <Platform Name="OSX32">
-                        <Overwrite>true</Overwrite>
-                    </Platform>
-                </DeployFile>
-                <DeployFile LocalName="$(BDS)\Redist\iossimulator\libcgunwind.1.0.dylib" Class="DependencyModule">
-                    <Platform Name="iOSSimulator">
-                        <Overwrite>true</Overwrite>
-                    </Platform>
-                </DeployFile>
-                <DeployFile LocalName="$(BDS)\Redist\iossimulator\libPCRE.dylib" Class="DependencyModule">
-                    <Platform Name="iOSSimulator">
-                        <Overwrite>true</Overwrite>
-                    </Platform>
-                </DeployFile>
-                <DeployFile LocalName="$(BDS)\Redist\osx32\libcgsqlite3.dylib" Class="DependencyModule">
-                    <Platform Name="OSX32">
-                        <Overwrite>true</Overwrite>
-                    </Platform>
-                </DeployFile>
-                <DeployFile LocalName="C:\elsewere\x32\phpcon.exe" Configuration="Debug" Class="ProjectOutput">
-                    <Platform Name="Win32">
-                        <RemoteName>phpcon.exe</RemoteName>
-                        <Overwrite>true</Overwrite>
-                    </Platform>
-                </DeployFile>
-                <DeployClass Name="ProjectiOSDeviceResourceRules"/>
-                <DeployClass Name="ProjectOSXResource">
-                    <Platform Name="OSX32">
-                        <RemoteDir>Contents\Resources</RemoteDir>
-                        <Operation>1</Operation>
-                    </Platform>
-                </DeployClass>
-                <DeployClass Name="AndroidClassesDexFile">
-                    <Platform Name="Android">
-                        <RemoteDir>classes</RemoteDir>
-                        <Operation>1</Operation>
-                    </Platform>
-                </DeployClass>
-                <DeployClass Name="AdditionalDebugSymbols">
-                    <Platform Name="Win32">
-                        <RemoteDir>Contents\MacOS</RemoteDir>
-                        <Operation>0</Operation>
-                    </Platform>
-                    <Platform Name="OSX32">
-                        <Operation>1</Operation>
-                    </Platform>
-                </DeployClass>
-                <DeployClass Name="iPad_Launch768">
-                    <Platform Name="iOSSimulator">
-                        <Operation>1</Operation>
-                    </Platform>
-                    <Platform Name="iOSDevice64">
-                        <Operation>1</Operation>
-                    </Platform>
-                    <Platform Name="iOSDevice32">
-                        <Operation>1</Operation>
-                    </Platform>
-                </DeployClass>
-                <DeployClass Name="Android_LauncherIcon144">
-                    <Platform Name="Android">
-                        <RemoteDir>res\drawable-xxhdpi</RemoteDir>
-                        <Operation>1</Operation>
-                    </Platform>
-                </DeployClass>
-                <DeployClass Name="AndroidLibnativeMipsFile">
-                    <Platform Name="Android">
-                        <RemoteDir>library\lib\mips</RemoteDir>
-                        <Operation>1</Operation>
-                    </Platform>
-                </DeployClass>
-                <DeployClass Required="true" Name="ProjectOutput">
-                    <Platform Name="iOSDevice64">
-                        <Operation>1</Operation>
-                    </Platform>
-                    <Platform Name="iOSDevice32">
-                        <Operation>1</Operation>
-                    </Platform>
-                    <Platform Name="Win32">
-                        <Operation>0</Operation>
-                    </Platform>
-                    <Platform Name="Linux64">
-                        <Operation>1</Operation>
-                    </Platform>
-                    <Platform Name="OSX32">
-                        <Operation>1</Operation>
-                    </Platform>
-                    <Platform Name="Android">
-                        <RemoteDir>library\lib\armeabi-v7a</RemoteDir>
-                        <Operation>1</Operation>
-                    </Platform>
-                    <Platform Name="iOSSimulator">
-                        <Operation>1</Operation>
-                    </Platform>
-                </DeployClass>
-                <DeployClass Name="DependencyFramework">
-                    <Platform Name="Win32">
-                        <Operation>0</Operation>
-                    </Platform>
-                    <Platform Name="OSX32">
-                        <Operation>1</Operation>
-                        <Extensions>.framework</Extensions>
-                    </Platform>
-                </DeployClass>
-                <DeployClass Name="ProjectUWPManifest">
-                    <Platform Name="Win32">
-                        <Operation>1</Operation>
-                    </Platform>
-                    <Platform Name="Win64">
-                        <Operation>1</Operation>
-                    </Platform>
-                </DeployClass>
-                <DeployClass Name="iPhone_Launch640">
-                    <Platform Name="iOSSimulator">
-                        <Operation>1</Operation>
-                    </Platform>
-                    <Platform Name="iOSDevice64">
-                        <Operation>1</Operation>
-                    </Platform>
-                    <Platform Name="iOSDevice32">
-                        <Operation>1</Operation>
-                    </Platform>
-                </DeployClass>
-                <DeployClass Name="iPad_Launch1024">
-                    <Platform Name="iOSSimulator">
-                        <Operation>1</Operation>
-                    </Platform>
-                    <Platform Name="iOSDevice64">
-                        <Operation>1</Operation>
-                    </Platform>
-                    <Platform Name="iOSDevice32">
-                        <Operation>1</Operation>
-                    </Platform>
-                </DeployClass>
-                <DeployClass Name="ProjectiOSDeviceDebug">
-                    <Platform Name="iOSDevice64">
-                        <RemoteDir>..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF</RemoteDir>
-                        <Operation>1</Operation>
-                    </Platform>
-                    <Platform Name="iOSDevice32">
-                        <RemoteDir>..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF</RemoteDir>
-                        <Operation>1</Operation>
-                    </Platform>
-                </DeployClass>
-                <DeployClass Name="iPhone_Launch320">
-                    <Platform Name="iOSSimulator">
-                        <Operation>1</Operation>
-                    </Platform>
-                    <Platform Name="iOSDevice64">
-                        <Operation>1</Operation>
-                    </Platform>
-                    <Platform Name="iOSDevice32">
-                        <Operation>1</Operation>
-                    </Platform>
-                </DeployClass>
-                <DeployClass Name="ProjectiOSInfoPList"/>
-                <DeployClass Name="AndroidLibnativeArmeabiFile">
-                    <Platform Name="Android">
-                        <RemoteDir>library\lib\armeabi</RemoteDir>
-                        <Operation>1</Operation>
-                    </Platform>
-                </DeployClass>
-                <DeployClass Name="DebugSymbols">
-                    <Platform Name="Win32">
-                        <Operation>0</Operation>
-                    </Platform>
-                    <Platform Name="iOSSimulator">
-                        <Operation>1</Operation>
-                    </Platform>
-                    <Platform Name="OSX32">
-                        <Operation>1</Operation>
-                    </Platform>
-                </DeployClass>
-                <DeployClass Name="iPad_Launch1536">
-                    <Platform Name="iOSSimulator">
-                        <Operation>1</Operation>
-                    </Platform>
-                    <Platform Name="iOSDevice64">
-                        <Operation>1</Operation>
-                    </Platform>
-                    <Platform Name="iOSDevice32">
-                        <Operation>1</Operation>
-                    </Platform>
-                </DeployClass>
-                <DeployClass Name="Android_SplashImage470">
-                    <Platform Name="Android">
-                        <RemoteDir>res\drawable-normal</RemoteDir>
-                        <Operation>1</Operation>
-                    </Platform>
-                </DeployClass>
-                <DeployClass Name="Android_LauncherIcon96">
-                    <Platform Name="Android">
-                        <RemoteDir>res\drawable-xhdpi</RemoteDir>
-                        <Operation>1</Operation>
-                    </Platform>
-                </DeployClass>
-                <DeployClass Name="Android_SplashImage640">
-                    <Platform Name="Android">
-                        <RemoteDir>res\drawable-large</RemoteDir>
-                        <Operation>1</Operation>
-                    </Platform>
-                </DeployClass>
-                <DeployClass Name="iPhone_Launch640x1136">
-                    <Platform Name="iOSSimulator">
-                        <Operation>1</Operation>
-                    </Platform>
-                    <Platform Name="iOSDevice64">
-                        <Operation>1</Operation>
-                    </Platform>
-                    <Platform Name="iOSDevice32">
-                        <Operation>1</Operation>
-                    </Platform>
-                </DeployClass>
-                <DeployClass Name="UWP_DelphiLogo44">
-                    <Platform Name="Win32">
-                        <RemoteDir>Assets</RemoteDir>
-                        <Operation>1</Operation>
-                    </Platform>
-                    <Platform Name="Win64">
-                        <RemoteDir>Assets</RemoteDir>
-                        <Operation>1</Operation>
-                    </Platform>
-                </DeployClass>
-                <DeployClass Name="ProjectiOSEntitlements"/>
-                <DeployClass Name="Android_LauncherIcon72">
-                    <Platform Name="Android">
-                        <RemoteDir>res\drawable-hdpi</RemoteDir>
-                        <Operation>1</Operation>
-                    </Platform>
-                </DeployClass>
-                <DeployClass Name="AndroidGDBServer">
-                    <Platform Name="Android">
-                        <RemoteDir>library\lib\armeabi-v7a</RemoteDir>
-                        <Operation>1</Operation>
-                    </Platform>
-                </DeployClass>
-                <DeployClass Name="ProjectOSXInfoPList"/>
-                <DeployClass Name="ProjectOSXEntitlements"/>
-                <DeployClass Name="UWP_DelphiLogo150">
-                    <Platform Name="Win32">
-                        <RemoteDir>Assets</RemoteDir>
-                        <Operation>1</Operation>
-                    </Platform>
-                    <Platform Name="Win64">
-                        <RemoteDir>Assets</RemoteDir>
-                        <Operation>1</Operation>
-                    </Platform>
-                </DeployClass>
-                <DeployClass Name="iPad_Launch2048">
-                    <Platform Name="iOSSimulator">
-                        <Operation>1</Operation>
-                    </Platform>
-                    <Platform Name="iOSDevice64">
-                        <Operation>1</Operation>
-                    </Platform>
-                    <Platform Name="iOSDevice32">
-                        <Operation>1</Operation>
-                    </Platform>
-                </DeployClass>
-                <DeployClass Name="AndroidSplashStyles">
-                    <Platform Name="Android">
-                        <RemoteDir>res\values</RemoteDir>
-                        <Operation>1</Operation>
-                    </Platform>
-                </DeployClass>
-                <DeployClass Name="Android_SplashImage426">
-                    <Platform Name="Android">
-                        <RemoteDir>res\drawable-small</RemoteDir>
-                        <Operation>1</Operation>
-                    </Platform>
-                </DeployClass>
-                <DeployClass Name="AndroidSplashImageDef">
-                    <Platform Name="Android">
-                        <RemoteDir>res\drawable</RemoteDir>
-                        <Operation>1</Operation>
-                    </Platform>
-                </DeployClass>
-                <DeployClass Name="ProjectiOSResource">
-                    <Platform Name="iOSSimulator">
-                        <Operation>1</Operation>
-                    </Platform>
-                    <Platform Name="iOSDevice64">
-                        <Operation>1</Operation>
-                    </Platform>
-                    <Platform Name="iOSDevice32">
-                        <Operation>1</Operation>
-                    </Platform>
-                </DeployClass>
-                <DeployClass Name="ProjectAndroidManifest">
-                    <Platform Name="Android">
-                        <Operation>1</Operation>
-                    </Platform>
-                </DeployClass>
-                <DeployClass Name="Android_DefaultAppIcon">
-                    <Platform Name="Android">
-                        <RemoteDir>res\drawable</RemoteDir>
-                        <Operation>1</Operation>
-                    </Platform>
-                </DeployClass>
-                <DeployClass Name="File">
-                    <Platform Name="Win32">
-                        <Operation>0</Operation>
-                    </Platform>
-                    <Platform Name="iOSDevice64">
-                        <Operation>0</Operation>
-                    </Platform>
-                    <Platform Name="OSX32">
-                        <Operation>0</Operation>
-                    </Platform>
-                    <Platform Name="iOSDevice32">
-                        <Operation>0</Operation>
-                    </Platform>
-                    <Platform Name="Android">
-                        <Operation>0</Operation>
-                    </Platform>
-                    <Platform Name="iOSSimulator">
-                        <Operation>0</Operation>
-                    </Platform>
-                </DeployClass>
-                <DeployClass Name="AndroidServiceOutput">
-                    <Platform Name="Android">
-                        <RemoteDir>library\lib\armeabi-v7a</RemoteDir>
-                        <Operation>1</Operation>
-                    </Platform>
-                </DeployClass>
-                <DeployClass Required="true" Name="DependencyPackage">
-                    <Platform Name="Win32">
-                        <Operation>0</Operation>
-                        <Extensions>.bpl</Extensions>
-                    </Platform>
-                    <Platform Name="iOSDevice64">
-                        <Operation>1</Operation>
-                        <Extensions>.dylib</Extensions>
-                    </Platform>
-                    <Platform Name="OSX32">
-                        <Operation>1</Operation>
-                        <Extensions>.dylib</Extensions>
-                    </Platform>
-                    <Platform Name="iOSDevice32">
-                        <Operation>1</Operation>
-                        <Extensions>.dylib</Extensions>
-                    </Platform>
-                    <Platform Name="iOSSimulator">
-                        <Operation>1</Operation>
-                        <Extensions>.dylib</Extensions>
-                    </Platform>
-                </DeployClass>
-                <DeployClass Name="Android_LauncherIcon48">
-                    <Platform Name="Android">
-                        <RemoteDir>res\drawable-mdpi</RemoteDir>
-                        <Operation>1</Operation>
-                    </Platform>
-                </DeployClass>
-                <DeployClass Name="Android_SplashImage960">
-                    <Platform Name="Android">
-                        <RemoteDir>res\drawable-xlarge</RemoteDir>
-                        <Operation>1</Operation>
-                    </Platform>
-                </DeployClass>
-                <DeployClass Name="Android_LauncherIcon36">
-                    <Platform Name="Android">
-                        <RemoteDir>res\drawable-ldpi</RemoteDir>
-                        <Operation>1</Operation>
-                    </Platform>
-                </DeployClass>
-                <DeployClass Name="DependencyModule">
-                    <Platform Name="Win32">
-                        <Operation>0</Operation>
-                        <Extensions>.dll;.bpl</Extensions>
-                    </Platform>
-                    <Platform Name="OSX32">
-                        <Operation>1</Operation>
-                        <Extensions>.dylib</Extensions>
-                    </Platform>
-                </DeployClass>
-                <ProjectRoot Platform="iOSDevice64" Name="$(PROJECTNAME).app"/>
-                <ProjectRoot Platform="Win64" Name="$(PROJECTNAME)"/>
-                <ProjectRoot Platform="iOSDevice32" Name="$(PROJECTNAME).app"/>
-                <ProjectRoot Platform="Linux64" Name="$(PROJECTNAME)"/>
-                <ProjectRoot Platform="Win32" Name="$(PROJECTNAME)"/>
-                <ProjectRoot Platform="OSX32" Name="$(PROJECTNAME)"/>
-                <ProjectRoot Platform="Android" Name="$(PROJECTNAME)"/>
-                <ProjectRoot Platform="iOSSimulator" Name="$(PROJECTNAME).app"/>
-            </Deployment>
-        </BorlandProject>
-        <ProjectFileVersion>12</ProjectFileVersion>
-    </ProjectExtensions>
-    <Import Project="$(BDS)\Bin\CodeGear.Delphi.Targets" Condition="Exists('$(BDS)\Bin\CodeGear.Delphi.Targets')"/>
-    <Import Project="$(APPDATA)\Embarcadero\$(BDSAPPDATABASEDIR)\$(PRODUCTVERSION)\UserTools.proj" Condition="Exists('$(APPDATA)\Embarcadero\$(BDSAPPDATABASEDIR)\$(PRODUCTVERSION)\UserTools.proj')"/>
-    <Import Project="$(MSBuildProjectName).deployproj" Condition="Exists('$(MSBuildProjectName).deployproj')"/>
-</Project>
+﻿	<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+		<PropertyGroup>
+			<ProjectGuid>{BDB76098-EDD6-4A5A-AF30-D7A6B0BCF914}</ProjectGuid>
+			<MainSource>phpcon.dpr</MainSource>
+			<Base>True</Base>
+			<Config Condition="'$(Config)'==''">Debug</Config>
+			<TargetedPlatforms>3</TargetedPlatforms>
+			<AppType>Console</AppType>
+			<FrameworkType>None</FrameworkType>
+			<ProjectVersion>18.2</ProjectVersion>
+			<Platform Condition="'$(Platform)'==''">Win32</Platform>
+			<DCC_DCCCompiler>DCC32</DCC_DCCCompiler>
+		</PropertyGroup>
+		<PropertyGroup Condition="'$(Config)'=='Base' or '$(Base)'!=''">
+			<Base>true</Base>
+		</PropertyGroup>
+		<PropertyGroup Condition="'$(Config)'=='Release' or '$(Cfg_1)'!=''">
+			<Cfg_1>true</Cfg_1>
+			<CfgParent>Base</CfgParent>
+			<Base>true</Base>
+		</PropertyGroup>
+		<PropertyGroup Condition="'$(Config)'=='Debug' or '$(Cfg_2)'!=''">
+			<Cfg_2>true</Cfg_2>
+			<CfgParent>Base</CfgParent>
+			<Base>true</Base>
+		</PropertyGroup>
+		<PropertyGroup Condition="'$(Base)'!=''">
+			<DCC_DependencyCheckOutputName>phpcon.exe</DCC_DependencyCheckOutputName>
+			<DCC_UnitSearchPath>..\..\..\;$(DCC_UnitSearchPath)</DCC_UnitSearchPath>
+			<DCC_ExeOutput></DCC_ExeOutput>
+			<DCC_F>false</DCC_F>
+			<VerInfo_Locale>1058</VerInfo_Locale>
+			<DCC_E>false</DCC_E>
+			<DCC_ImageBase>00400000</DCC_ImageBase>
+			<DCC_Namespace>System;Xml;Data;Datasnap;Web;Soap;$(DCC_Namespace)</DCC_Namespace>
+			<Icon_MainIcon>$(BDS)\bin\delphi_PROJECTICON.ico</Icon_MainIcon>
+			<SanitizedProjectName>phpcon</SanitizedProjectName>
+			<VerInfo_Keys>CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments=;CFBundleName=</VerInfo_Keys>
+			<DCC_S>false</DCC_S>
+			<DCC_N>false</DCC_N>
+			<DCC_K>false</DCC_K>
+			<Icns_MainIcns>$(BDS)\bin\delphi_PROJECTICNS.icns</Icns_MainIcns>
+		</PropertyGroup>
+		<PropertyGroup Condition="'$(Cfg_1)'!=''">
+			<DCC_DebugInformation>0</DCC_DebugInformation>
+			<DCC_LocalDebugSymbols>false</DCC_LocalDebugSymbols>
+			<DCC_SymbolReferenceInfo>0</DCC_SymbolReferenceInfo>
+			<DCC_Define>RELEASE;$(DCC_Define)</DCC_Define>
+		</PropertyGroup>
+		<PropertyGroup Condition="'$(Cfg_2)'!=''">
+			<DCC_GenerateStackFrames>true</DCC_GenerateStackFrames>
+			<DCC_Define>DEBUG;$(DCC_Define)</DCC_Define>
+			<DCC_Optimize>false</DCC_Optimize>
+		</PropertyGroup>
+		<ItemGroup>
+			<DelphiCompile Include="phpcon.dpr">
+				<MainSource>MainSource</MainSource>
+			</DelphiCompile>
+			<BuildConfiguration Include="Base">
+				<Key>Base</Key>
+			</BuildConfiguration>
+			<BuildConfiguration Include="Debug">
+				<Key>Cfg_2</Key>
+				<CfgParent>Base</CfgParent>
+			</BuildConfiguration>
+			<BuildConfiguration Include="Release">
+				<Key>Cfg_1</Key>
+				<CfgParent>Base</CfgParent>
+			</BuildConfiguration>
+		</ItemGroup>
+		<Import Project="$(BDS)\Bin\CodeGear.Delphi.Targets" Condition="Exists('$(BDS)\Bin\CodeGear.Delphi.Targets')"/>
+		<ProjectExtensions>
+			<Borland.Personality>Delphi.Personality.12</Borland.Personality>
+			<Borland.ProjectType/>
+			<BorlandProject>
+				<Delphi.Personality>
+					<Source>
+						<Source Name="MainSource">phpcon.dpr</Source>
+					</Source>
+					<Excluded_Packages>
+						<Excluded_Packages Name="%BDSBIN%\bcboffice2k240.bpl">Embarcadero C++Builder Office 2000 Servers Package</Excluded_Packages>
+						<Excluded_Packages Name="%BDSBIN%\dcloffice2k240.bpl">Microsoft Office 2000 Sample Automation Server Wrapper Components</Excluded_Packages>
+						<Excluded_Packages Name="%BDSBIN%\dclofficexp240.bpl">Microsoft Office XP Sample Automation Server Wrapper Components</Excluded_Packages>
+					</Excluded_Packages>
+					<Parameters>
+						<Parameters Name="UseLauncher">False</Parameters>
+						<Parameters Name="LoadAllSymbols">True</Parameters>
+						<Parameters Name="LoadUnspecifiedSymbols">False</Parameters>
+					</Parameters>
+					<VersionInfo>
+						<VersionInfo Name="IncludeVerInfo">False</VersionInfo>
+						<VersionInfo Name="AutoIncBuild">False</VersionInfo>
+						<VersionInfo Name="MajorVer">1</VersionInfo>
+						<VersionInfo Name="MinorVer">0</VersionInfo>
+						<VersionInfo Name="Release">0</VersionInfo>
+						<VersionInfo Name="Build">0</VersionInfo>
+						<VersionInfo Name="Debug">False</VersionInfo>
+						<VersionInfo Name="PreRelease">False</VersionInfo>
+						<VersionInfo Name="Special">False</VersionInfo>
+						<VersionInfo Name="Private">False</VersionInfo>
+						<VersionInfo Name="DLL">False</VersionInfo>
+						<VersionInfo Name="Locale">1058</VersionInfo>
+						<VersionInfo Name="CodePage">1251</VersionInfo>
+					</VersionInfo>
+					<VersionInfoKeys>
+						<VersionInfoKeys Name="CompanyName"/>
+						<VersionInfoKeys Name="FileDescription"/>
+						<VersionInfoKeys Name="FileVersion">1.0.0.0</VersionInfoKeys>
+						<VersionInfoKeys Name="InternalName"/>
+						<VersionInfoKeys Name="LegalCopyright"/>
+						<VersionInfoKeys Name="LegalTrademarks"/>
+						<VersionInfoKeys Name="OriginalFilename"/>
+						<VersionInfoKeys Name="ProductName"/>
+						<VersionInfoKeys Name="ProductVersion">1.0.0.0</VersionInfoKeys>
+						<VersionInfoKeys Name="Comments"/>
+					</VersionInfoKeys>
+				</Delphi.Personality>
+				<Platforms>
+					<Platform value="Android">False</Platform>
+					<Platform value="Win32">True</Platform>
+					<Platform value="Win64">True</Platform>
+				</Platforms>
+				<Deployment Version="3">
+					<DeployFile Class="DependencyModule" LocalName="$(BDS)\Redist\osx32\libcgunwind.1.0.dylib">
+						<Platform Name="OSX32">
+							<Overwrite>true</Overwrite>
+						</Platform>
+					</DeployFile>
+					<DeployFile Class="DependencyModule" LocalName="$(BDS)\Redist\iossimulator\libcgunwind.1.0.dylib">
+						<Platform Name="iOSSimulator">
+							<Overwrite>true</Overwrite>
+						</Platform>
+					</DeployFile>
+					<DeployFile Class="DependencyModule" LocalName="$(BDS)\Redist\iossimulator\libPCRE.dylib">
+						<Platform Name="iOSSimulator">
+							<Overwrite>true</Overwrite>
+						</Platform>
+					</DeployFile>
+					<DeployFile Class="DependencyModule" LocalName="$(BDS)\Redist\osx32\libcgsqlite3.dylib">
+						<Platform Name="OSX32">
+							<Overwrite>true</Overwrite>
+						</Platform>
+					</DeployFile>
+					<DeployFile Class="ProjectOutput" LocalName="phpcon.exe" Configuration="Debug">
+						<Platform Name="Win32">
+							<RemoteName>phpcon.exe</RemoteName>
+							<Overwrite>true</Overwrite>
+						</Platform>
+					</DeployFile>
+					<DeployClass Name="ProjectiOSDeviceResourceRules"/>
+					<DeployClass Name="ProjectOSXResource">
+						<Platform Name="OSX32">
+							<RemoteDir>Contents\Resources</RemoteDir>
+							<Operation>1</Operation>
+						</Platform>
+					</DeployClass>
+					<DeployClass Name="AndroidClassesDexFile">
+						<Platform Name="Android">
+							<RemoteDir>classes</RemoteDir>
+							<Operation>1</Operation>
+						</Platform>
+					</DeployClass>
+					<DeployClass Name="AdditionalDebugSymbols">
+						<Platform Name="Win32">
+							<RemoteDir>Contents\MacOS</RemoteDir>
+							<Operation>0</Operation>
+						</Platform>
+						<Platform Name="OSX32">
+							<Operation>1</Operation>
+						</Platform>
+					</DeployClass>
+					<DeployClass Name="iPad_Launch768">
+						<Platform Name="iOSSimulator">
+							<Operation>1</Operation>
+						</Platform>
+						<Platform Name="iOSDevice64">
+							<Operation>1</Operation>
+						</Platform>
+						<Platform Name="iOSDevice32">
+							<Operation>1</Operation>
+						</Platform>
+					</DeployClass>
+					<DeployClass Name="Android_LauncherIcon144">
+						<Platform Name="Android">
+							<RemoteDir>res\drawable-xxhdpi</RemoteDir>
+							<Operation>1</Operation>
+						</Platform>
+					</DeployClass>
+					<DeployClass Name="AndroidLibnativeMipsFile">
+						<Platform Name="Android">
+							<RemoteDir>library\lib\mips</RemoteDir>
+							<Operation>1</Operation>
+						</Platform>
+					</DeployClass>
+					<DeployClass Required="true" Name="ProjectOutput">
+						<Platform Name="iOSDevice64">
+							<Operation>1</Operation>
+						</Platform>
+						<Platform Name="iOSDevice32">
+							<Operation>1</Operation>
+						</Platform>
+						<Platform Name="Win32">
+							<Operation>0</Operation>
+						</Platform>
+						<Platform Name="Linux64">
+							<Operation>1</Operation>
+						</Platform>
+						<Platform Name="OSX32">
+							<Operation>1</Operation>
+						</Platform>
+						<Platform Name="Android">
+							<RemoteDir>library\lib\armeabi-v7a</RemoteDir>
+							<Operation>1</Operation>
+						</Platform>
+						<Platform Name="iOSSimulator">
+							<Operation>1</Operation>
+						</Platform>
+					</DeployClass>
+					<DeployClass Name="DependencyFramework">
+						<Platform Name="Win32">
+							<Operation>0</Operation>
+						</Platform>
+						<Platform Name="OSX32">
+							<Operation>1</Operation>
+							<Extensions>.framework</Extensions>
+						</Platform>
+					</DeployClass>
+					<DeployClass Name="ProjectUWPManifest">
+						<Platform Name="Win32">
+							<Operation>1</Operation>
+						</Platform>
+						<Platform Name="Win64">
+							<Operation>1</Operation>
+						</Platform>
+					</DeployClass>
+					<DeployClass Name="iPhone_Launch640">
+						<Platform Name="iOSSimulator">
+							<Operation>1</Operation>
+						</Platform>
+						<Platform Name="iOSDevice64">
+							<Operation>1</Operation>
+						</Platform>
+						<Platform Name="iOSDevice32">
+							<Operation>1</Operation>
+						</Platform>
+					</DeployClass>
+					<DeployClass Name="iPad_Launch1024">
+						<Platform Name="iOSSimulator">
+							<Operation>1</Operation>
+						</Platform>
+						<Platform Name="iOSDevice64">
+							<Operation>1</Operation>
+						</Platform>
+						<Platform Name="iOSDevice32">
+							<Operation>1</Operation>
+						</Platform>
+					</DeployClass>
+					<DeployClass Name="ProjectiOSDeviceDebug">
+						<Platform Name="iOSDevice64">
+							<RemoteDir>..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF</RemoteDir>
+							<Operation>1</Operation>
+						</Platform>
+						<Platform Name="iOSDevice32">
+							<RemoteDir>..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF</RemoteDir>
+							<Operation>1</Operation>
+						</Platform>
+					</DeployClass>
+					<DeployClass Name="iPhone_Launch320">
+						<Platform Name="iOSSimulator">
+							<Operation>1</Operation>
+						</Platform>
+						<Platform Name="iOSDevice64">
+							<Operation>1</Operation>
+						</Platform>
+						<Platform Name="iOSDevice32">
+							<Operation>1</Operation>
+						</Platform>
+					</DeployClass>
+					<DeployClass Name="ProjectiOSInfoPList"/>
+					<DeployClass Name="AndroidLibnativeArmeabiFile">
+						<Platform Name="Android">
+							<RemoteDir>library\lib\armeabi</RemoteDir>
+							<Operation>1</Operation>
+						</Platform>
+					</DeployClass>
+					<DeployClass Name="DebugSymbols">
+						<Platform Name="Win32">
+							<Operation>0</Operation>
+						</Platform>
+						<Platform Name="iOSSimulator">
+							<Operation>1</Operation>
+						</Platform>
+						<Platform Name="OSX32">
+							<Operation>1</Operation>
+						</Platform>
+					</DeployClass>
+					<DeployClass Name="iPad_Launch1536">
+						<Platform Name="iOSSimulator">
+							<Operation>1</Operation>
+						</Platform>
+						<Platform Name="iOSDevice64">
+							<Operation>1</Operation>
+						</Platform>
+						<Platform Name="iOSDevice32">
+							<Operation>1</Operation>
+						</Platform>
+					</DeployClass>
+					<DeployClass Name="Android_SplashImage470">
+						<Platform Name="Android">
+							<RemoteDir>res\drawable-normal</RemoteDir>
+							<Operation>1</Operation>
+						</Platform>
+					</DeployClass>
+					<DeployClass Name="Android_LauncherIcon96">
+						<Platform Name="Android">
+							<RemoteDir>res\drawable-xhdpi</RemoteDir>
+							<Operation>1</Operation>
+						</Platform>
+					</DeployClass>
+					<DeployClass Name="Android_SplashImage640">
+						<Platform Name="Android">
+							<RemoteDir>res\drawable-large</RemoteDir>
+							<Operation>1</Operation>
+						</Platform>
+					</DeployClass>
+					<DeployClass Name="iPhone_Launch640x1136">
+						<Platform Name="iOSSimulator">
+							<Operation>1</Operation>
+						</Platform>
+						<Platform Name="iOSDevice64">
+							<Operation>1</Operation>
+						</Platform>
+						<Platform Name="iOSDevice32">
+							<Operation>1</Operation>
+						</Platform>
+					</DeployClass>
+					<DeployClass Name="UWP_DelphiLogo44">
+						<Platform Name="Win32">
+							<RemoteDir>Assets</RemoteDir>
+							<Operation>1</Operation>
+						</Platform>
+						<Platform Name="Win64">
+							<RemoteDir>Assets</RemoteDir>
+							<Operation>1</Operation>
+						</Platform>
+					</DeployClass>
+					<DeployClass Name="ProjectiOSEntitlements"/>
+					<DeployClass Name="Android_LauncherIcon72">
+						<Platform Name="Android">
+							<RemoteDir>res\drawable-hdpi</RemoteDir>
+							<Operation>1</Operation>
+						</Platform>
+					</DeployClass>
+					<DeployClass Name="AndroidGDBServer">
+						<Platform Name="Android">
+							<RemoteDir>library\lib\armeabi-v7a</RemoteDir>
+							<Operation>1</Operation>
+						</Platform>
+					</DeployClass>
+					<DeployClass Name="ProjectOSXInfoPList"/>
+					<DeployClass Name="ProjectOSXEntitlements"/>
+					<DeployClass Name="UWP_DelphiLogo150">
+						<Platform Name="Win32">
+							<RemoteDir>Assets</RemoteDir>
+							<Operation>1</Operation>
+						</Platform>
+						<Platform Name="Win64">
+							<RemoteDir>Assets</RemoteDir>
+							<Operation>1</Operation>
+						</Platform>
+					</DeployClass>
+					<DeployClass Name="iPad_Launch2048">
+						<Platform Name="iOSSimulator">
+							<Operation>1</Operation>
+						</Platform>
+						<Platform Name="iOSDevice64">
+							<Operation>1</Operation>
+						</Platform>
+						<Platform Name="iOSDevice32">
+							<Operation>1</Operation>
+						</Platform>
+					</DeployClass>
+					<DeployClass Name="AndroidSplashStyles">
+						<Platform Name="Android">
+							<RemoteDir>res\values</RemoteDir>
+							<Operation>1</Operation>
+						</Platform>
+					</DeployClass>
+					<DeployClass Name="Android_SplashImage426">
+						<Platform Name="Android">
+							<RemoteDir>res\drawable-small</RemoteDir>
+							<Operation>1</Operation>
+						</Platform>
+					</DeployClass>
+					<DeployClass Name="AndroidSplashImageDef">
+						<Platform Name="Android">
+							<RemoteDir>res\drawable</RemoteDir>
+							<Operation>1</Operation>
+						</Platform>
+					</DeployClass>
+					<DeployClass Name="ProjectiOSResource">
+						<Platform Name="iOSSimulator">
+							<Operation>1</Operation>
+						</Platform>
+						<Platform Name="iOSDevice64">
+							<Operation>1</Operation>
+						</Platform>
+						<Platform Name="iOSDevice32">
+							<Operation>1</Operation>
+						</Platform>
+					</DeployClass>
+					<DeployClass Name="ProjectAndroidManifest">
+						<Platform Name="Android">
+							<Operation>1</Operation>
+						</Platform>
+					</DeployClass>
+					<DeployClass Name="Android_DefaultAppIcon">
+						<Platform Name="Android">
+							<RemoteDir>res\drawable</RemoteDir>
+							<Operation>1</Operation>
+						</Platform>
+					</DeployClass>
+					<DeployClass Name="File">
+						<Platform Name="Win32">
+							<Operation>0</Operation>
+						</Platform>
+						<Platform Name="iOSDevice64">
+							<Operation>0</Operation>
+						</Platform>
+						<Platform Name="OSX32">
+							<Operation>0</Operation>
+						</Platform>
+						<Platform Name="iOSDevice32">
+							<Operation>0</Operation>
+						</Platform>
+						<Platform Name="Android">
+							<Operation>0</Operation>
+						</Platform>
+						<Platform Name="iOSSimulator">
+							<Operation>0</Operation>
+						</Platform>
+					</DeployClass>
+					<DeployClass Name="AndroidServiceOutput">
+						<Platform Name="Android">
+							<RemoteDir>library\lib\armeabi-v7a</RemoteDir>
+							<Operation>1</Operation>
+						</Platform>
+					</DeployClass>
+					<DeployClass Required="true" Name="DependencyPackage">
+						<Platform Name="Win32">
+							<Operation>0</Operation>
+							<Extensions>.bpl</Extensions>
+						</Platform>
+						<Platform Name="iOSDevice64">
+							<Operation>1</Operation>
+							<Extensions>.dylib</Extensions>
+						</Platform>
+						<Platform Name="OSX32">
+							<Operation>1</Operation>
+							<Extensions>.dylib</Extensions>
+						</Platform>
+						<Platform Name="iOSDevice32">
+							<Operation>1</Operation>
+							<Extensions>.dylib</Extensions>
+						</Platform>
+						<Platform Name="iOSSimulator">
+							<Operation>1</Operation>
+							<Extensions>.dylib</Extensions>
+						</Platform>
+					</DeployClass>
+					<DeployClass Name="Android_LauncherIcon48">
+						<Platform Name="Android">
+							<RemoteDir>res\drawable-mdpi</RemoteDir>
+							<Operation>1</Operation>
+						</Platform>
+					</DeployClass>
+					<DeployClass Name="Android_SplashImage960">
+						<Platform Name="Android">
+							<RemoteDir>res\drawable-xlarge</RemoteDir>
+							<Operation>1</Operation>
+						</Platform>
+					</DeployClass>
+					<DeployClass Name="Android_LauncherIcon36">
+						<Platform Name="Android">
+							<RemoteDir>res\drawable-ldpi</RemoteDir>
+							<Operation>1</Operation>
+						</Platform>
+					</DeployClass>
+					<DeployClass Name="DependencyModule">
+						<Platform Name="Win32">
+							<Operation>0</Operation>
+							<Extensions>.dll;.bpl</Extensions>
+						</Platform>
+						<Platform Name="OSX32">
+							<Operation>1</Operation>
+							<Extensions>.dylib</Extensions>
+						</Platform>
+					</DeployClass>
+					<ProjectRoot Name="$(PROJECTNAME).app" Platform="iOSDevice64"/>
+					<ProjectRoot Name="$(PROJECTNAME)" Platform="Win64"/>
+					<ProjectRoot Name="$(PROJECTNAME).app" Platform="iOSDevice32"/>
+					<ProjectRoot Name="$(PROJECTNAME)" Platform="Linux64"/>
+					<ProjectRoot Name="$(PROJECTNAME)" Platform="Win32"/>
+					<ProjectRoot Name="$(PROJECTNAME)" Platform="OSX32"/>
+					<ProjectRoot Name="$(PROJECTNAME)" Platform="Android"/>
+					<ProjectRoot Name="$(PROJECTNAME).app" Platform="iOSSimulator"/>
+				</Deployment>
+			</BorlandProject>
+			<ProjectFileVersion>12</ProjectFileVersion>
+		</ProjectExtensions>
+	</Project>
diff --git a/Source/Demos/psvPHP/console/test.php b/Source/Demos/psvPHP/console/test.php
index f4f3614..97d44b7 100644
--- a/Source/Demos/psvPHP/console/test.php
+++ b/Source/Demos/psvPHP/console/test.php
@@ -1,4 +1,7 @@
-<?php  
- phpinfo();
-?>
-
+<?php
+$r = 2 + 3;
+echo "Result: ";
+echo $r;
+g_r_c($r);
+gui_message($r);
+?>
\ No newline at end of file
diff --git a/Source/PHP.INC b/Source/PHP.INC
index d7fa89c..6b8aca2 100644
--- a/Source/PHP.INC
+++ b/Source/PHP.INC
@@ -34,8 +34,11 @@ Define suitable visual library
 }
 
 //Version
+//{$DEFINE PHP520}
 {$DEFINE PHP560}
 	//PHP Version
+{$DEFINE COMPILER_VC6}
+	//Compiler Version
 {$DEFINE ZTS}
 	//Thread Safe mode (php7ts, e.g)
 {$DEFINE VCL}
@@ -96,7 +99,6 @@ Define suitable visual library
 {$IFDEF PHP510} {$DEFINE PHP504} {$ENDIF}
 {$IFDEF PHP504} {$DEFINE PHP5} {$ENDIF}
 {$IFDEF PHP_COMPILER_ID}
- {$DEFINE COMPILER_VC9}
 	{$IFNDEF PHP7}
 		{$IFDEF PHP550} {$DEFINE COMPILER_VC11} {$ENDIF}
 	{$ELSE}
@@ -120,6 +122,10 @@ Define suitable visual library
 	{$DEFINE VERSION12}
 	{$DEFINE VERSION13}
 	{$DEFINE VERSION14}
+{$else}
+	{$if CompilerVersion > 25}
+	{$LEGACYIFEND ON}
+	{$ifend}
 {$endif}
 
 {$IFNDEF VER80}                                             {Delphi 1.0}
diff --git a/Source/PHPAPI.pas b/Source/PHPAPI.pas
index d26fec7..fefeccc 100644
--- a/Source/PHPAPI.pas
+++ b/Source/PHPAPI.pas
@@ -119,7 +119,7 @@ interface
   php_get_output_start_filename: function  (TSRMLS_D : pointer) : zend_pchar; cdecl;
   php_get_output_start_lineno: function (TSRMLS_D : pointer) : integer; cdecl;
   php_ob_handler_used: function (handler_name : zend_pchar; TSRMLS_DC : pointer) : integer; cdecl;
-  {$IF not Defined(PHP540) and not Defined(PHP550) and not Defined(PHP560)}
+  {$IF not defined(PHP520) and not Defined(PHP540) and not Defined(PHP550) and not Defined(PHP560)}
   php_ob_init_conflict: function (handler_new : zend_pchar; handler_set : zend_pchar; TSRMLS_DC : pointer) : integer; cdecl;
   {$ifend}
   {$endif}
@@ -268,7 +268,7 @@ function ValueToFloat(Value : zend_ustr) : extended;
 php_info_print_table_row : procedure (n2 : integer; c1, c2 : zend_pchar); cdecl;
 
 php_info_print_table_end: procedure (); cdecl;
-{$IF Defined(PHP540) or Defined(PHP550) or Defined(PHP560)}
+{$IF defined(PHP520) Defined(PHP540) or Defined(PHP550) or Defined(PHP560)}
 php_write: function (const str : zend_pchar; str_length: uint; TSRMLS_DC : pointer) : integer; cdecl;
 {$ELSE}
 php_body_write: function (const str : zend_pchar; str_length: uint; TSRMLS_DC : pointer) : integer; cdecl;
@@ -528,7 +528,7 @@ function LoadPHP(const LibraryPath: zend_ustr = PHPlp) : boolean;
 
   LFunc(@php_ob_handler_used, 'php_ob_handler_used');
 {$ENDIF}
-    {$IF not Defined(PHP540) and not Defined(PHP550) and not Defined(PHP560)}
+    {$IF not defined(PHP520) and not Defined(PHP540) and not Defined(PHP550) and not Defined(PHP560)}
   LFunc(@php_ob_init_conflict, 'php_ob_init_conflict');
     {$ifend}
   LFunc(@php_strtoupper, 'php_strtoupper');
@@ -580,7 +580,7 @@ function LoadPHP(const LibraryPath: zend_ustr = PHPlp) : boolean;
   LFunc(@php_info_print_table_row, 'php_info_print_table_row');
 
   LFunc(@php_info_print_table_end, 'php_info_print_table_end');
-  {$IF Defined(PHP540) or Defined(PHP550) or Defined(PHP560)}
+  {$IF Defined(PHP520) or Defined(PHP540) or Defined(PHP550) or Defined(PHP560)}
   LFunc(@php_write, 'php_write' );
   {$ELSE}
   LFunc(@php_body_write, 'php_body_write' );
diff --git a/Source/PHPTypes.pas b/Source/PHPTypes.pas
index 6516dbe..bbca1da 100644
--- a/Source/PHPTypes.pas
+++ b/Source/PHPTypes.pas
@@ -308,7 +308,9 @@ interface
 
       phpinfo_as_text : integer;
 
+      {$IFDEF PHP520}
       ini_entries : zend_pchar;
+      {$ENDIF}
 
       additional_functions: Pointer;
       input_filter_init : Pointer;
diff --git a/Source/ZENDAPI.pas b/Source/ZENDAPI.pas
index 62d0a6c..fbed93f 100644
--- a/Source/ZENDAPI.pas
+++ b/Source/ZENDAPI.pas
@@ -25,13 +25,17 @@ interface
 {$endif}
   {$IFDEF FPC} LCLType,LCLIntf,dynlibs,libc{$ELSE}Windows{$ENDIF}, SysUtils,
   ZendTypes, Variants,
-  PHPTypes;
+  PHPTypes
+  {$if defined(chameleon)}
+  ,zend_chameleon
+  {$ifend};
 type
 TArrayVariant = array of variant;
  TWSDate = array of string;
   PWSDate = ^TWSDate;
    TASDate = array of AnsiString;
   PASDate = ^TWSDate;
+{$if not defined(chameleon_load_firstmatch)}
 const
 PHPlp =
 {$IFDEF PHP7}
@@ -40,7 +44,7 @@ interface
   {$IFDEF PHP5}
     'php5'
   {$ELSE}
-    'php4'
+    'php'
   {$ENDIF}
 {$ENDIF}
 {$IFDEF ZTS} + 'ts' {$ENDIF}
@@ -50,6 +54,7 @@ interface
 {$ELSE}
   + '.so'
 {$ENDIF};
+{$ifend}
 
 type
   EPHP4DelphiException = class(Exception)
@@ -286,7 +291,7 @@ procedure zend_hash_internal_pointer_reset(ht: {$IFDEF PHP7} Pzend_array {$ELSE}
 var
   zend_get_constant                               : function(name: zend_pchar; name_len: uint; var result: zval;
     TSRMLS_DC: Pointer): integer; cdecl;
-
+  {$if defined(PHP530)}
   zend_register_null_constant                     : procedure(name: zend_pchar; name_len: uint;
     flags: integer; module_number: integer; TSRMLS_DC: Pointer); cdecl;
 
@@ -295,7 +300,7 @@ procedure zend_hash_internal_pointer_reset(ht: {$IFDEF PHP7} Pzend_array {$ELSE}
 
   zend_register_long_constant                     : procedure(name: zend_pchar; name_len: uint;
     lval: Longint; flags: integer; module_number: integer; TSRMLS_DC: Pointer); cdecl;
-
+  {$ifend}
   zend_register_double_constant                   : procedure(name: zend_pchar; name_len: uint;
    dval: Double; flags: integer; module_number: integer; TSRMLS_DC: Pointer); cdecl;
 
@@ -755,7 +760,7 @@ procedure ZVAL_STRINGLW(z: pzval; s: PWideChar; l: integer; duplicate: boolean);
 procedure INIT_CLASS_ENTRY(var class_container: Tzend_class_entry; class_name: zend_pchar; functions:
 {$IFDEF PHP7}HashTable{$ELSE}pointer{$ENDIF});
 procedure zend_copy_constant(c: zend_constant);
-{$IF defined(PHP540) or defined(PHP550) or defined(PHP560)}
+{$IF defined(PHP520) or defined(PHP540) or defined(PHP550) or defined(PHP560)}
 procedure zend_copy_constants(target: PHashTable; source: PHashTable); cdecl;
 procedure zend_class_add_ref(aclass: Ppzend_class_entry); cdecl;
 {$IFEND}
@@ -768,7 +773,7 @@ procedure zend_class_add_ref(aclass: Ppzend_class_entry); cdecl;
   zend_output_debug_string   : procedure(trigger_break: boolean; Msg: zend_pchar); cdecl;
 
 {$IFDEF PHP5}
-  {$IF not defined(PHP540) and not defined(PHP550) and not defined(PHP560)}
+  {$IF not defined(PHP520) and not defined(PHP540) and not defined(PHP550) and not defined(PHP560)}
   zend_copy_constants: procedure(target: PHashTable; source: PHashTable); cdecl;
   {$IFEND}
   zend_objects_new : function (_object : pointer; class_type : pointer; TSRMLS_DC : pointer) : {$IFDEF PHP7}zend_object{$ELSE}_zend_object_value{$ENDIF}; cdecl;
@@ -777,7 +782,7 @@ procedure zend_class_add_ref(aclass: Ppzend_class_entry); cdecl;
   zend_objects_store_del_ref: procedure (_object : pzval; TSRMLS_DC : pointer); cdecl;
 
   function_add_ref: procedure (func: {$IFDEF PHP7}Pzend_function{$ELSE}PZendFunction{$ENDIF}); cdecl;
-  {$IF not defined(PHP540) and not defined(PHP550) and not defined(PHP560)}
+  {$IF not defined(PHP520) and  not defined(PHP540) and not defined(PHP550) and not defined(PHP560)}
   zend_class_add_ref: procedure(aclass: Ppzend_class_entry); cdecl;
   {$IFEND}
 
@@ -1910,11 +1915,11 @@ procedure ZVAL_ARRAY(z: pzval; arr:  array of variant); overload;
     Exit;
 end;
 
-{$ifdef VERSION14}
+{$if CompilerVersion > 21}
 procedure ZVAL_ARRAY(z: pzval; arr: System.TArray<System.integer>); overload;
 {$else}
 procedure ZVAL_ARRAY(z: pzval; arr: array of integer); overload;
-{$endif}
+{$ifend}
 var
   i: integer;
 begin
@@ -2238,7 +2243,7 @@ procedure zend_copy_constant(c: zend_constant);
 	if (c.flags and CONST_PERSISTENT) = 0 then
     _zval_copy_ctor_func(@c.value, '', 0);
 end;
-{$IF defined(PHP540) or defined(PHP550) or defined(PHP560)}
+{$if defined(PHP520) or defined(PHP540) or defined(PHP550) or defined(PHP560)}
 
 procedure zend_copy_constants(target: PHashTable;source: PHashTable);
 var tmp: zend_constant;
@@ -2274,13 +2279,13 @@ function LoadZEND(const LibraryPath: zend_ustr = PHPlp) : boolean;
 {$ENDIF}
 
  {$IFDEF PHP5}
- {$IF not defined(PHP540) and not defined(PHP550) and not defined(PHP560)}
+ {$IF not defined(PHP520) and not defined(PHP540) and not defined(PHP550) and not defined(PHP560)}
    LFunc(@zend_copy_constants, 'zend_copy_constants');
  {$IFEND}
    LFunc(@zend_objects_new, 'zend_objects_new');
    LFunc(@zend_objects_clone_obj, 'zend_objects_clone_obj');
    LFunc(@function_add_ref, 'function_add_ref');
- {$IF not defined(PHP540) and not defined(PHP550) and not defined(PHP560)}
+ {$IF not defined(PHP520) and  not defined(PHP540) and not defined(PHP550) and not defined(PHP560)}
    LFunc(@zend_class_add_ref, 'zend_class_add_ref');
  {$IFEND}
 
@@ -2515,6 +2520,7 @@ function LoadZEND(const LibraryPath: zend_ustr = PHPlp) : boolean;
   LFunc(@zend_get_constant, 'zend_get_constant');
 
   // -- zend_register_null_constant
+  {$if defined(PHP530)}
   LFunc(@zend_register_null_constant, 'zend_register_null_constant');
 
   // -- zend_register_bool_constant
@@ -2522,7 +2528,7 @@ function LoadZEND(const LibraryPath: zend_ustr = PHPlp) : boolean;
 
   // -- zend_register_long_constant
   LFunc(@zend_register_long_constant, 'zend_register_long_constant');
-
+  {$ifend}
   // -- zend_register_double_constant
   LFunc(@zend_register_double_constant, 'zend_register_double_constant');
 
diff --git a/Source/ZendTypes.pas b/Source/ZendTypes.pas
index 63588f9..d0d768b 100644
--- a/Source/ZendTypes.pas
+++ b/Source/ZendTypes.pas
@@ -35,43 +35,23 @@ interface
 const ZEND_BUILD_DEBUG  = '';
 {$ENDIF}
 
-{$IFDEF PHP_COMPILER_ID}
-{$IFDEF COMPILER_VC9}
 const ZEND_BUILD_SYSTEM  =
-{$IFDEF COMPILER_VC14}
-',VC14'
-{$ELSE}
-  {$IFDEF COMPILER_VC13}
-    ',VC13'
-  {$ELSE}
-    {$IFDEF COMPILER_VC12}
-      ',VC12'
-      {$ELSE}
-        {$IFDEF COMPILER_VC11}
-          ',VC11'
-          {$ELSE}
-            {$IFDEF COMPILER_VC11}
-            ',VC10'
-            {$ELSE}
-            ',VC9'
-            {$ENDIF}
-          {$ENDIF}
-      {$ENDIF}
-  {$ENDIF}
-{$ENDIF};
-{$ELSE}
-{$IFDEF COMPILER_VC6}
-const ZEND_BUILD_SYSTEM  = ',VC6';
-{$ELSE}
-const ZEND_BUILD_SYSTEM  = ', $DEFINE COMPILER_VCx directive error. See PHP.INC for more details';
-{$ENDIF}
-{$ENDIF}
-{$ENDIF}
-
+{$IFDEF PHP_COMPILER_ID}
+{$if defined(COMPILER_VC14)}',VC14'
+{$elseif COMPILER_VC13} ',VC13'
+{$elseif COMPILER_VC12} ',VC12'
+{$elseif COMPILER_VC11} ',VC11'
+{$elseif COMPILER_VC10} ',VC10'
+{$elseif COMPILER_VC9}  ',VC9'
+{$elseif COMPILER_VC6}  ',VC6'
+{$else}', $DEFINE COMPILER_VCx directive error. See PHP.INC for more details'
+{$ifend}
+{$else}
+', $DEFINE COMPILER_VCx directive error. See PHP.INC for more details'
+{$endif};
 {$ENDIF}
 
 
-
   //zend_vm_opcodes.h
 const
   ZEND_NOP                                        = 0;
@@ -853,10 +833,14 @@   Tzend_class_entry = record
    get_iterator : pointer;
    interface_gets_implemented : pointer;
 
+   {$IFDEF PHP530}
    get_static_method : pointer;
+   {$ENDIF}
 
+   {$IFDEF PHP511}
    serialize : pointer;
    unserialize : pointer;
+   {$ENDIF}
 
    interfaces : pointer;
    num_interfaces : zend_uint;
@@ -867,7 +851,9 @@   Tzend_class_entry = record
    doc_comment : zend_pchar;
    doc_comment_len : zend_uint;
 
+   {$IFDEF PHP511}
    module : pointer;
+   {$ENDIF}
   end;
   {$ENDIF}
 
@@ -1192,10 +1178,14 @@   _zend_module_entry = record
     request_shutdown_func : pointer;
     info_func             : pointer;
     version               : zend_pchar;
-    globals_size          : size_t;
-    globals_id_ptr        : pointer;
-    globals_ctor          : pointer;
-    globals_dtor          : pointer;
+
+    {$IFDEF PHP520}
+    globals_size : size_t;
+    globals_id_ptr : pointer;
+    globals_ctor : pointer;
+    globals_dtor : pointer;
+    {$ENDIF}
+
     post_deactivate_func  : pointer;
     module_started        : integer;
     _type                 : byte;
diff --git a/Source/packages/php4delphi Delphi 10.3 Rio.groupproj b/Source/packages/php4delphi Delphi 10.3 Rio.groupproj
new file mode 100644
index 0000000..ba7a357
--- /dev/null
+++ b/Source/packages/php4delphi Delphi 10.3 Rio.groupproj	
@@ -0,0 +1,48 @@
+﻿<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+    <PropertyGroup>
+        <ProjectGuid>{D3946CCE-C89C-4195-8C9B-ACC8FEE61B03}</ProjectGuid>
+    </PropertyGroup>
+    <ItemGroup>
+        <Projects Include="..\php4DelphiRRio.dproj">
+            <Dependencies/>
+        </Projects>
+        <Projects Include="..\php4DelphiDRio.dproj">
+            <Dependencies/>
+        </Projects>
+    </ItemGroup>
+    <ProjectExtensions>
+        <Borland.Personality>Default.Personality.12</Borland.Personality>
+        <Borland.ProjectType/>
+        <BorlandProject>
+            <Default.Personality/>
+        </BorlandProject>
+    </ProjectExtensions>
+    <Target Name="php4DelphiRRio">
+        <MSBuild Projects="..\php4DelphiRRio.dproj"/>
+    </Target>
+    <Target Name="php4DelphiRRio:Clean">
+        <MSBuild Projects="..\php4DelphiRRio.dproj" Targets="Clean"/>
+    </Target>
+    <Target Name="php4DelphiRRio:Make">
+        <MSBuild Projects="..\php4DelphiRRio.dproj" Targets="Make"/>
+    </Target>
+    <Target Name="php4DelphiDRio">
+        <MSBuild Projects="..\php4DelphiDRio.dproj"/>
+    </Target>
+    <Target Name="php4DelphiDRio:Clean">
+        <MSBuild Projects="..\php4DelphiDRio.dproj" Targets="Clean"/>
+    </Target>
+    <Target Name="php4DelphiDRio:Make">
+        <MSBuild Projects="..\php4DelphiDRio.dproj" Targets="Make"/>
+    </Target>
+    <Target Name="Build">
+        <CallTarget Targets="php4DelphiRRio;php4DelphiDRio"/>
+    </Target>
+    <Target Name="Clean">
+        <CallTarget Targets="php4DelphiRRio:Clean;php4DelphiDRio:Clean"/>
+    </Target>
+    <Target Name="Make">
+        <CallTarget Targets="php4DelphiRRio:Make;php4DelphiDRio:Make"/>
+    </Target>
+    <Import Project="$(BDS)\Bin\CodeGear.Group.Targets" Condition="Exists('$(BDS)\Bin\CodeGear.Group.Targets')"/>
+</Project>
diff --git a/Source/php4App.dll b/Source/php4App.dll
deleted file mode 100644
index d25d474ea40f00cf2577bcd09b2c3e842a603502..0000000000000000000000000000000000000000
GIT binary patch
diff --git a/Source/php4AppIntf.pas b/Source/php4AppIntf.pas
index ef7a95215d094d8fd8e47cab2d0b5be4d597ed01..ea6d31f10aa73154900b6d21357c6ce357c86eb7 100644
GIT binary patch
diff --git a/Source/php4DelphiDRio.dpk b/Source/php4DelphiDRio.dpk
new file mode 100644
index 0000000..acefc0d
--- /dev/null
+++ b/Source/php4DelphiDRio.dpk
@@ -0,0 +1,48 @@
+package php4DelphiDRio;
+
+{$R *.res}
+{$IFDEF IMPLICITBUILDING This IFDEF should not be used by users}
+{$ALIGN 8}
+{$ASSERTIONS ON}
+{$BOOLEVAL OFF}
+{$DEBUGINFO ON}
+{$EXTENDEDSYNTAX ON}
+{$IMPORTEDDATA ON}
+{$IOCHECKS ON}
+{$LOCALSYMBOLS ON}
+{$LONGSTRINGS ON}
+{$OPENSTRINGS ON}
+{$OPTIMIZATION OFF}
+{$OVERFLOWCHECKS OFF}
+{$RANGECHECKS OFF}
+{$REFERENCEINFO ON}
+{$SAFEDIVIDE OFF}
+{$STACKFRAMES ON}
+{$TYPEDADDRESS OFF}
+{$VARSTRINGCHECKS ON}
+{$WRITEABLECONST OFF}
+{$MINENUMSIZE 1}
+{$IMAGEBASE $400000}
+{$DEFINE DEBUG}
+{$ENDIF IMPLICITBUILDING}
+{$DESCRIPTION 'php4Delphi (design-time)'}
+{$DESIGNONLY}
+{$IMPLICITBUILD OFF}
+
+requires
+  rtl,
+  vcl,
+  designide,
+  vclactnband,
+  vclx,
+  php4DelphiR2010;
+
+contains
+  PHPProjectWizard in 'PHPProjectWizard.pas',
+  php4DelphiReg in 'php4DelphiReg.pas',
+  php4DelphiWeb in 'php4DelphiWeb.pas',
+  phpWeb in 'phpWeb.pas',
+  phpAbout in 'phpAbout.pas' {dlgAbout};
+
+end.
+
diff --git a/Source/php4DelphiDRio.dproj b/Source/php4DelphiDRio.dproj
new file mode 100644
index 0000000..248c41c
--- /dev/null
+++ b/Source/php4DelphiDRio.dproj
@@ -0,0 +1,799 @@
+﻿<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+    <PropertyGroup>
+        <ProjectGuid>{34B23B2E-657F-42AF-9898-5D22792F862D}</ProjectGuid>
+        <MainSource>php4DelphiDRio.dpk</MainSource>
+        <Base>True</Base>
+        <Config Condition="'$(Config)'==''">Debug</Config>
+        <TargetedPlatforms>1</TargetedPlatforms>
+        <AppType>Package</AppType>
+        <FrameworkType>VCL</FrameworkType>
+        <ProjectVersion>18.7</ProjectVersion>
+        <Platform Condition="'$(Platform)'==''">Win32</Platform>
+    </PropertyGroup>
+    <PropertyGroup Condition="'$(Config)'=='Base' or '$(Base)'!=''">
+        <Base>true</Base>
+    </PropertyGroup>
+    <PropertyGroup Condition="('$(Platform)'=='Win32' and '$(Base)'=='true') or '$(Base_Win32)'!=''">
+        <Base_Win32>true</Base_Win32>
+        <CfgParent>Base</CfgParent>
+        <Base>true</Base>
+    </PropertyGroup>
+    <PropertyGroup Condition="'$(Config)'=='Release' or '$(Cfg_1)'!=''">
+        <Cfg_1>true</Cfg_1>
+        <CfgParent>Base</CfgParent>
+        <Base>true</Base>
+    </PropertyGroup>
+    <PropertyGroup Condition="'$(Config)'=='Debug' or '$(Cfg_2)'!=''">
+        <Cfg_2>true</Cfg_2>
+        <CfgParent>Base</CfgParent>
+        <Base>true</Base>
+    </PropertyGroup>
+    <PropertyGroup Condition="('$(Platform)'=='Win32' and '$(Cfg_2)'=='true') or '$(Cfg_2_Win32)'!=''">
+        <Cfg_2_Win32>true</Cfg_2_Win32>
+        <CfgParent>Cfg_2</CfgParent>
+        <Cfg_2>true</Cfg_2>
+        <Base>true</Base>
+    </PropertyGroup>
+    <PropertyGroup Condition="'$(Base)'!=''">
+        <DCC_DebugInformation>1</DCC_DebugInformation>
+        <DCC_Description>php4Delphi (design-time)</DCC_Description>
+        <DCC_Namespace>Vcl;Vcl.Imaging;Vcl.Touch;Vcl.Samples;Vcl.Shell;System;Xml;Data;Datasnap;Web;Soap;$(DCC_Namespace)</DCC_Namespace>
+        <SanitizedProjectName>php4DelphiDRio</SanitizedProjectName>
+        <DCC_OutputNeverBuildDcps>true</DCC_OutputNeverBuildDcps>
+        <VerInfo_Locale>1049</VerInfo_Locale>
+        <DCC_N>false</DCC_N>
+        <GenPackage>true</GenPackage>
+        <GenDll>true</GenDll>
+        <DCC_K>false</DCC_K>
+        <DCC_F>false</DCC_F>
+        <VerInfo_Keys>CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments=;CFBundleName=</VerInfo_Keys>
+        <DCC_ImageBase>00400000</DCC_ImageBase>
+        <DCC_S>false</DCC_S>
+        <DCC_E>false</DCC_E>
+        <DesignOnlyPackage>true</DesignOnlyPackage>
+    </PropertyGroup>
+    <PropertyGroup Condition="'$(Base_Win32)'!=''">
+        <DCC_UsePackage>vcl;rtl;vclactnband;vclx;php4DelphiR2010;$(DCC_UsePackage)</DCC_UsePackage>
+        <Icon_MainIcon>php4DelphiD2010_Icon.ico</Icon_MainIcon>
+        <VerInfo_Locale>1033</VerInfo_Locale>
+        <VerInfo_IncludeVerInfo>true</VerInfo_IncludeVerInfo>
+        <VerInfo_Keys>CompanyName=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductVersion=1.0.0.0;Comments=;ProgramID=com.embarcadero.$(ModuleName);FileDescription=$(ModuleName);ProductName=$(ModuleName)</VerInfo_Keys>
+        <DCC_Namespace>Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace)</DCC_Namespace>
+    </PropertyGroup>
+    <PropertyGroup Condition="'$(Cfg_1)'!=''">
+        <DCC_SymbolReferenceInfo>0</DCC_SymbolReferenceInfo>
+        <DCC_LocalDebugSymbols>false</DCC_LocalDebugSymbols>
+        <DCC_Define>RELEASE;$(DCC_Define)</DCC_Define>
+        <DCC_DebugInformation>0</DCC_DebugInformation>
+    </PropertyGroup>
+    <PropertyGroup Condition="'$(Cfg_2)'!=''">
+        <DCC_GenerateStackFrames>true</DCC_GenerateStackFrames>
+        <DCC_Optimize>false</DCC_Optimize>
+        <DCC_Define>DEBUG;$(DCC_Define)</DCC_Define>
+    </PropertyGroup>
+    <PropertyGroup Condition="'$(Cfg_2_Win32)'!=''">
+        <VerInfo_IncludeVerInfo>true</VerInfo_IncludeVerInfo>
+        <VerInfo_Locale>1033</VerInfo_Locale>
+        <VerInfo_Keys>CompanyName=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductVersion=1.0.0.0;Comments=;ProgramID=com.embarcadero.$(ModuleName);FileDescription=$(ModuleName);ProductName=$(ModuleName)</VerInfo_Keys>
+        <DCC_UnitSearchPath>php4delphi;F:\переустановил\Рабочий стол 08.07.4016\soulengine-5554e3db061d08b94f439be26ed071a74c30071c;$(DCC_UnitSearchPath)</DCC_UnitSearchPath>
+    </PropertyGroup>
+    <ItemGroup>
+        <DelphiCompile Include="$(MainSource)">
+            <MainSource>MainSource</MainSource>
+        </DelphiCompile>
+        <DCCReference Include="rtl.dcp"/>
+        <DCCReference Include="vcl.dcp"/>
+        <DCCReference Include="designide.dcp"/>
+        <DCCReference Include="vclactnband.dcp"/>
+        <DCCReference Include="vclx.dcp"/>
+        <DCCReference Include="php4DelphiR2010.dcp"/>
+        <DCCReference Include="PHPProjectWizard.pas"/>
+        <DCCReference Include="php4DelphiReg.pas"/>
+        <DCCReference Include="php4DelphiWeb.pas"/>
+        <DCCReference Include="phpWeb.pas"/>
+        <DCCReference Include="phpAbout.pas">
+            <Form>dlgAbout</Form>
+        </DCCReference>
+        <BuildConfiguration Include="Debug">
+            <Key>Cfg_2</Key>
+            <CfgParent>Base</CfgParent>
+        </BuildConfiguration>
+        <BuildConfiguration Include="Base">
+            <Key>Base</Key>
+        </BuildConfiguration>
+        <BuildConfiguration Include="Release">
+            <Key>Cfg_1</Key>
+            <CfgParent>Base</CfgParent>
+        </BuildConfiguration>
+    </ItemGroup>
+    <ProjectExtensions>
+        <Borland.Personality>Delphi.Personality.12</Borland.Personality>
+        <Borland.ProjectType>Package</Borland.ProjectType>
+        <BorlandProject>
+            <Delphi.Personality>
+                <Source>
+                    <Source Name="MainSource">php4DelphiDRio.dpk</Source>
+                </Source>
+                <Excluded_Packages>
+                    <Excluded_Packages Name="$(BDSBIN)\dcloffice2k240.bpl">Microsoft Office 2000 Sample Automation Server Wrapper Components</Excluded_Packages>
+                    <Excluded_Packages Name="$(BDSBIN)\dclofficexp240.bpl">Microsoft Office XP Sample Automation Server Wrapper Components</Excluded_Packages>
+                    <Excluded_Packages Name="C:\USERS\PUBLIC\DOCUMENTS\EMBARCADERO\STUDIO\18.0\bpl\dcllmdlegacy240.bpl">File C:\USERS\PUBLIC\DOCUMENTS\EMBARCADERO\STUDIO\18.0\bpl\dcllmdlegacy240.bpl not found</Excluded_Packages>
+                </Excluded_Packages>
+            </Delphi.Personality>
+            <Platforms>
+                <Platform value="Win32">True</Platform>
+            </Platforms>
+            <Deployment Version="3">
+                <DeployClass Name="AdditionalDebugSymbols">
+                    <Platform Name="OSX32">
+                        <Operation>1</Operation>
+                    </Platform>
+                    <Platform Name="Win32">
+                        <Operation>0</Operation>
+                    </Platform>
+                </DeployClass>
+                <DeployClass Name="AndroidClassesDexFile">
+                    <Platform Name="Android">
+                        <RemoteDir>classes</RemoteDir>
+                        <Operation>1</Operation>
+                    </Platform>
+                </DeployClass>
+                <DeployClass Name="AndroidFileProvider">
+                    <Platform Name="Android">
+                        <RemoteDir>res\xml</RemoteDir>
+                        <Operation>1</Operation>
+                    </Platform>
+                </DeployClass>
+                <DeployClass Name="AndroidGDBServer">
+                    <Platform Name="Android">
+                        <RemoteDir>library\lib\armeabi-v7a</RemoteDir>
+                        <Operation>1</Operation>
+                    </Platform>
+                </DeployClass>
+                <DeployClass Name="AndroidLibnativeArmeabiFile">
+                    <Platform Name="Android">
+                        <RemoteDir>library\lib\armeabi</RemoteDir>
+                        <Operation>1</Operation>
+                    </Platform>
+                </DeployClass>
+                <DeployClass Name="AndroidLibnativeMipsFile">
+                    <Platform Name="Android">
+                        <RemoteDir>library\lib\mips</RemoteDir>
+                        <Operation>1</Operation>
+                    </Platform>
+                </DeployClass>
+                <DeployClass Name="AndroidServiceOutput">
+                    <Platform Name="Android">
+                        <RemoteDir>library\lib\armeabi-v7a</RemoteDir>
+                        <Operation>1</Operation>
+                    </Platform>
+                </DeployClass>
+                <DeployClass Name="AndroidSplashImageDef">
+                    <Platform Name="Android">
+                        <RemoteDir>res\drawable</RemoteDir>
+                        <Operation>1</Operation>
+                    </Platform>
+                </DeployClass>
+                <DeployClass Name="AndroidSplashStyles">
+                    <Platform Name="Android">
+                        <RemoteDir>res\values</RemoteDir>
+                        <Operation>1</Operation>
+                    </Platform>
+                </DeployClass>
+                <DeployClass Name="AndroidSplashStylesV21">
+                    <Platform Name="Android">
+                        <RemoteDir>res\values-v21</RemoteDir>
+                        <Operation>1</Operation>
+                    </Platform>
+                </DeployClass>
+                <DeployClass Name="Android_Colors">
+                    <Platform Name="Android">
+                        <RemoteDir>res\values</RemoteDir>
+                        <Operation>1</Operation>
+                    </Platform>
+                </DeployClass>
+                <DeployClass Name="Android_DefaultAppIcon">
+                    <Platform Name="Android">
+                        <RemoteDir>res\drawable</RemoteDir>
+                        <Operation>1</Operation>
+                    </Platform>
+                </DeployClass>
+                <DeployClass Name="Android_LauncherIcon144">
+                    <Platform Name="Android">
+                        <RemoteDir>res\drawable-xxhdpi</RemoteDir>
+                        <Operation>1</Operation>
+                    </Platform>
+                </DeployClass>
+                <DeployClass Name="Android_LauncherIcon36">
+                    <Platform Name="Android">
+                        <RemoteDir>res\drawable-ldpi</RemoteDir>
+                        <Operation>1</Operation>
+                    </Platform>
+                </DeployClass>
+                <DeployClass Name="Android_LauncherIcon48">
+                    <Platform Name="Android">
+                        <RemoteDir>res\drawable-mdpi</RemoteDir>
+                        <Operation>1</Operation>
+                    </Platform>
+                </DeployClass>
+                <DeployClass Name="Android_LauncherIcon72">
+                    <Platform Name="Android">
+                        <RemoteDir>res\drawable-hdpi</RemoteDir>
+                        <Operation>1</Operation>
+                    </Platform>
+                </DeployClass>
+                <DeployClass Name="Android_LauncherIcon96">
+                    <Platform Name="Android">
+                        <RemoteDir>res\drawable-xhdpi</RemoteDir>
+                        <Operation>1</Operation>
+                    </Platform>
+                </DeployClass>
+                <DeployClass Name="Android_NotificationIcon24">
+                    <Platform Name="Android">
+                        <RemoteDir>res\drawable-mdpi</RemoteDir>
+                        <Operation>1</Operation>
+                    </Platform>
+                </DeployClass>
+                <DeployClass Name="Android_NotificationIcon36">
+                    <Platform Name="Android">
+                        <RemoteDir>res\drawable-hdpi</RemoteDir>
+                        <Operation>1</Operation>
+                    </Platform>
+                </DeployClass>
+                <DeployClass Name="Android_NotificationIcon48">
+                    <Platform Name="Android">
+                        <RemoteDir>res\drawable-xhdpi</RemoteDir>
+                        <Operation>1</Operation>
+                    </Platform>
+                </DeployClass>
+                <DeployClass Name="Android_NotificationIcon72">
+                    <Platform Name="Android">
+                        <RemoteDir>res\drawable-xxhdpi</RemoteDir>
+                        <Operation>1</Operation>
+                    </Platform>
+                </DeployClass>
+                <DeployClass Name="Android_NotificationIcon96">
+                    <Platform Name="Android">
+                        <RemoteDir>res\drawable-xxxhdpi</RemoteDir>
+                        <Operation>1</Operation>
+                    </Platform>
+                </DeployClass>
+                <DeployClass Name="Android_SplashImage426">
+                    <Platform Name="Android">
+                        <RemoteDir>res\drawable-small</RemoteDir>
+                        <Operation>1</Operation>
+                    </Platform>
+                </DeployClass>
+                <DeployClass Name="Android_SplashImage470">
+                    <Platform Name="Android">
+                        <RemoteDir>res\drawable-normal</RemoteDir>
+                        <Operation>1</Operation>
+                    </Platform>
+                </DeployClass>
+                <DeployClass Name="Android_SplashImage640">
+                    <Platform Name="Android">
+                        <RemoteDir>res\drawable-large</RemoteDir>
+                        <Operation>1</Operation>
+                    </Platform>
+                </DeployClass>
+                <DeployClass Name="Android_SplashImage960">
+                    <Platform Name="Android">
+                        <RemoteDir>res\drawable-xlarge</RemoteDir>
+                        <Operation>1</Operation>
+                    </Platform>
+                </DeployClass>
+                <DeployClass Name="Android_Strings">
+                    <Platform Name="Android">
+                        <RemoteDir>res\values</RemoteDir>
+                        <Operation>1</Operation>
+                    </Platform>
+                </DeployClass>
+                <DeployClass Name="DebugSymbols">
+                    <Platform Name="iOSSimulator">
+                        <Operation>1</Operation>
+                    </Platform>
+                    <Platform Name="OSX32">
+                        <Operation>1</Operation>
+                    </Platform>
+                    <Platform Name="Win32">
+                        <Operation>0</Operation>
+                    </Platform>
+                </DeployClass>
+                <DeployClass Name="DependencyFramework">
+                    <Platform Name="OSX32">
+                        <Operation>1</Operation>
+                        <Extensions>.framework</Extensions>
+                    </Platform>
+                    <Platform Name="OSX64">
+                        <Operation>1</Operation>
+                        <Extensions>.framework</Extensions>
+                    </Platform>
+                    <Platform Name="Win32">
+                        <Operation>0</Operation>
+                    </Platform>
+                </DeployClass>
+                <DeployClass Name="DependencyModule">
+                    <Platform Name="OSX32">
+                        <Operation>1</Operation>
+                        <Extensions>.dylib</Extensions>
+                    </Platform>
+                    <Platform Name="OSX64">
+                        <Operation>1</Operation>
+                        <Extensions>.dylib</Extensions>
+                    </Platform>
+                    <Platform Name="Win32">
+                        <Operation>0</Operation>
+                        <Extensions>.dll;.bpl</Extensions>
+                    </Platform>
+                </DeployClass>
+                <DeployClass Required="true" Name="DependencyPackage">
+                    <Platform Name="iOSDevice32">
+                        <Operation>1</Operation>
+                        <Extensions>.dylib</Extensions>
+                    </Platform>
+                    <Platform Name="iOSDevice64">
+                        <Operation>1</Operation>
+                        <Extensions>.dylib</Extensions>
+                    </Platform>
+                    <Platform Name="iOSSimulator">
+                        <Operation>1</Operation>
+                        <Extensions>.dylib</Extensions>
+                    </Platform>
+                    <Platform Name="OSX32">
+                        <Operation>1</Operation>
+                        <Extensions>.dylib</Extensions>
+                    </Platform>
+                    <Platform Name="OSX64">
+                        <Operation>1</Operation>
+                        <Extensions>.dylib</Extensions>
+                    </Platform>
+                    <Platform Name="Win32">
+                        <Operation>0</Operation>
+                        <Extensions>.bpl</Extensions>
+                    </Platform>
+                </DeployClass>
+                <DeployClass Name="File">
+                    <Platform Name="Android">
+                        <Operation>0</Operation>
+                    </Platform>
+                    <Platform Name="iOSDevice32">
+                        <Operation>0</Operation>
+                    </Platform>
+                    <Platform Name="iOSDevice64">
+                        <Operation>0</Operation>
+                    </Platform>
+                    <Platform Name="iOSSimulator">
+                        <Operation>0</Operation>
+                    </Platform>
+                    <Platform Name="OSX32">
+                        <Operation>0</Operation>
+                    </Platform>
+                    <Platform Name="OSX64">
+                        <Operation>0</Operation>
+                    </Platform>
+                    <Platform Name="Win32">
+                        <Operation>0</Operation>
+                    </Platform>
+                </DeployClass>
+                <DeployClass Name="iPad_Launch1024">
+                    <Platform Name="iOSDevice32">
+                        <Operation>1</Operation>
+                    </Platform>
+                    <Platform Name="iOSDevice64">
+                        <Operation>1</Operation>
+                    </Platform>
+                    <Platform Name="iOSSimulator">
+                        <Operation>1</Operation>
+                    </Platform>
+                </DeployClass>
+                <DeployClass Name="iPad_Launch1024x768">
+                    <Platform Name="iOSDevice32">
+                        <Operation>1</Operation>
+                    </Platform>
+                    <Platform Name="iOSDevice64">
+                        <Operation>1</Operation>
+                    </Platform>
+                    <Platform Name="iOSSimulator">
+                        <Operation>1</Operation>
+                    </Platform>
+                </DeployClass>
+                <DeployClass Name="iPad_Launch1536">
+                    <Platform Name="iOSDevice32">
+                        <Operation>1</Operation>
+                    </Platform>
+                    <Platform Name="iOSDevice64">
+                        <Operation>1</Operation>
+                    </Platform>
+                    <Platform Name="iOSSimulator">
+                        <Operation>1</Operation>
+                    </Platform>
+                </DeployClass>
+                <DeployClass Name="iPad_Launch1536x2048">
+                    <Platform Name="iOSDevice32">
+                        <Operation>1</Operation>
+                    </Platform>
+                    <Platform Name="iOSDevice64">
+                        <Operation>1</Operation>
+                    </Platform>
+                    <Platform Name="iOSSimulator">
+                        <Operation>1</Operation>
+                    </Platform>
+                </DeployClass>
+                <DeployClass Name="iPad_Launch1668">
+                    <Platform Name="iOSDevice32">
+                        <Operation>1</Operation>
+                    </Platform>
+                    <Platform Name="iOSDevice64">
+                        <Operation>1</Operation>
+                    </Platform>
+                    <Platform Name="iOSSimulator">
+                        <Operation>1</Operation>
+                    </Platform>
+                </DeployClass>
+                <DeployClass Name="iPad_Launch1668x2388">
+                    <Platform Name="iOSDevice32">
+                        <Operation>1</Operation>
+                    </Platform>
+                    <Platform Name="iOSDevice64">
+                        <Operation>1</Operation>
+                    </Platform>
+                    <Platform Name="iOSSimulator">
+                        <Operation>1</Operation>
+                    </Platform>
+                </DeployClass>
+                <DeployClass Name="iPad_Launch2048">
+                    <Platform Name="iOSDevice32">
+                        <Operation>1</Operation>
+                    </Platform>
+                    <Platform Name="iOSDevice64">
+                        <Operation>1</Operation>
+                    </Platform>
+                    <Platform Name="iOSSimulator">
+                        <Operation>1</Operation>
+                    </Platform>
+                </DeployClass>
+                <DeployClass Name="iPad_Launch2048x1536">
+                    <Platform Name="iOSDevice32">
+                        <Operation>1</Operation>
+                    </Platform>
+                    <Platform Name="iOSDevice64">
+                        <Operation>1</Operation>
+                    </Platform>
+                    <Platform Name="iOSSimulator">
+                        <Operation>1</Operation>
+                    </Platform>
+                </DeployClass>
+                <DeployClass Name="iPad_Launch2048x2732">
+                    <Platform Name="iOSDevice32">
+                        <Operation>1</Operation>
+                    </Platform>
+                    <Platform Name="iOSDevice64">
+                        <Operation>1</Operation>
+                    </Platform>
+                    <Platform Name="iOSSimulator">
+                        <Operation>1</Operation>
+                    </Platform>
+                </DeployClass>
+                <DeployClass Name="iPad_Launch2224">
+                    <Platform Name="iOSDevice32">
+                        <Operation>1</Operation>
+                    </Platform>
+                    <Platform Name="iOSDevice64">
+                        <Operation>1</Operation>
+                    </Platform>
+                    <Platform Name="iOSSimulator">
+                        <Operation>1</Operation>
+                    </Platform>
+                </DeployClass>
+                <DeployClass Name="iPad_Launch2388x1668">
+                    <Platform Name="iOSDevice32">
+                        <Operation>1</Operation>
+                    </Platform>
+                    <Platform Name="iOSDevice64">
+                        <Operation>1</Operation>
+                    </Platform>
+                    <Platform Name="iOSSimulator">
+                        <Operation>1</Operation>
+                    </Platform>
+                </DeployClass>
+                <DeployClass Name="iPad_Launch2732x2048">
+                    <Platform Name="iOSDevice32">
+                        <Operation>1</Operation>
+                    </Platform>
+                    <Platform Name="iOSDevice64">
+                        <Operation>1</Operation>
+                    </Platform>
+                    <Platform Name="iOSSimulator">
+                        <Operation>1</Operation>
+                    </Platform>
+                </DeployClass>
+                <DeployClass Name="iPad_Launch768">
+                    <Platform Name="iOSDevice32">
+                        <Operation>1</Operation>
+                    </Platform>
+                    <Platform Name="iOSDevice64">
+                        <Operation>1</Operation>
+                    </Platform>
+                    <Platform Name="iOSSimulator">
+                        <Operation>1</Operation>
+                    </Platform>
+                </DeployClass>
+                <DeployClass Name="iPad_Launch768x1024">
+                    <Platform Name="iOSDevice32">
+                        <Operation>1</Operation>
+                    </Platform>
+                    <Platform Name="iOSDevice64">
+                        <Operation>1</Operation>
+                    </Platform>
+                    <Platform Name="iOSSimulator">
+                        <Operation>1</Operation>
+                    </Platform>
+                </DeployClass>
+                <DeployClass Name="iPhone_Launch1125">
+                    <Platform Name="iOSDevice32">
+                        <Operation>1</Operation>
+                    </Platform>
+                    <Platform Name="iOSDevice64">
+                        <Operation>1</Operation>
+                    </Platform>
+                    <Platform Name="iOSSimulator">
+                        <Operation>1</Operation>
+                    </Platform>
+                </DeployClass>
+                <DeployClass Name="iPhone_Launch1136x640">
+                    <Platform Name="iOSDevice32">
+                        <Operation>1</Operation>
+                    </Platform>
+                    <Platform Name="iOSDevice64">
+                        <Operation>1</Operation>
+                    </Platform>
+                    <Platform Name="iOSSimulator">
+                        <Operation>1</Operation>
+                    </Platform>
+                </DeployClass>
+                <DeployClass Name="iPhone_Launch1242">
+                    <Platform Name="iOSDevice32">
+                        <Operation>1</Operation>
+                    </Platform>
+                    <Platform Name="iOSDevice64">
+                        <Operation>1</Operation>
+                    </Platform>
+                    <Platform Name="iOSSimulator">
+                        <Operation>1</Operation>
+                    </Platform>
+                </DeployClass>
+                <DeployClass Name="iPhone_Launch1242x2688">
+                    <Platform Name="iOSDevice32">
+                        <Operation>1</Operation>
+                    </Platform>
+                    <Platform Name="iOSDevice64">
+                        <Operation>1</Operation>
+                    </Platform>
+                    <Platform Name="iOSSimulator">
+                        <Operation>1</Operation>
+                    </Platform>
+                </DeployClass>
+                <DeployClass Name="iPhone_Launch1334">
+                    <Platform Name="iOSDevice32">
+                        <Operation>1</Operation>
+                    </Platform>
+                    <Platform Name="iOSDevice64">
+                        <Operation>1</Operation>
+                    </Platform>
+                    <Platform Name="iOSSimulator">
+                        <Operation>1</Operation>
+                    </Platform>
+                </DeployClass>
+                <DeployClass Name="iPhone_Launch1792">
+                    <Platform Name="iOSDevice32">
+                        <Operation>1</Operation>
+                    </Platform>
+                    <Platform Name="iOSDevice64">
+                        <Operation>1</Operation>
+                    </Platform>
+                    <Platform Name="iOSSimulator">
+                        <Operation>1</Operation>
+                    </Platform>
+                </DeployClass>
+                <DeployClass Name="iPhone_Launch2208">
+                    <Platform Name="iOSDevice32">
+                        <Operation>1</Operation>
+                    </Platform>
+                    <Platform Name="iOSDevice64">
+                        <Operation>1</Operation>
+                    </Platform>
+                    <Platform Name="iOSSimulator">
+                        <Operation>1</Operation>
+                    </Platform>
+                </DeployClass>
+                <DeployClass Name="iPhone_Launch2436">
+                    <Platform Name="iOSDevice32">
+                        <Operation>1</Operation>
+                    </Platform>
+                    <Platform Name="iOSDevice64">
+                        <Operation>1</Operation>
+                    </Platform>
+                    <Platform Name="iOSSimulator">
+                        <Operation>1</Operation>
+                    </Platform>
+                </DeployClass>
+                <DeployClass Name="iPhone_Launch2688x1242">
+                    <Platform Name="iOSDevice32">
+                        <Operation>1</Operation>
+                    </Platform>
+                    <Platform Name="iOSDevice64">
+                        <Operation>1</Operation>
+                    </Platform>
+                    <Platform Name="iOSSimulator">
+                        <Operation>1</Operation>
+                    </Platform>
+                </DeployClass>
+                <DeployClass Name="iPhone_Launch320">
+                    <Platform Name="iOSDevice32">
+                        <Operation>1</Operation>
+                    </Platform>
+                    <Platform Name="iOSDevice64">
+                        <Operation>1</Operation>
+                    </Platform>
+                    <Platform Name="iOSSimulator">
+                        <Operation>1</Operation>
+                    </Platform>
+                </DeployClass>
+                <DeployClass Name="iPhone_Launch640">
+                    <Platform Name="iOSDevice32">
+                        <Operation>1</Operation>
+                    </Platform>
+                    <Platform Name="iOSDevice64">
+                        <Operation>1</Operation>
+                    </Platform>
+                    <Platform Name="iOSSimulator">
+                        <Operation>1</Operation>
+                    </Platform>
+                </DeployClass>
+                <DeployClass Name="iPhone_Launch640x1136">
+                    <Platform Name="iOSDevice32">
+                        <Operation>1</Operation>
+                    </Platform>
+                    <Platform Name="iOSDevice64">
+                        <Operation>1</Operation>
+                    </Platform>
+                    <Platform Name="iOSSimulator">
+                        <Operation>1</Operation>
+                    </Platform>
+                </DeployClass>
+                <DeployClass Name="iPhone_Launch750">
+                    <Platform Name="iOSDevice32">
+                        <Operation>1</Operation>
+                    </Platform>
+                    <Platform Name="iOSDevice64">
+                        <Operation>1</Operation>
+                    </Platform>
+                    <Platform Name="iOSSimulator">
+                        <Operation>1</Operation>
+                    </Platform>
+                </DeployClass>
+                <DeployClass Name="iPhone_Launch828">
+                    <Platform Name="iOSDevice32">
+                        <Operation>1</Operation>
+                    </Platform>
+                    <Platform Name="iOSDevice64">
+                        <Operation>1</Operation>
+                    </Platform>
+                    <Platform Name="iOSSimulator">
+                        <Operation>1</Operation>
+                    </Platform>
+                </DeployClass>
+                <DeployClass Name="ProjectAndroidManifest">
+                    <Platform Name="Android">
+                        <Operation>1</Operation>
+                    </Platform>
+                </DeployClass>
+                <DeployClass Name="ProjectiOSDeviceDebug">
+                    <Platform Name="iOSDevice32">
+                        <RemoteDir>..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF</RemoteDir>
+                        <Operation>1</Operation>
+                    </Platform>
+                    <Platform Name="iOSDevice64">
+                        <RemoteDir>..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF</RemoteDir>
+                        <Operation>1</Operation>
+                    </Platform>
+                </DeployClass>
+                <DeployClass Name="ProjectiOSDeviceResourceRules"/>
+                <DeployClass Name="ProjectiOSEntitlements"/>
+                <DeployClass Name="ProjectiOSInfoPList"/>
+                <DeployClass Name="ProjectiOSResource">
+                    <Platform Name="iOSDevice32">
+                        <Operation>1</Operation>
+                    </Platform>
+                    <Platform Name="iOSDevice64">
+                        <Operation>1</Operation>
+                    </Platform>
+                    <Platform Name="iOSSimulator">
+                        <Operation>1</Operation>
+                    </Platform>
+                </DeployClass>
+                <DeployClass Name="ProjectOSXDebug"/>
+                <DeployClass Name="ProjectOSXEntitlements"/>
+                <DeployClass Name="ProjectOSXInfoPList"/>
+                <DeployClass Name="ProjectOSXResource">
+                    <Platform Name="OSX32">
+                        <RemoteDir>Contents\Resources</RemoteDir>
+                        <Operation>1</Operation>
+                    </Platform>
+                    <Platform Name="OSX64">
+                        <RemoteDir>Contents\Resources</RemoteDir>
+                        <Operation>1</Operation>
+                    </Platform>
+                </DeployClass>
+                <DeployClass Required="true" Name="ProjectOutput">
+                    <Platform Name="Android">
+                        <RemoteDir>library\lib\armeabi-v7a</RemoteDir>
+                        <Operation>1</Operation>
+                    </Platform>
+                    <Platform Name="iOSDevice32">
+                        <Operation>1</Operation>
+                    </Platform>
+                    <Platform Name="iOSDevice64">
+                        <Operation>1</Operation>
+                    </Platform>
+                    <Platform Name="iOSSimulator">
+                        <Operation>1</Operation>
+                    </Platform>
+                    <Platform Name="Linux64">
+                        <Operation>1</Operation>
+                    </Platform>
+                    <Platform Name="OSX32">
+                        <Operation>1</Operation>
+                    </Platform>
+                    <Platform Name="OSX64">
+                        <Operation>1</Operation>
+                    </Platform>
+                    <Platform Name="Win32">
+                        <Operation>0</Operation>
+                    </Platform>
+                </DeployClass>
+                <DeployClass Name="ProjectUWPManifest">
+                    <Platform Name="Win32">
+                        <Operation>1</Operation>
+                    </Platform>
+                    <Platform Name="Win64">
+                        <Operation>1</Operation>
+                    </Platform>
+                </DeployClass>
+                <DeployClass Name="UWP_DelphiLogo150">
+                    <Platform Name="Win32">
+                        <RemoteDir>Assets</RemoteDir>
+                        <Operation>1</Operation>
+                    </Platform>
+                    <Platform Name="Win64">
+                        <RemoteDir>Assets</RemoteDir>
+                        <Operation>1</Operation>
+                    </Platform>
+                </DeployClass>
+                <DeployClass Name="UWP_DelphiLogo44">
+                    <Platform Name="Win32">
+                        <RemoteDir>Assets</RemoteDir>
+                        <Operation>1</Operation>
+                    </Platform>
+                    <Platform Name="Win64">
+                        <RemoteDir>Assets</RemoteDir>
+                        <Operation>1</Operation>
+                    </Platform>
+                </DeployClass>
+                <ProjectRoot Platform="iOSDevice64" Name="$(PROJECTNAME).app"/>
+                <ProjectRoot Platform="Win64" Name="$(PROJECTNAME)"/>
+                <ProjectRoot Platform="iOSDevice32" Name="$(PROJECTNAME).app"/>
+                <ProjectRoot Platform="Linux64" Name="$(PROJECTNAME)"/>
+                <ProjectRoot Platform="Win32" Name="$(PROJECTNAME)"/>
+                <ProjectRoot Platform="OSX32" Name="$(PROJECTNAME)"/>
+                <ProjectRoot Platform="Android" Name="$(PROJECTNAME)"/>
+                <ProjectRoot Platform="OSX64" Name="$(PROJECTNAME)"/>
+                <ProjectRoot Platform="iOSSimulator" Name="$(PROJECTNAME).app"/>
+            </Deployment>
+        </BorlandProject>
+        <ProjectFileVersion>12</ProjectFileVersion>
+    </ProjectExtensions>
+    <Import Project="$(BDS)\Bin\CodeGear.Delphi.Targets" Condition="Exists('$(BDS)\Bin\CodeGear.Delphi.Targets')"/>
+    <Import Project="$(APPDATA)\Embarcadero\$(BDSAPPDATABASEDIR)\$(PRODUCTVERSION)\UserTools.proj" Condition="Exists('$(APPDATA)\Embarcadero\$(BDSAPPDATABASEDIR)\$(PRODUCTVERSION)\UserTools.proj')"/>
+    <Import Project="$(MSBuildProjectName).deployproj" Condition="Exists('$(MSBuildProjectName).deployproj')"/>
+</Project>
diff --git a/Source/php4DelphiRRio.dpk b/Source/php4DelphiRRio.dpk
new file mode 100644
index 0000000..74a511b
--- /dev/null
+++ b/Source/php4DelphiRRio.dpk
@@ -0,0 +1,50 @@
+package php4DelphiRRio;
+
+{$R *.res}
+{$R 'php4delphi.dcr'}
+{$IFDEF IMPLICITBUILDING This IFDEF should not be used by users}
+{$ALIGN 8}
+{$ASSERTIONS ON}
+{$BOOLEVAL OFF}
+{$DEBUGINFO ON}
+{$EXTENDEDSYNTAX ON}
+{$IMPORTEDDATA ON}
+{$IOCHECKS ON}
+{$LOCALSYMBOLS ON}
+{$LONGSTRINGS ON}
+{$OPENSTRINGS ON}
+{$OPTIMIZATION OFF}
+{$OVERFLOWCHECKS OFF}
+{$RANGECHECKS OFF}
+{$REFERENCEINFO ON}
+{$SAFEDIVIDE OFF}
+{$STACKFRAMES ON}
+{$TYPEDADDRESS OFF}
+{$VARSTRINGCHECKS ON}
+{$WRITEABLECONST OFF}
+{$MINENUMSIZE 1}
+{$IMAGEBASE $400000}
+{$DEFINE DEBUG}
+{$ENDIF IMPLICITBUILDING}
+{$DESCRIPTION 'php4Delphi (run-rime)'}
+{$RUNONLY}
+{$IMPLICITBUILD OFF}
+
+requires
+  rtl,
+  vcl;
+
+contains
+  ZENDAPI in 'ZENDAPI.pas',
+  DelphiFunctions in 'DelphiFunctions.pas',
+  php4delphi in 'php4delphi.pas',
+  PHPAPI in 'PHPAPI.pas',
+  phpModules in 'phpModules.pas',
+  PHPLibrary in 'PHPLibrary.pas',
+  PHPFunctions in 'PHPFunctions.pas',
+  PHPTypes in 'PHPTypes.pas',
+  ZENDTypes in 'ZENDTypes.pas',
+  phpClass in 'phpClass.pas',
+  PHPCommon in 'PHPCommon.pas';
+
+end.
diff --git a/Source/php4DelphiRRio.dproj b/Source/php4DelphiRRio.dproj
new file mode 100644
index 0000000..b61998b
--- /dev/null
+++ b/Source/php4DelphiRRio.dproj
@@ -0,0 +1,806 @@
+﻿<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+    <PropertyGroup>
+        <ProjectGuid>{E17417E2-2EC1-4971-BB34-C9C25AFF27A5}</ProjectGuid>
+        <MainSource>php4DelphiRRio.dpk</MainSource>
+        <Base>True</Base>
+        <Config Condition="'$(Config)'==''">Debug</Config>
+        <TargetedPlatforms>1</TargetedPlatforms>
+        <AppType>Package</AppType>
+        <FrameworkType>VCL</FrameworkType>
+        <ProjectVersion>18.7</ProjectVersion>
+        <Platform Condition="'$(Platform)'==''">Win32</Platform>
+    </PropertyGroup>
+    <PropertyGroup Condition="'$(Config)'=='Base' or '$(Base)'!=''">
+        <Base>true</Base>
+    </PropertyGroup>
+    <PropertyGroup Condition="('$(Platform)'=='Win32' and '$(Base)'=='true') or '$(Base_Win32)'!=''">
+        <Base_Win32>true</Base_Win32>
+        <CfgParent>Base</CfgParent>
+        <Base>true</Base>
+    </PropertyGroup>
+    <PropertyGroup Condition="'$(Config)'=='Release' or '$(Cfg_1)'!=''">
+        <Cfg_1>true</Cfg_1>
+        <CfgParent>Base</CfgParent>
+        <Base>true</Base>
+    </PropertyGroup>
+    <PropertyGroup Condition="'$(Config)'=='Debug' or '$(Cfg_2)'!=''">
+        <Cfg_2>true</Cfg_2>
+        <CfgParent>Base</CfgParent>
+        <Base>true</Base>
+    </PropertyGroup>
+    <PropertyGroup Condition="('$(Platform)'=='Win32' and '$(Cfg_2)'=='true') or '$(Cfg_2_Win32)'!=''">
+        <Cfg_2_Win32>true</Cfg_2_Win32>
+        <CfgParent>Cfg_2</CfgParent>
+        <Cfg_2>true</Cfg_2>
+        <Base>true</Base>
+    </PropertyGroup>
+    <PropertyGroup Condition="'$(Base)'!=''">
+        <DCC_DebugInformation>1</DCC_DebugInformation>
+        <DCC_Description>php4Delphi (run-rime)</DCC_Description>
+        <DCC_Namespace>Vcl;Vcl.Imaging;Vcl.Touch;Vcl.Samples;Vcl.Shell;System;Xml;Data;Datasnap;Web;Soap;$(DCC_Namespace)</DCC_Namespace>
+        <SanitizedProjectName>php4DelphiRRio</SanitizedProjectName>
+        <DCC_OutputNeverBuildDcps>true</DCC_OutputNeverBuildDcps>
+        <VerInfo_Locale>1049</VerInfo_Locale>
+        <DCC_N>false</DCC_N>
+        <GenPackage>true</GenPackage>
+        <GenDll>true</GenDll>
+        <RuntimeOnlyPackage>true</RuntimeOnlyPackage>
+        <DCC_F>false</DCC_F>
+        <VerInfo_Keys>CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments=;CFBundleName=</VerInfo_Keys>
+        <DCC_ImageBase>00400000</DCC_ImageBase>
+        <DCC_S>false</DCC_S>
+        <DCC_K>false</DCC_K>
+        <DCC_E>false</DCC_E>
+    </PropertyGroup>
+    <PropertyGroup Condition="'$(Base_Win32)'!=''">
+        <Icon_MainIcon>php4DelphiR2010_Icon.ico</Icon_MainIcon>
+        <VerInfo_Locale>1033</VerInfo_Locale>
+        <VerInfo_IncludeVerInfo>true</VerInfo_IncludeVerInfo>
+        <VerInfo_Keys>CompanyName=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductVersion=1.0.0.0;Comments=;ProgramID=com.embarcadero.$(ModuleName);FileDescription=$(ModuleName);ProductName=$(ModuleName)</VerInfo_Keys>
+        <DCC_Namespace>Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace)</DCC_Namespace>
+    </PropertyGroup>
+    <PropertyGroup Condition="'$(Cfg_1)'!=''">
+        <DCC_SymbolReferenceInfo>0</DCC_SymbolReferenceInfo>
+        <DCC_LocalDebugSymbols>false</DCC_LocalDebugSymbols>
+        <DCC_Define>RELEASE;$(DCC_Define)</DCC_Define>
+        <DCC_DebugInformation>0</DCC_DebugInformation>
+    </PropertyGroup>
+    <PropertyGroup Condition="'$(Cfg_2)'!=''">
+        <DCC_GenerateStackFrames>true</DCC_GenerateStackFrames>
+        <DCC_Optimize>false</DCC_Optimize>
+        <DCC_Define>DEBUG;$(DCC_Define)</DCC_Define>
+    </PropertyGroup>
+    <PropertyGroup Condition="'$(Cfg_2_Win32)'!=''">
+        <VerInfo_IncludeVerInfo>true</VerInfo_IncludeVerInfo>
+        <VerInfo_Locale>1033</VerInfo_Locale>
+        <VerInfo_Keys>CompanyName=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductVersion=1.0.0.0;Comments=;ProgramID=com.embarcadero.$(ModuleName);FileDescription=$(ModuleName);ProductName=$(ModuleName)</VerInfo_Keys>
+        <DCC_UnitSearchPath>php4delphi;$(DCC_UnitSearchPath)</DCC_UnitSearchPath>
+    </PropertyGroup>
+    <ItemGroup>
+        <DelphiCompile Include="$(MainSource)">
+            <MainSource>MainSource</MainSource>
+        </DelphiCompile>
+        <DCCReference Include="php4delphi.dcr"/>
+        <DCCReference Include="rtl.dcp"/>
+        <DCCReference Include="vcl.dcp"/>
+        <DCCReference Include="ZENDAPI.pas"/>
+        <DCCReference Include="DelphiFunctions.pas"/>
+        <DCCReference Include="php4delphi.pas"/>
+        <DCCReference Include="PHPAPI.pas"/>
+        <DCCReference Include="phpModules.pas"/>
+        <DCCReference Include="PHPLibrary.pas"/>
+        <DCCReference Include="PHPFunctions.pas"/>
+        <DCCReference Include="PHPTypes.pas"/>
+        <DCCReference Include="ZENDTypes.pas"/>
+        <DCCReference Include="phpClass.pas"/>
+        <DCCReference Include="PHPCommon.pas"/>
+        <BuildConfiguration Include="Debug">
+            <Key>Cfg_2</Key>
+            <CfgParent>Base</CfgParent>
+        </BuildConfiguration>
+        <BuildConfiguration Include="Base">
+            <Key>Base</Key>
+        </BuildConfiguration>
+        <BuildConfiguration Include="Release">
+            <Key>Cfg_1</Key>
+            <CfgParent>Base</CfgParent>
+        </BuildConfiguration>
+    </ItemGroup>
+    <ProjectExtensions>
+        <Borland.Personality>Delphi.Personality.12</Borland.Personality>
+        <Borland.ProjectType>Package</Borland.ProjectType>
+        <BorlandProject>
+            <Delphi.Personality>
+                <Source>
+                    <Source Name="MainSource">php4DelphiRRio.dpk</Source>
+                </Source>
+                <Excluded_Packages>
+                    <Excluded_Packages Name="$(BDSBIN)\dcloffice2k240.bpl">Microsoft Office 2000 Sample Automation Server Wrapper Components</Excluded_Packages>
+                    <Excluded_Packages Name="$(BDSBIN)\dclofficexp240.bpl">Microsoft Office XP Sample Automation Server Wrapper Components</Excluded_Packages>
+                    <Excluded_Packages Name="C:\USERS\PUBLIC\DOCUMENTS\EMBARCADERO\STUDIO\18.0\bpl\dcllmdlegacy240.bpl">File C:\USERS\PUBLIC\DOCUMENTS\EMBARCADERO\STUDIO\18.0\bpl\dcllmdlegacy240.bpl not found</Excluded_Packages>
+                </Excluded_Packages>
+            </Delphi.Personality>
+            <Platforms>
+                <Platform value="Win32">True</Platform>
+            </Platforms>
+            <Deployment Version="3">
+                <DeployFile LocalName="..\..\..\..\..\Public\Documents\Embarcadero\Studio\20.0\Bpl\php4DelphiRRio.bpl" Configuration="Debug" Class="ProjectOutput">
+                    <Platform Name="Win32">
+                        <RemoteName>php4DelphiRRio.bpl</RemoteName>
+                        <Overwrite>true</Overwrite>
+                    </Platform>
+                </DeployFile>
+                <DeployClass Name="AdditionalDebugSymbols">
+                    <Platform Name="OSX32">
+                        <Operation>1</Operation>
+                    </Platform>
+                    <Platform Name="Win32">
+                        <Operation>0</Operation>
+                    </Platform>
+                </DeployClass>
+                <DeployClass Name="AndroidClassesDexFile">
+                    <Platform Name="Android">
+                        <RemoteDir>classes</RemoteDir>
+                        <Operation>1</Operation>
+                    </Platform>
+                </DeployClass>
+                <DeployClass Name="AndroidFileProvider">
+                    <Platform Name="Android">
+                        <RemoteDir>res\xml</RemoteDir>
+                        <Operation>1</Operation>
+                    </Platform>
+                </DeployClass>
+                <DeployClass Name="AndroidGDBServer">
+                    <Platform Name="Android">
+                        <RemoteDir>library\lib\armeabi-v7a</RemoteDir>
+                        <Operation>1</Operation>
+                    </Platform>
+                </DeployClass>
+                <DeployClass Name="AndroidLibnativeArmeabiFile">
+                    <Platform Name="Android">
+                        <RemoteDir>library\lib\armeabi</RemoteDir>
+                        <Operation>1</Operation>
+                    </Platform>
+                </DeployClass>
+                <DeployClass Name="AndroidLibnativeMipsFile">
+                    <Platform Name="Android">
+                        <RemoteDir>library\lib\mips</RemoteDir>
+                        <Operation>1</Operation>
+                    </Platform>
+                </DeployClass>
+                <DeployClass Name="AndroidServiceOutput">
+                    <Platform Name="Android">
+                        <RemoteDir>library\lib\armeabi-v7a</RemoteDir>
+                        <Operation>1</Operation>
+                    </Platform>
+                </DeployClass>
+                <DeployClass Name="AndroidSplashImageDef">
+                    <Platform Name="Android">
+                        <RemoteDir>res\drawable</RemoteDir>
+                        <Operation>1</Operation>
+                    </Platform>
+                </DeployClass>
+                <DeployClass Name="AndroidSplashStyles">
+                    <Platform Name="Android">
+                        <RemoteDir>res\values</RemoteDir>
+                        <Operation>1</Operation>
+                    </Platform>
+                </DeployClass>
+                <DeployClass Name="AndroidSplashStylesV21">
+                    <Platform Name="Android">
+                        <RemoteDir>res\values-v21</RemoteDir>
+                        <Operation>1</Operation>
+                    </Platform>
+                </DeployClass>
+                <DeployClass Name="Android_Colors">
+                    <Platform Name="Android">
+                        <RemoteDir>res\values</RemoteDir>
+                        <Operation>1</Operation>
+                    </Platform>
+                </DeployClass>
+                <DeployClass Name="Android_DefaultAppIcon">
+                    <Platform Name="Android">
+                        <RemoteDir>res\drawable</RemoteDir>
+                        <Operation>1</Operation>
+                    </Platform>
+                </DeployClass>
+                <DeployClass Name="Android_LauncherIcon144">
+                    <Platform Name="Android">
+                        <RemoteDir>res\drawable-xxhdpi</RemoteDir>
+                        <Operation>1</Operation>
+                    </Platform>
+                </DeployClass>
+                <DeployClass Name="Android_LauncherIcon36">
+                    <Platform Name="Android">
+                        <RemoteDir>res\drawable-ldpi</RemoteDir>
+                        <Operation>1</Operation>
+                    </Platform>
+                </DeployClass>
+                <DeployClass Name="Android_LauncherIcon48">
+                    <Platform Name="Android">
+                        <RemoteDir>res\drawable-mdpi</RemoteDir>
+                        <Operation>1</Operation>
+                    </Platform>
+                </DeployClass>
+                <DeployClass Name="Android_LauncherIcon72">
+                    <Platform Name="Android">
+                        <RemoteDir>res\drawable-hdpi</RemoteDir>
+                        <Operation>1</Operation>
+                    </Platform>
+                </DeployClass>
+                <DeployClass Name="Android_LauncherIcon96">
+                    <Platform Name="Android">
+                        <RemoteDir>res\drawable-xhdpi</RemoteDir>
+                        <Operation>1</Operation>
+                    </Platform>
+                </DeployClass>
+                <DeployClass Name="Android_NotificationIcon24">
+                    <Platform Name="Android">
+                        <RemoteDir>res\drawable-mdpi</RemoteDir>
+                        <Operation>1</Operation>
+                    </Platform>
+                </DeployClass>
+                <DeployClass Name="Android_NotificationIcon36">
+                    <Platform Name="Android">
+                        <RemoteDir>res\drawable-hdpi</RemoteDir>
+                        <Operation>1</Operation>
+                    </Platform>
+                </DeployClass>
+                <DeployClass Name="Android_NotificationIcon48">
+                    <Platform Name="Android">
+                        <RemoteDir>res\drawable-xhdpi</RemoteDir>
+                        <Operation>1</Operation>
+                    </Platform>
+                </DeployClass>
+                <DeployClass Name="Android_NotificationIcon72">
+                    <Platform Name="Android">
+                        <RemoteDir>res\drawable-xxhdpi</RemoteDir>
+                        <Operation>1</Operation>
+                    </Platform>
+                </DeployClass>
+                <DeployClass Name="Android_NotificationIcon96">
+                    <Platform Name="Android">
+                        <RemoteDir>res\drawable-xxxhdpi</RemoteDir>
+                        <Operation>1</Operation>
+                    </Platform>
+                </DeployClass>
+                <DeployClass Name="Android_SplashImage426">
+                    <Platform Name="Android">
+                        <RemoteDir>res\drawable-small</RemoteDir>
+                        <Operation>1</Operation>
+                    </Platform>
+                </DeployClass>
+                <DeployClass Name="Android_SplashImage470">
+                    <Platform Name="Android">
+                        <RemoteDir>res\drawable-normal</RemoteDir>
+                        <Operation>1</Operation>
+                    </Platform>
+                </DeployClass>
+                <DeployClass Name="Android_SplashImage640">
+                    <Platform Name="Android">
+                        <RemoteDir>res\drawable-large</RemoteDir>
+                        <Operation>1</Operation>
+                    </Platform>
+                </DeployClass>
+                <DeployClass Name="Android_SplashImage960">
+                    <Platform Name="Android">
+                        <RemoteDir>res\drawable-xlarge</RemoteDir>
+                        <Operation>1</Operation>
+                    </Platform>
+                </DeployClass>
+                <DeployClass Name="Android_Strings">
+                    <Platform Name="Android">
+                        <RemoteDir>res\values</RemoteDir>
+                        <Operation>1</Operation>
+                    </Platform>
+                </DeployClass>
+                <DeployClass Name="DebugSymbols">
+                    <Platform Name="iOSSimulator">
+                        <Operation>1</Operation>
+                    </Platform>
+                    <Platform Name="OSX32">
+                        <Operation>1</Operation>
+                    </Platform>
+                    <Platform Name="Win32">
+                        <Operation>0</Operation>
+                    </Platform>
+                </DeployClass>
+                <DeployClass Name="DependencyFramework">
+                    <Platform Name="OSX32">
+                        <Operation>1</Operation>
+                        <Extensions>.framework</Extensions>
+                    </Platform>
+                    <Platform Name="OSX64">
+                        <Operation>1</Operation>
+                        <Extensions>.framework</Extensions>
+                    </Platform>
+                    <Platform Name="Win32">
+                        <Operation>0</Operation>
+                    </Platform>
+                </DeployClass>
+                <DeployClass Name="DependencyModule">
+                    <Platform Name="OSX32">
+                        <Operation>1</Operation>
+                        <Extensions>.dylib</Extensions>
+                    </Platform>
+                    <Platform Name="OSX64">
+                        <Operation>1</Operation>
+                        <Extensions>.dylib</Extensions>
+                    </Platform>
+                    <Platform Name="Win32">
+                        <Operation>0</Operation>
+                        <Extensions>.dll;.bpl</Extensions>
+                    </Platform>
+                </DeployClass>
+                <DeployClass Required="true" Name="DependencyPackage">
+                    <Platform Name="iOSDevice32">
+                        <Operation>1</Operation>
+                        <Extensions>.dylib</Extensions>
+                    </Platform>
+                    <Platform Name="iOSDevice64">
+                        <Operation>1</Operation>
+                        <Extensions>.dylib</Extensions>
+                    </Platform>
+                    <Platform Name="iOSSimulator">
+                        <Operation>1</Operation>
+                        <Extensions>.dylib</Extensions>
+                    </Platform>
+                    <Platform Name="OSX32">
+                        <Operation>1</Operation>
+                        <Extensions>.dylib</Extensions>
+                    </Platform>
+                    <Platform Name="OSX64">
+                        <Operation>1</Operation>
+                        <Extensions>.dylib</Extensions>
+                    </Platform>
+                    <Platform Name="Win32">
+                        <Operation>0</Operation>
+                        <Extensions>.bpl</Extensions>
+                    </Platform>
+                </DeployClass>
+                <DeployClass Name="File">
+                    <Platform Name="Android">
+                        <Operation>0</Operation>
+                    </Platform>
+                    <Platform Name="iOSDevice32">
+                        <Operation>0</Operation>
+                    </Platform>
+                    <Platform Name="iOSDevice64">
+                        <Operation>0</Operation>
+                    </Platform>
+                    <Platform Name="iOSSimulator">
+                        <Operation>0</Operation>
+                    </Platform>
+                    <Platform Name="OSX32">
+                        <Operation>0</Operation>
+                    </Platform>
+                    <Platform Name="OSX64">
+                        <Operation>0</Operation>
+                    </Platform>
+                    <Platform Name="Win32">
+                        <Operation>0</Operation>
+                    </Platform>
+                </DeployClass>
+                <DeployClass Name="iPad_Launch1024">
+                    <Platform Name="iOSDevice32">
+                        <Operation>1</Operation>
+                    </Platform>
+                    <Platform Name="iOSDevice64">
+                        <Operation>1</Operation>
+                    </Platform>
+                    <Platform Name="iOSSimulator">
+                        <Operation>1</Operation>
+                    </Platform>
+                </DeployClass>
+                <DeployClass Name="iPad_Launch1024x768">
+                    <Platform Name="iOSDevice32">
+                        <Operation>1</Operation>
+                    </Platform>
+                    <Platform Name="iOSDevice64">
+                        <Operation>1</Operation>
+                    </Platform>
+                    <Platform Name="iOSSimulator">
+                        <Operation>1</Operation>
+                    </Platform>
+                </DeployClass>
+                <DeployClass Name="iPad_Launch1536">
+                    <Platform Name="iOSDevice32">
+                        <Operation>1</Operation>
+                    </Platform>
+                    <Platform Name="iOSDevice64">
+                        <Operation>1</Operation>
+                    </Platform>
+                    <Platform Name="iOSSimulator">
+                        <Operation>1</Operation>
+                    </Platform>
+                </DeployClass>
+                <DeployClass Name="iPad_Launch1536x2048">
+                    <Platform Name="iOSDevice32">
+                        <Operation>1</Operation>
+                    </Platform>
+                    <Platform Name="iOSDevice64">
+                        <Operation>1</Operation>
+                    </Platform>
+                    <Platform Name="iOSSimulator">
+                        <Operation>1</Operation>
+                    </Platform>
+                </DeployClass>
+                <DeployClass Name="iPad_Launch1668">
+                    <Platform Name="iOSDevice32">
+                        <Operation>1</Operation>
+                    </Platform>
+                    <Platform Name="iOSDevice64">
+                        <Operation>1</Operation>
+                    </Platform>
+                    <Platform Name="iOSSimulator">
+                        <Operation>1</Operation>
+                    </Platform>
+                </DeployClass>
+                <DeployClass Name="iPad_Launch1668x2388">
+                    <Platform Name="iOSDevice32">
+                        <Operation>1</Operation>
+                    </Platform>
+                    <Platform Name="iOSDevice64">
+                        <Operation>1</Operation>
+                    </Platform>
+                    <Platform Name="iOSSimulator">
+                        <Operation>1</Operation>
+                    </Platform>
+                </DeployClass>
+                <DeployClass Name="iPad_Launch2048">
+                    <Platform Name="iOSDevice32">
+                        <Operation>1</Operation>
+                    </Platform>
+                    <Platform Name="iOSDevice64">
+                        <Operation>1</Operation>
+                    </Platform>
+                    <Platform Name="iOSSimulator">
+                        <Operation>1</Operation>
+                    </Platform>
+                </DeployClass>
+                <DeployClass Name="iPad_Launch2048x1536">
+                    <Platform Name="iOSDevice32">
+                        <Operation>1</Operation>
+                    </Platform>
+                    <Platform Name="iOSDevice64">
+                        <Operation>1</Operation>
+                    </Platform>
+                    <Platform Name="iOSSimulator">
+                        <Operation>1</Operation>
+                    </Platform>
+                </DeployClass>
+                <DeployClass Name="iPad_Launch2048x2732">
+                    <Platform Name="iOSDevice32">
+                        <Operation>1</Operation>
+                    </Platform>
+                    <Platform Name="iOSDevice64">
+                        <Operation>1</Operation>
+                    </Platform>
+                    <Platform Name="iOSSimulator">
+                        <Operation>1</Operation>
+                    </Platform>
+                </DeployClass>
+                <DeployClass Name="iPad_Launch2224">
+                    <Platform Name="iOSDevice32">
+                        <Operation>1</Operation>
+                    </Platform>
+                    <Platform Name="iOSDevice64">
+                        <Operation>1</Operation>
+                    </Platform>
+                    <Platform Name="iOSSimulator">
+                        <Operation>1</Operation>
+                    </Platform>
+                </DeployClass>
+                <DeployClass Name="iPad_Launch2388x1668">
+                    <Platform Name="iOSDevice32">
+                        <Operation>1</Operation>
+                    </Platform>
+                    <Platform Name="iOSDevice64">
+                        <Operation>1</Operation>
+                    </Platform>
+                    <Platform Name="iOSSimulator">
+                        <Operation>1</Operation>
+                    </Platform>
+                </DeployClass>
+                <DeployClass Name="iPad_Launch2732x2048">
+                    <Platform Name="iOSDevice32">
+                        <Operation>1</Operation>
+                    </Platform>
+                    <Platform Name="iOSDevice64">
+                        <Operation>1</Operation>
+                    </Platform>
+                    <Platform Name="iOSSimulator">
+                        <Operation>1</Operation>
+                    </Platform>
+                </DeployClass>
+                <DeployClass Name="iPad_Launch768">
+                    <Platform Name="iOSDevice32">
+                        <Operation>1</Operation>
+                    </Platform>
+                    <Platform Name="iOSDevice64">
+                        <Operation>1</Operation>
+                    </Platform>
+                    <Platform Name="iOSSimulator">
+                        <Operation>1</Operation>
+                    </Platform>
+                </DeployClass>
+                <DeployClass Name="iPad_Launch768x1024">
+                    <Platform Name="iOSDevice32">
+                        <Operation>1</Operation>
+                    </Platform>
+                    <Platform Name="iOSDevice64">
+                        <Operation>1</Operation>
+                    </Platform>
+                    <Platform Name="iOSSimulator">
+                        <Operation>1</Operation>
+                    </Platform>
+                </DeployClass>
+                <DeployClass Name="iPhone_Launch1125">
+                    <Platform Name="iOSDevice32">
+                        <Operation>1</Operation>
+                    </Platform>
+                    <Platform Name="iOSDevice64">
+                        <Operation>1</Operation>
+                    </Platform>
+                    <Platform Name="iOSSimulator">
+                        <Operation>1</Operation>
+                    </Platform>
+                </DeployClass>
+                <DeployClass Name="iPhone_Launch1136x640">
+                    <Platform Name="iOSDevice32">
+                        <Operation>1</Operation>
+                    </Platform>
+                    <Platform Name="iOSDevice64">
+                        <Operation>1</Operation>
+                    </Platform>
+                    <Platform Name="iOSSimulator">
+                        <Operation>1</Operation>
+                    </Platform>
+                </DeployClass>
+                <DeployClass Name="iPhone_Launch1242">
+                    <Platform Name="iOSDevice32">
+                        <Operation>1</Operation>
+                    </Platform>
+                    <Platform Name="iOSDevice64">
+                        <Operation>1</Operation>
+                    </Platform>
+                    <Platform Name="iOSSimulator">
+                        <Operation>1</Operation>
+                    </Platform>
+                </DeployClass>
+                <DeployClass Name="iPhone_Launch1242x2688">
+                    <Platform Name="iOSDevice32">
+                        <Operation>1</Operation>
+                    </Platform>
+                    <Platform Name="iOSDevice64">
+                        <Operation>1</Operation>
+                    </Platform>
+                    <Platform Name="iOSSimulator">
+                        <Operation>1</Operation>
+                    </Platform>
+                </DeployClass>
+                <DeployClass Name="iPhone_Launch1334">
+                    <Platform Name="iOSDevice32">
+                        <Operation>1</Operation>
+                    </Platform>
+                    <Platform Name="iOSDevice64">
+                        <Operation>1</Operation>
+                    </Platform>
+                    <Platform Name="iOSSimulator">
+                        <Operation>1</Operation>
+                    </Platform>
+                </DeployClass>
+                <DeployClass Name="iPhone_Launch1792">
+                    <Platform Name="iOSDevice32">
+                        <Operation>1</Operation>
+                    </Platform>
+                    <Platform Name="iOSDevice64">
+                        <Operation>1</Operation>
+                    </Platform>
+                    <Platform Name="iOSSimulator">
+                        <Operation>1</Operation>
+                    </Platform>
+                </DeployClass>
+                <DeployClass Name="iPhone_Launch2208">
+                    <Platform Name="iOSDevice32">
+                        <Operation>1</Operation>
+                    </Platform>
+                    <Platform Name="iOSDevice64">
+                        <Operation>1</Operation>
+                    </Platform>
+                    <Platform Name="iOSSimulator">
+                        <Operation>1</Operation>
+                    </Platform>
+                </DeployClass>
+                <DeployClass Name="iPhone_Launch2436">
+                    <Platform Name="iOSDevice32">
+                        <Operation>1</Operation>
+                    </Platform>
+                    <Platform Name="iOSDevice64">
+                        <Operation>1</Operation>
+                    </Platform>
+                    <Platform Name="iOSSimulator">
+                        <Operation>1</Operation>
+                    </Platform>
+                </DeployClass>
+                <DeployClass Name="iPhone_Launch2688x1242">
+                    <Platform Name="iOSDevice32">
+                        <Operation>1</Operation>
+                    </Platform>
+                    <Platform Name="iOSDevice64">
+                        <Operation>1</Operation>
+                    </Platform>
+                    <Platform Name="iOSSimulator">
+                        <Operation>1</Operation>
+                    </Platform>
+                </DeployClass>
+                <DeployClass Name="iPhone_Launch320">
+                    <Platform Name="iOSDevice32">
+                        <Operation>1</Operation>
+                    </Platform>
+                    <Platform Name="iOSDevice64">
+                        <Operation>1</Operation>
+                    </Platform>
+                    <Platform Name="iOSSimulator">
+                        <Operation>1</Operation>
+                    </Platform>
+                </DeployClass>
+                <DeployClass Name="iPhone_Launch640">
+                    <Platform Name="iOSDevice32">
+                        <Operation>1</Operation>
+                    </Platform>
+                    <Platform Name="iOSDevice64">
+                        <Operation>1</Operation>
+                    </Platform>
+                    <Platform Name="iOSSimulator">
+                        <Operation>1</Operation>
+                    </Platform>
+                </DeployClass>
+                <DeployClass Name="iPhone_Launch640x1136">
+                    <Platform Name="iOSDevice32">
+                        <Operation>1</Operation>
+                    </Platform>
+                    <Platform Name="iOSDevice64">
+                        <Operation>1</Operation>
+                    </Platform>
+                    <Platform Name="iOSSimulator">
+                        <Operation>1</Operation>
+                    </Platform>
+                </DeployClass>
+                <DeployClass Name="iPhone_Launch750">
+                    <Platform Name="iOSDevice32">
+                        <Operation>1</Operation>
+                    </Platform>
+                    <Platform Name="iOSDevice64">
+                        <Operation>1</Operation>
+                    </Platform>
+                    <Platform Name="iOSSimulator">
+                        <Operation>1</Operation>
+                    </Platform>
+                </DeployClass>
+                <DeployClass Name="iPhone_Launch828">
+                    <Platform Name="iOSDevice32">
+                        <Operation>1</Operation>
+                    </Platform>
+                    <Platform Name="iOSDevice64">
+                        <Operation>1</Operation>
+                    </Platform>
+                    <Platform Name="iOSSimulator">
+                        <Operation>1</Operation>
+                    </Platform>
+                </DeployClass>
+                <DeployClass Name="ProjectAndroidManifest">
+                    <Platform Name="Android">
+                        <Operation>1</Operation>
+                    </Platform>
+                </DeployClass>
+                <DeployClass Name="ProjectiOSDeviceDebug">
+                    <Platform Name="iOSDevice32">
+                        <RemoteDir>..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF</RemoteDir>
+                        <Operation>1</Operation>
+                    </Platform>
+                    <Platform Name="iOSDevice64">
+                        <RemoteDir>..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF</RemoteDir>
+                        <Operation>1</Operation>
+                    </Platform>
+                </DeployClass>
+                <DeployClass Name="ProjectiOSDeviceResourceRules"/>
+                <DeployClass Name="ProjectiOSEntitlements"/>
+                <DeployClass Name="ProjectiOSInfoPList"/>
+                <DeployClass Name="ProjectiOSResource">
+                    <Platform Name="iOSDevice32">
+                        <Operation>1</Operation>
+                    </Platform>
+                    <Platform Name="iOSDevice64">
+                        <Operation>1</Operation>
+                    </Platform>
+                    <Platform Name="iOSSimulator">
+                        <Operation>1</Operation>
+                    </Platform>
+                </DeployClass>
+                <DeployClass Name="ProjectOSXDebug"/>
+                <DeployClass Name="ProjectOSXEntitlements"/>
+                <DeployClass Name="ProjectOSXInfoPList"/>
+                <DeployClass Name="ProjectOSXResource">
+                    <Platform Name="OSX32">
+                        <RemoteDir>Contents\Resources</RemoteDir>
+                        <Operation>1</Operation>
+                    </Platform>
+                    <Platform Name="OSX64">
+                        <RemoteDir>Contents\Resources</RemoteDir>
+                        <Operation>1</Operation>
+                    </Platform>
+                </DeployClass>
+                <DeployClass Required="true" Name="ProjectOutput">
+                    <Platform Name="Android">
+                        <RemoteDir>library\lib\armeabi-v7a</RemoteDir>
+                        <Operation>1</Operation>
+                    </Platform>
+                    <Platform Name="iOSDevice32">
+                        <Operation>1</Operation>
+                    </Platform>
+                    <Platform Name="iOSDevice64">
+                        <Operation>1</Operation>
+                    </Platform>
+                    <Platform Name="iOSSimulator">
+                        <Operation>1</Operation>
+                    </Platform>
+                    <Platform Name="Linux64">
+                        <Operation>1</Operation>
+                    </Platform>
+                    <Platform Name="OSX32">
+                        <Operation>1</Operation>
+                    </Platform>
+                    <Platform Name="OSX64">
+                        <Operation>1</Operation>
+                    </Platform>
+                    <Platform Name="Win32">
+                        <Operation>0</Operation>
+                    </Platform>
+                </DeployClass>
+                <DeployClass Name="ProjectUWPManifest">
+                    <Platform Name="Win32">
+                        <Operation>1</Operation>
+                    </Platform>
+                    <Platform Name="Win64">
+                        <Operation>1</Operation>
+                    </Platform>
+                </DeployClass>
+                <DeployClass Name="UWP_DelphiLogo150">
+                    <Platform Name="Win32">
+                        <RemoteDir>Assets</RemoteDir>
+                        <Operation>1</Operation>
+                    </Platform>
+                    <Platform Name="Win64">
+                        <RemoteDir>Assets</RemoteDir>
+                        <Operation>1</Operation>
+                    </Platform>
+                </DeployClass>
+                <DeployClass Name="UWP_DelphiLogo44">
+                    <Platform Name="Win32">
+                        <RemoteDir>Assets</RemoteDir>
+                        <Operation>1</Operation>
+                    </Platform>
+                    <Platform Name="Win64">
+                        <RemoteDir>Assets</RemoteDir>
+                        <Operation>1</Operation>
+                    </Platform>
+                </DeployClass>
+                <ProjectRoot Platform="iOSDevice64" Name="$(PROJECTNAME).app"/>
+                <ProjectRoot Platform="Win64" Name="$(PROJECTNAME)"/>
+                <ProjectRoot Platform="iOSDevice32" Name="$(PROJECTNAME).app"/>
+                <ProjectRoot Platform="Linux64" Name="$(PROJECTNAME)"/>
+                <ProjectRoot Platform="Win32" Name="$(PROJECTNAME)"/>
+                <ProjectRoot Platform="OSX32" Name="$(PROJECTNAME)"/>
+                <ProjectRoot Platform="Android" Name="$(PROJECTNAME)"/>
+                <ProjectRoot Platform="OSX64" Name="$(PROJECTNAME)"/>
+                <ProjectRoot Platform="iOSSimulator" Name="$(PROJECTNAME).app"/>
+            </Deployment>
+            <ModelSupport>False</ModelSupport>
+        </BorlandProject>
+        <ProjectFileVersion>12</ProjectFileVersion>
+    </ProjectExtensions>
+    <Import Project="$(BDS)\Bin\CodeGear.Delphi.Targets" Condition="Exists('$(BDS)\Bin\CodeGear.Delphi.Targets')"/>
+    <Import Project="$(APPDATA)\Embarcadero\$(BDSAPPDATABASEDIR)\$(PRODUCTVERSION)\UserTools.proj" Condition="Exists('$(APPDATA)\Embarcadero\$(BDSAPPDATABASEDIR)\$(PRODUCTVERSION)\UserTools.proj')"/>
+    <Import Project="$(MSBuildProjectName).deployproj" Condition="Exists('$(MSBuildProjectName).deployproj')"/>
+</Project>
diff --git a/Source/php4delphi.pas b/Source/php4delphi.pas
index c999320..e3381b0 100644
--- a/Source/php4delphi.pas
+++ b/Source/php4delphi.pas
@@ -66,7 +66,7 @@ interface
   VCL.Dialogs,
   {$endif}
 {$ifend}
-  {$ENDIF}
+  {$ifend}
   PHPCommon,
   {$if CompilerVersion > 21}
   WinApi.WinSock,
@@ -1705,13 +1705,22 @@ procedure TPHPEngine.PrepareEngine;
 
   FLibraryModule.request_shutdown_func := @rshutdown;
   FLibraryModule.request_startup_func := @rinit;
+  {$if defined(PHP5) and not defined(PHP520)}
+  FLibraryModule.global_id := 0;
+  {$ifend}
 
   FLibraryModule.module_started := 0;
   FLibraryModule._type := MODULE_PERSISTENT;
 
   FLibraryModule.Handle := nil;
   FLibraryModule.module_number := 0;
-  FLibraryModule.build_id := DupStr(zend_pchar(ZEND_MODULE_BUILD_ID));
+  {$ifdef PHP530}
+    {$ifndef COMPILER_VC9}
+    FLibraryModule.build_id := strdup(PAnsiChar(ZEND_MODULE_BUILD_ID));
+    {$else}
+    FLibraryModule.build_id := DupStr(zend_pchar(ZEND_MODULE_BUILD_ID));
+    {$endif}
+  {$endif}
 end;
 
 procedure TPHPEngine.RegisterConstants;
diff --git a/Source/phpModules.pas b/Source/phpModules.pas
index fdff4f1..43629c7 100644
--- a/Source/phpModules.pas
+++ b/Source/phpModules.pas
@@ -466,7 +466,15 @@ constructor TPHPExtension.Create(AOwner: TComponent);
     try
       if Assigned(OnCreate) and OldCreateOrder then OnCreate(Self);
     except
-      Forms.Application.HandleException(Self);
+    {$if defined(VCL) and (CompilerVersion > 21)}
+     VCL.Forms
+     {$elseif defined(FMX)}
+     FMX.Forms
+     {$elseif defined(KYLIX)}
+     QForms
+     {$elseif defined(VCL) or defined(LCL)}
+     Forms
+     {$ifend}.Application.HandleException(Self);
     end;
   end;
 end;
@@ -477,9 +485,33 @@ constructor TPHPExtension.Create(AOwner: TComponent);
 procedure DoneVCLApplication;
 begin
   try
-   Forms.Application.OnException := nil;
+    {$if defined(VCL) and (CompilerVersion > 21)}
+     VCL.Forms
+     {$elseif defined(FMX)}
+     FMX.Forms
+     {$elseif defined(KYLIX)}
+     QForms
+     {$elseif defined(VCL) or defined(LCL)}
+     Forms
+     {$ifend}.Application.OnException := nil;
    {$IFDEF WINDOWS}
-   if Forms.Application.Handle <> 0 then ShowOwnedPopups(Forms.Application.Handle, False);
+   if {$if defined(VCL) and (CompilerVersion > 21)}
+     VCL.Forms
+     {$elseif defined(FMX)}
+     FMX.Forms
+     {$elseif defined(KYLIX)}
+     QForms
+     {$elseif defined(VCL) or defined(LCL)}
+     Forms
+     {$ifend}.Application.Handle <> 0 then ShowOwnedPopups({$if defined(VCL) and (CompilerVersion > 21)}
+     VCL.Forms
+     {$elseif defined(FMX)}
+     FMX.Forms
+     {$elseif defined(KYLIX)}
+     QForms
+     {$elseif defined(VCL) or defined(LCL)}
+     Forms
+     {$ifend}.Application.Handle, False);
    {$ELSE}
    Forms.Application.ShowHint := False;
    Forms.Application.Destroying;
@@ -617,7 +649,15 @@ procedure TPHPApplication.OnExceptionHandler(Sender: TObject;
 
 procedure TPHPApplication.Run;
 begin
-  Forms.Application.OnException := OnExceptionHandler;
+  {$if defined(VCL) and (CompilerVersion > 21)}
+     VCL.Forms
+     {$elseif defined(FMX)}
+     FMX.Forms
+     {$elseif defined(KYLIX)}
+     QForms
+     {$elseif defined(VCL) or defined(LCL)}
+     Forms
+     {$ifend}.Application.OnException := OnExceptionHandler;
 end;
 
 

From ded67100209d2a0c2332f8fe15e1728e5745ac9b Mon Sep 17 00:00:00 2001
From: lion <ZeLev@pm.me>
Date: Sun, 19 Jul 2020 00:50:23 +0300
Subject: [PATCH 32/35] Update README.md

---
 README.md | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/README.md b/README.md
index 353fc1e..5821c1d 100644
--- a/README.md
+++ b/README.md
@@ -4,7 +4,7 @@ PHP - Delphi interface and PHP extensions development framework
 
 { $Id: readme.txt,v 7.4 07/2020 delphi32 Exp $ } 
 
-PHP4Delphi is a Delphi interface to PHP for Delphi {2007, ..., Berlin}
+PHP4Delphi is a Delphi interface to PHP for Delphi {2009, ..., Rio}
 
 PHP4Delphi consists of 3 big subprojects:
 
@@ -30,11 +30,13 @@ More detail information available in php4Delphi manual php4Delphi.pdf
 
 
 This is a source-only release of php4Delphi. It includes
-design-time and run-time packages for Delphi 2007 through Delphi Berlin
+design-time and run-time packages for Delphi 2009 through Delphi Rio
 
 
 
 # History
+7.5-rc1 2020
+* Compatible with Delphi 2009, 10.1 Seattle, 10.2 Berlin, 10.3 Tokyo
 
 7.4 Mar 2019
 

From fd9e4a860555b4489d3e7fffbb169ee735f16f8f Mon Sep 17 00:00:00 2001
From: lion <ZeLev@pm.me>
Date: Mon, 20 Jul 2020 02:25:48 +0300
Subject: [PATCH 33/35] Update README.md

---
 README.md | 311 ++++++++++++++++--------------------------------------
 1 file changed, 90 insertions(+), 221 deletions(-)

diff --git a/README.md b/README.md
index 5821c1d..9df90e1 100644
--- a/README.md
+++ b/README.md
@@ -8,246 +8,115 @@ PHP4Delphi is a Delphi interface to PHP for Delphi {2009, ..., Rio}
 
 PHP4Delphi consists of 3 big subprojects:
 
-1. PHP scripting (using PHP as a scripting language in Delphi applications)
-PHP4Delphi allows to execute the PHP scripts within the Delphi program using 
-TpsvPHP component directly without a WebServer. 
-It is a PHP extension that enables you to write client-side GUI applications. 
-One of the goals behind it was to prove that PHP is a capable general-purpose scripting 
-language that is suited for more than just Web applications. 
-It is used by "Delphi for PHP" from CodeGear.
+1. PHP scripting (using PHP as a scripting language in Delphi applications) <br>
+PHP4Delphi allows to execute the PHP scripts within the Delphi program using <br>
+TpsvPHP component directly without a WebServer.  <br>
+It is a PHP extension that enables you to write client-side GUI applications.  <br>
+One of the goals behind it was to prove that PHP is a capable general-purpose scripting <br> 
+language that is suited for more than just Web applications.  <br>
+It is used by "Delphi for PHP" from CodeGear. <br>
 
-2. PHP extensions development framework (using Delphi to extend PHP functionality)
-Visual Development Framework gives possibility to create custom PHP
-Extensions using Delphi. 
-PHP extension, in the most basic of terms, is a set of instructions that is
-designed to add functionality to PHP.
+2. PHP extensions development framework (using Delphi to extend PHP functionality) <br>
+Visual Development Framework gives possibility to create custom PHP <br>
+Extensions using Delphi.  <br>
+PHP extension, in the most basic of terms, is a set of instructions that is <br>
+designed to add functionality to PHP. <br>
 
-3. PHP4Applications (integrate PHP in any application)
-Supports C, C++, Visual Basic, VBA, C#, Delphi, Delphi .NET, Visual Basic .NET etc. 
+3. PHP4Applications (integrate PHP in any application) <br>
+Supports C, C++, Visual Basic, VBA, C#, Delphi, Delphi .NET, Visual Basic .NET etc. <br> 
 
 
-More detail information available in php4Delphi manual php4Delphi.pdf
+More detail information available in <a href="/documentation/php4Delphi.pdf">php4Delphi manual php4Delphi.pdf</a>
 
 
-This is a source-only release of php4Delphi. It includes
-design-time and run-time packages for Delphi 2009 through Delphi Rio
+This is a source-only release of php4Delphi. <br>
+It includes design-time and run-time packages for Delphi 2009 through Delphi Rio <br> <br>
 
-
-
-# History
-7.5-rc1 2020
+# Features
 * Compatible with Delphi 2009, 10.1 Seattle, 10.2 Berlin, 10.3 Tokyo
+* PHP 5.0.0 - 5.6.x support
+* Unicode support ( php 5.5 & up )
+<br> <a href="versions.md">Version history</a>
 
-7.4 Mar 2019
-
-* Compatible with PHP 5.5.0
-* Compatible with PHP 5.6.0
-* Compatible with PHP 5.6.x
-* Compatible with Delphi 2011, XE8, Seattle, Berlin
-* Added unicode support
-
-7.3 Jan 2019
-
-* Compatible with PHP 5.4.0
-
-7.2 Oct 2009
-
-* Compatible with Delphi 2010
-* Compatible with PHP 5.2.11
-* Compatible with PHP 5.3.0 (VC6 and VC9 editions : see PHP.INC for more details)
-
-7.1 Oct 2008
-
-* Compatible with Delphi 2009
-
-7.0 Apr 2007
-
-* Compatible with Delphi 2007
-* Compatible with PHP 5.2.1
-* Compatible with PHP 4.4.6
-* Thread safe TpsvPHP component
-* New component TPHPEngine introduced
-* RunCode method reimplemented to solve "black horror" of pipes.
-* Not fully compatible with previous version due to multithreading, but migration is easy.
-
-6.2 Feb 2006
-
-* Compatible with PHP 5.2.0
-* Compatible with Delphi 2006
-* Compatible with PHP 5.1.1
-* Compatible with PHP 5.1.2
-* Code reorganized, some crap was removed
-* Added headers support (Michael Maroszek)
-* New demo projects
-* PHP4Applications revisited
-
-6.1
-
-* Compatible with PHP 5.0.4
-* Compatible with PHP 5.1.0b3
-* Compatible with Delphi 2005
-
-6.0
-
-* Translated Zend II API
-* New PHP Object Model support
-* PHP classes support for PHP4 and PHP5
-* New demo projects
-* TPHPClass component compatible with PHP4 and PHP5
-* Added new property DLLFolder to psvPHP component
-* New component PHPSystemLibrary
-
-5.5 fix 1
-
-* New property RegisterGlobals (boolean) added to psvPHP component
-* New property MaxExecutionTime (integer) added to psvPHP component - Maximum execution time of each script, in seconds
-* New property MaxInputTime (integer) added to psvPHP component - Maximum amount of time each script may spend parsing request data
-* New property SafeMode (boolean) added to psvPHP component
-* New property SafeModeGid (boolean) added to psvPHP component -  When safe_mode is on, UID/GID checks are bypassed when
-  including files from this directory and its subdirectories. (directory must also be in include_path or full path must
-  be used when including)
-* Memory leak fixed in phpModules unit
-* php_class demo project errors fixed
-* psvPHP can load now PHP modules using dl() function
-
-5.5
-
-* New component TPHPClass added (only for PHP 4)
-* Added support of PHP 5
-* Improved speed of unloading of the PHP extensions under Apache 
-* Decreased size of the compiled modules (based on API only and developed using Visual FrameWork)
-* ZendAPI unit is splitted to ZendAPI and ZendTypes units
-* PHPAPI unit is splitted to  PHPAPI and PHPTypes units
-* New version of php4App - php4Applications subproject. 
-  php4Applications allows to use php scripts in VB, C, C++, etc applications.
-  Demo projects for Delphi, VC and MS Word included.
-* New property UseDelimiters added to TpsvPHP component. If UseDelimiters = true (by default) the
-  syntax of RunCode method parameter ACode should include standard script delimiters "<?" and "?>"
-  to make RunCode and Execute method compatible.
-* New parameters for OnScriptError event (error type, file name and line number)
-
-5.4
-
-* Minor bugs fixed
-* Documentation improved 
-* New property IniPath (folder where php.ini located) added to TpsvPHP component
-* New functions translated in ZendAPI unit
-
-5.3
-* Added new public property ExecuteMethod to psvPHP component. 
-  if ExecuteMethod is emGet, psvPHP receives variables as $_GET["variable"],
-  if ExecuteMethod is emServer (default), psvPHP receives variables as $variable.
-  Can be used to debug real PHP scripts with GET parameters.
-* Added possibility to access published property of Delphi components from PHP
-* Fixed problem with loading of PHP extension compiled wihout PHP4DELPHI_AUTOLOAD
-  option.
-
-5.2
-* Added dynamic attachement of all exported functions from php4ts.dll
-  in PHPAPI.pas
-* New function for safe dynamic functions linking PHPStubInit and ZendStubInit
-  This functions can be used if you are planning to work with beta-version of PHP,
-  for example
-* New unit zend_dynamic_array.pas
-* New unit logos.pas
-
-5.0.3
-* Fixed bug when php function without parameters does not return value.
-* New classes: TZendVariable and TZendValue in  phpFunctions.pas
-* New subproject: php4App
-  Using php4App you can integrate PHP not only with Delphi, but with VB, for example
-
-5.0.2 
-* Fixed problem with assembler code in ZENDAPI.pas for Delphi 7
-
-5.0.1
-* Fixed problem with number of parameters of zend_getparameters_ex function
-
-5.0
-* First version written in Delphi
-
-
-1.0 - 4.0  
-* php4Delphi was written in C as a DLL with simple Delphi wrapper
- 
 # Prerequisites
-Before using php4Delphi library:
-
-If you have no PHP installed, you have to download and 
-install PHP separately. It is not included in the package.
-You can download the latest version of PHP from
-http://www.php.net/downloads.php
-
-ZEND API documentation available at http://www.zend.com
-PHP  API documentation available at http://www.php.net
-
-You need to ensure that the dlls which php uses can be found. 
-php4ts.dll is always used. If you are using any php extension dlls then you
-will need those as well. 
-To make sure that the dlls can be found, you can either copy them to the 
-system directory (e.g. winnt/system32 or  windows/system).
-
-Copy the file, php.ini-dist to your %WINDOWS% directory on
-Windows 95/98 or to your %SYSTEMROOT% directory under Windows NT,
-Windows 2000 or Windows XP and rename it to php.ini. Your %WINDOWS% or
-%SYSTEMROOT% directory is typically:
-c:\windows for Windows 95/98
-c:\winnt or c:\winnt40 for NT/2000/XP servers
+Before using php4Delphi library: <br>
+
+If you have no PHP installed, you have to download and  <br>
+install PHP separately. It is not included in the package. <br>
+You can download the latest version of PHP from <br>
+https://php.net/downloads/ <br>
+or <br>
+https://windows.php.net/downloads/releases/archives/ <br>
+
+ZEND API documentation available at http://www.zend.com <br>
+PHP  API documentation available at http://www.php.net <br>
+
+You need to ensure that the dlls which php uses can be found. <br> 
+php5ts.dll is always used. If you are using any php extension dlls then you <br>
+will need those as well.  <br>
+To make sure that the dlls can be found, you can either copy them to the  <br>
+system directory (e.g. winnt/system32 or  windows/system). <br>
+
+Copy the file, php.ini-release to your php installation path <br>
+and rename it to php.ini. By default php is located in  <br>
+%WINDOWS% or %SYSTEMROOT% directory: <br>
+c:\windows for Windows <br>
+c:\winnt or c:\winnt40 for NT/2000/XP servers <br>
 
 # Building
-Uninstall previous installed version of php4Delphi Library from Delphi IDE.
-Remove previously compiled php4Delphi packages from your hard disk.
-
-Select PHP version you are going to use. php4Delphi supports PHP 5.x, 
-but not at the same time. You have to compile php4Delphi for selected target version of PHP.
-
-Open PHP.INC file.
-If you are using PHP5:
-a) Uncomment (remove dot) from definition of suitable php, VC and widgetset version
-b) Uncomment (remove dot) from definition of prefered features in the feature block of the PHP.INC file
-c) Save PHP.INC file
-
-Use "File\Open..." menu item of Delphi IDE to open php4Delphi runtime
-choose suitable Runtime package php4DelphiR(Your Delphi Version).dpk; In "Package..." window click "Compile" button to
-compile packages. 
-Put compiled BPL file into directory that is accessible through the search PATH (i.e. DOS
-"PATH" environment variable; 
-for example, in the Windows\System directory).
-
-After compiling php4Delphi run-time package you must install design-time
-package into the IDE.
-
-Use "File\Open..." menu item to open design-time package php4DelphiD(Your Delphi Version).dpk
-In "Package..." window click "Compile" button to compile the package
-and then click "Install" button to register php4Delphi Library 
-components on the component palette. 
+Uninstall previous installed version of php4Delphi Library from Delphi IDE. <br>
+Remove previously compiled php4Delphi packages from your disk. <br>
+
+Select PHP version you are going to use. php4Delphi supports PHP 5.x,  <br>
+but not at the same time - this behaviour is legacy, and therefore will be removed. <br>
+You have to compile php4Delphi for selected target version of PHP. <br>
+
+a) Edit PHPver.INC file. <br>
+   Specify PHPver constant: <br>
+   PHPver = 05604; // php 5.6.4 -> 05 6 04 <br>
+b) Edit PHP.INC file. <br>
+   Remove dot from preferred features <br>
+
+Use "File\Open..." menu item of Delphi IDE to open php4Delphi group <br>
+choose suitable group from /package directory;  <br>
+In "Package..." window select php4DelphiR, <br>
+click "Compile" button to compile BPL.  <br>
+Put compiled BPL file into directory that is accessible through the search PATH  <br>
+("PATH" environment variable; <br>
+for example, in the Windows\System directory). <br>
+
+After compiling php4Delphi run-time package you must install design-time <br>
+package into the IDE. <br>
+
+In "Package..." window select php4DelphiD, <br>
+click "Compile" button to compile the package <br>
+and then click "Install" button to install php4Delphi components. <br>
 
 # Credits
 
-Since this is a freeware you are strongly encouraged to look 
-at the source code and improve on the components if you want to. 
-Of course I would appreciate it if you would send me back the 
-changes and bug fixes you have made. 
+Since this is a freeware you are strongly encouraged to look  <br>
+at the source code and improve on the components if you want to.  <br>
+Of course we would appreciate if you create pull request with the  <br>
+changes and bug fixes you have made.  <br>
 
-For more information on the PHP Group and the PHP project,
-please see <http://www.php.net>.
+For more information on the PHP Group and the PHP project, <br>
+please see <http://www.php.net>. <br>
 
 
-PHP4Delphi forum
-http://sourceforge.net/forum/forum.php?forum_id=324242
+PHP4Delphi forum <br>
+http://sourceforge.net/forum/forum.php?forum_id=324242  <br>
 
-Authors:                                              
-Serhiy Perevoznyk                                     
-Belgium
-serge_perevoznyk@hotmail.com
-http://users.telenet.be/ws36637
-http://delphi32.blogspot.com
+Authors: <br>                                              
+Serhiy Perevoznyk <br>                                 
+Belgium <br>
+serge_perevoznyk@hotmail.com <br>
+http://users.telenet.be/ws36637  <br>
+http://delphi32.blogspot.com  <br>
 
-Lew Zienin
-Poland
-levzenin@pm.me
+Lew Zienin  <br>
+Ukraine  <br>
+levzenin@pm.me  <br>
 
-Nikita Ganzikov
-Ukraine
+Nikita Ganzikov  <br>
+Ukraine  <br>
 pig-l@mail.ru
-

From 4440f17a4052e8d8979a30bf3c96e9c0ff5aea3f Mon Sep 17 00:00:00 2001
From: lion <ZeLev@pm.me>
Date: Mon, 20 Jul 2020 02:43:10 +0300
Subject: [PATCH 34/35] Create versions.md

---
 versions.md | 141 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 141 insertions(+)
 create mode 100644 versions.md

diff --git a/versions.md b/versions.md
new file mode 100644
index 0000000..9af88d4
--- /dev/null
+++ b/versions.md
@@ -0,0 +1,141 @@
+## 7.5-rc1
+* Some of the ZVAL_*Type procedures moved:
+  ZVAL_*Type -> ZVALVAL( z: pzval, what: Type )
+* Major bug fixes (AV, Range Checking, NullPointer, php executing order, etc.)
+* Introduced metatypes, so the types can be used regardless of Delphi version (x64/32, dcc version, other)
+* Replaced assembler calls with pointer math
+* Added procedures: <br> HFunc - hook library function <br> LFunc - load library function
+
+## 7.4 Mar 2019
+
+* Compatible with PHP 5.5.0
+* Compatible with PHP 5.6.0
+* Compatible with PHP 5.6.x
+* Compatible with Delphi 2011, XE8, Seattle, Berlin
+* Added unicode support
+
+## 7.3 Jan 2019
+
+* Compatible with PHP 5.4.0
+* Removed PHP 4 support
+
+## 7.2 Oct 2009
+
+* Compatible with Delphi 2010
+* Compatible with PHP 5.2.11
+* Compatible with PHP 5.3.0 (VC6 and VC9 editions : see PHP.INC for more details)
+
+## 7.1 Oct 2008
+
+* Compatible with Delphi 2009
+
+## 7.0 Apr 2007
+
+* Compatible with Delphi 2007
+* Compatible with PHP 5.2.1
+* Compatible with PHP 4.4.6
+* Thread safe TpsvPHP component
+* New component TPHPEngine introduced
+* RunCode method reimplemented to solve "black horror" of pipes.
+* Not fully compatible with previous version due to multithreading, but migration is easy.
+
+## 6.2 Feb 2006
+
+* Compatible with PHP 5.2.0
+* Compatible with Delphi 2006
+* Compatible with PHP 5.1.1
+* Compatible with PHP 5.1.2
+* Code reorganized, some crap was removed
+* Added headers support (Michael Maroszek)
+* New demo projects
+* PHP4Applications revisited
+
+## 6.1
+
+* Compatible with PHP 5.0.4
+* Compatible with PHP 5.1.0b3
+* Compatible with Delphi 2005
+
+## 6.0
+
+* Translated Zend II API
+* New PHP Object Model support
+* PHP classes support for PHP4 and PHP5
+* New demo projects
+* TPHPClass component compatible with PHP4 and PHP5
+* Added new property DLLFolder to psvPHP component
+* New component PHPSystemLibrary
+
+## 5.5 fix 1
+
+* New property RegisterGlobals (boolean) added to psvPHP component
+* New property MaxExecutionTime (integer) added to psvPHP component - Maximum execution time of each script, in seconds
+* New property MaxInputTime (integer) added to psvPHP component - Maximum amount of time each script may spend parsing request data
+* New property SafeMode (boolean) added to psvPHP component
+* New property SafeModeGid (boolean) added to psvPHP component -  When safe_mode is on, UID/GID checks are bypassed when
+  including files from this directory and its subdirectories. (directory must also be in include_path or full path must
+  be used when including)
+* Memory leak fixed in phpModules unit
+* php_class demo project errors fixed
+* psvPHP can load now PHP modules using dl() function
+
+## 5.5
+
+* New component TPHPClass added (only for PHP 4)
+* Added support of PHP 5
+* Improved speed of unloading of the PHP extensions under Apache 
+* Decreased size of the compiled modules (based on API only and developed using Visual FrameWork)
+* ZendAPI unit is splitted to ZendAPI and ZendTypes units
+* PHPAPI unit is splitted to  PHPAPI and PHPTypes units
+* New version of php4App - php4Applications subproject. 
+  php4Applications allows to use php scripts in VB, C, C++, etc applications.
+  Demo projects for Delphi, VC and MS Word included.
+* New property UseDelimiters added to TpsvPHP component. If UseDelimiters = true (by default) the
+  syntax of RunCode method parameter ACode should include standard script delimiters "<?" and "?>"
+  to make RunCode and Execute method compatible.
+* New parameters for OnScriptError event (error type, file name and line number)
+
+## 5.4
+
+* Minor bugs fixed
+* Documentation improved 
+* New property IniPath (folder where php.ini located) added to TpsvPHP component
+* New functions translated in ZendAPI unit
+
+## 5.3
+* Added new public property ExecuteMethod to psvPHP component. 
+  if ExecuteMethod is emGet, psvPHP receives variables as $_GET["variable"],
+  if ExecuteMethod is emServer (default), psvPHP receives variables as $variable.
+  Can be used to debug real PHP scripts with GET parameters.
+* Added possibility to access published property of Delphi components from PHP
+* Fixed problem with loading of PHP extension compiled wihout PHP4DELPHI_AUTOLOAD
+  option.
+
+## 5.2
+* Added dynamic attachement of all exported functions from php4ts.dll
+  in PHPAPI.pas
+* New function for safe dynamic functions linking PHPStubInit and ZendStubInit
+  This functions can be used if you are planning to work with beta-version of PHP,
+  for example
+* New unit zend_dynamic_array.pas
+* New unit logos.pas
+
+## 5.0.3
+* Fixed bug when php function without parameters does not return value.
+* New classes: TZendVariable and TZendValue in  phpFunctions.pas
+* New subproject: php4App
+  Using php4App you can integrate PHP not only with Delphi, but with VB, for example
+
+## 5.0.2 
+* Fixed problem with assembler code in ZENDAPI.pas for Delphi 7
+
+## 5.0.1
+* Fixed problem with number of parameters of zend_getparameters_ex function
+
+## 5.0
+* First version written in Delphi
+
+
+## 1.0 - 4.0  
+* php4Delphi was written in C as a DLL with simple Delphi wrapper
+ 

From aefc942ba993133b1b5e574ec30aef551a01d1a1 Mon Sep 17 00:00:00 2001
From: Leo <ZeLev@pm.me>
Date: Mon, 20 Jul 2020 15:16:39 +0300
Subject: [PATCH 35/35] Update README.md

---
 README.md | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/README.md b/README.md
index 9df90e1..216be78 100644
--- a/README.md
+++ b/README.md
@@ -22,7 +22,7 @@ Extensions using Delphi.  <br>
 PHP extension, in the most basic of terms, is a set of instructions that is <br>
 designed to add functionality to PHP. <br>
 
-3. PHP4Applications (integrate PHP in any application) <br>
+3. <a href="https://github.com/suwermave/php4delphi/tree/bin/php4application">PHP4Applications (integrate PHP in any application)</a> <br>
 Supports C, C++, Visual Basic, VBA, C#, Delphi, Delphi .NET, Visual Basic .NET etc. <br> 
 
 
