Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
5dc432b
Introduce error msg functions
mlazdans Oct 17, 2025
160738e
Pretty print
mlazdans Oct 18, 2025
0997be3
Fix field name
mlazdans Oct 19, 2025
cebccfd
Pretty print
mlazdans Oct 19, 2025
a6f3601
Increase metadata size
mlazdans Oct 22, 2025
d17269e
No need for non-const char*
mlazdans Oct 22, 2025
5724a36
Replace strlen() with sizeof()
mlazdans Oct 22, 2025
e8d2470
Quote fields
mlazdans Oct 22, 2025
a5e81aa
Add fb_get_sql_info() wrapper
mlazdans Oct 22, 2025
0c0458a
Re-anable test 005.phpt on >= 5.0
mlazdans Oct 22, 2025
436559d
Add optional transaction args
mlazdans Oct 23, 2025
7def2e2
Introduce versioning schema and create IBASE_VER constant
mlazdans Oct 23, 2025
c1c62f5
Typo
mlazdans Oct 23, 2025
13a3431
Sync with long_names_001.phpt
mlazdans Oct 23, 2025
cfa20d8
Add TODO
mlazdans Oct 24, 2025
5dd3cb3
Check connection before drop
mlazdans Oct 24, 2025
77c0e41
Set METADATALENGTH according to FB_API_VER
mlazdans Oct 24, 2025
4f2edac
Move ibase_query, ibase_array to php_ibase_includes.h; remove ibase_r…
mlazdans Oct 27, 2025
b0bfc80
Introduce _php_ibase_get_fbclient_symbol
mlazdans Oct 27, 2025
6851f29
assert FB_API_VER
mlazdans Oct 27, 2025
bb15fc6
Introduce fb_insert_aliases
mlazdans Oct 27, 2025
2feccbb
Remove stdbool.h
mlazdans Oct 27, 2025
e51da3a
Introduce _php_ibase_get_vars_count()
mlazdans Oct 27, 2025
1528cb3
Refactor _php_ibase_alloc_query
mlazdans Oct 27, 2025
7aceb55
Rename
mlazdans Oct 27, 2025
1a0a96e
Refactor ibase_execute
mlazdans Oct 27, 2025
f24057e
Refactor ibase_query
mlazdans Oct 27, 2025
91c72df
Refactor _php_ibase_fetch_hash()
mlazdans Oct 27, 2025
03dc505
Refactor ibase_name_result()
mlazdans Oct 27, 2025
a5e5fb5
Refactor ibase_num_fields(), ibase_num_params(), ibase_field_info(), …
mlazdans Oct 27, 2025
a039383
Refactor ibase_free_query(), ibase_free_result()
mlazdans Oct 27, 2025
5a4f704
Use bind_buf instead of single allocations for null indicators
mlazdans Oct 27, 2025
2f23b11
Fully zero-initialize structs
mlazdans Oct 27, 2025
6e6ae9d
Use sqlda from ib_query
mlazdans Oct 27, 2025
2f7c118
Adjust types
mlazdans Oct 27, 2025
db2bd18
Improve diagnostic msg
mlazdans Oct 27, 2025
be0a1bd
Adjust types
mlazdans Oct 27, 2025
2700ac0
Tidy up
mlazdans Oct 27, 2025
e2155f3
Correct improper field
mlazdans Oct 27, 2025
f2a30b7
Introduce fb_insert_field_info()
mlazdans Oct 28, 2025
dc5ecae
Move assertion after out_sqlda check
mlazdans Oct 28, 2025
18ab788
Bring back field's NULL checking
mlazdans Oct 28, 2025
5e99e47
Abort on isc_info_truncated
mlazdans Oct 28, 2025
aeffd3d
Restore ibase_free_result() behaviour
mlazdans Oct 28, 2025
16896a5
Disable notice for now
mlazdans Oct 28, 2025
39dbe8c
Keep track of trans_res
mlazdans Oct 29, 2025
7a44bbd
Add more transaction tests
mlazdans Oct 29, 2025
96ab6e8
More transaction tests
mlazdans Oct 30, 2025
3b15999
Add use after free tests
mlazdans Oct 30, 2025
c65479b
Update comments
mlazdans Oct 30, 2025
b9f63cf
Merge branch 'master' into ibase_result
mlazdans Oct 30, 2025
01e2ff5
Skip tests/use_after_free-002.phpt for PHP version < 8
mlazdans Oct 30, 2025
103b4c6
Refactor out inner loops in php-fb-build.bat
mlazdans Nov 5, 2025
4f23140
Fix nts check
mlazdans Nov 6, 2025
e5843f3
Fix variable names
mlazdans Nov 6, 2025
266a4a5
Add PFB_CONFIGURE_FLAGS config
mlazdans Nov 6, 2025
23e2a4b
Add PHP_INTERBASE_VER_PRE tag
mlazdans Nov 6, 2025
58a74b8
Add flags argument
mlazdans Nov 6, 2025
27265a5
Introduce ibase_get_client_version()
mlazdans Nov 6, 2025
6313db4
Add some tests
mlazdans Nov 6, 2025
cb0a577
Cap negative XSQLVAR lengths (#87)
mlazdans Nov 6, 2025
4d459ff
Don't depend on fb_get_master_interface() and fb_get_statement_interf…
mlazdans Nov 6, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 14 additions & 8 deletions build_scripts/php-fb-build-all.bat
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
@echo off

call %~dp0php-fb-build.bat php-7.3.33 vc15 || exit %ERRORLEVEL%
call %~dp0php-fb-build.bat php-7.4.13 vc15 || exit %ERRORLEVEL%
call %~dp0php-fb-build.bat php-8.0.30 vs16 || exit %ERRORLEVEL%
call %~dp0php-fb-build.bat php-8.1.33 vs16 || exit %ERRORLEVEL%
call %~dp0php-fb-build.bat php-8.2.29 vs16 || exit %ERRORLEVEL%
call %~dp0php-fb-build.bat php-8.3.26 vs16 || exit %ERRORLEVEL%
call %~dp0php-fb-build.bat php-8.4.13 vs17 || exit %ERRORLEVEL%
call %~dp0php-fb-build.bat php-8.5.0RC2 vs17 || exit %ERRORLEVEL%
set "phps="php-7.4.13 vc15" "php-8.0.30 vs16" "php-8.1.33 vs16" "php-8.2.29 vs16" "php-8.3.26 vs16" "php-8.4.13 vs17" "php-8.5.0RC2 vs17""

setlocal enabledelayedexpansion
for %%p in (%phps%) do (
for /f "tokens=1,2" %%a in (%%p) do (
set php_vers=%%a
set cpp_vers=%%b
call %~dp0php-fb-build.bat !php_vers! !cpp_vers! 1 x64 || exit %ERRORLEVEL%
call %~dp0php-fb-build.bat !php_vers! !cpp_vers! 0 x64 || exit %ERRORLEVEL%
call %~dp0php-fb-build.bat !php_vers! !cpp_vers! 1 x86 || exit %ERRORLEVEL%
call %~dp0php-fb-build.bat !php_vers! !cpp_vers! 0 x86 || exit %ERRORLEVEL%
)
)
endlocal
164 changes: 74 additions & 90 deletions build_scripts/php-fb-build.bat
Original file line number Diff line number Diff line change
@@ -1,128 +1,112 @@
@echo off
@REM php-fb-build.bat <pfb_php_tag> <pfb_cpp_vers> <pfb_ts> <pfb_arch>
@REM php-fb-build.bat php-7.4.13 vc15 [0|1] [x64|x86]
@REM

@REM config ======================================================================================
call %~dp0php-fb-config.bat

goto :MAIN

@REM log =========================================================================================
@REM log <msg>
@REM example> call :log "<msg>"
:log
set msg=%~1
echo ---------------------------------------------------------------------
echo %msg%
echo ---------------------------------------------------------------------
exit /B

@REM usage =======================================================================================
:usage
call :log "Usage: %~nx0 php_tag cpp_vers"
exit /B

@REM validate_build ===============================================================================
@REM validate_build <path_to_php_exe>:string <arch>:string <ts>:int
:validate_build
setlocal disabledelayedexpansion
set vb_php=%~1
set vb_arch=%~2
set vb_ts=%~3

set vb_check_code=^
if(!extension_loaded('interbase')){ print \"Extension not loaded\n\"; exit(1); }^
if('php-'.PHP_VERSION != '%pfb_php_tag%'){ printf(\"Version mismatch: expected '%pfb_php_tag%', but got '%%s' \n\", 'php-'.PHP_VERSION); exit(1); }^
if((int)ZEND_THREAD_SAFE != %vb_ts%){ printf(\"Thread Safety mismatch: expected %vb_ts%, but got %%d \n\", ZEND_THREAD_SAFE); exit(1); }^
if((PHP_INT_SIZE == 8 ? 'x64' : 'x86') != '%vb_arch%'){ printf(\"Architecture mismatch: expected '%vb_arch%', but got '%%s' \n\", (PHP_INT_SIZE == 8 ? 'x64' : 'x86')); exit(1); }

if "%vb_arch%" == "x86" (
set vb_libs=%PFB_FB32_DIR%
) else (
set vb_libs=%PFB_FB64_DIR%
)

call :log "Validating %pfb_php_tag% %vb_arch% Thread Safety %vb_ts%"

set vb_cmd=cmd /c set "PATH=%vb_libs%;%PATH%" %php_exe% -dextension=.\php_interbase.dll -r "%vb_check_code%"
%vb_cmd% || exit /B 1

echo Validated OK
echo ---------------------------------------------------------------------

exit /B

:MAIN

set pfb_php_tag=%1
set pfb_cpp_vers=%2
set pfb_ts=%3
set pfb_arch=%4

if "%pfb_php_tag%" == "" (
call :log "pfb_php_tag varible not set"
call :usage
echo pfb_php_tag varible not set
exit 1
)

if "%pfb_cpp_vers%" == "" (
call :log "pfb_cpp_vers varible not set"
call :usage
echo pfb_cpp_vers varible not set
exit 1
)

if "%pfb_ts%" == "1" (
set pfb_ts=1
) else (
set pfb_ts=0
)

if not "%pfb_arch%" == "x86" (
set pfb_arch=x64
)

@REM Convert php-8.4.13 -> 8.4
for /f "tokens=2,3 delims=-." %%a in ("%pfb_php_tag%") do set pfb_php_vers=%%a.%%b

if "%pfb_php_vers%" == "" (
echo BUG: pfb_php_vers should be set at this point
call :log "BUG: pfb_php_vers should be set at this point"
exit 1
)

set pfb_build_root=php%pfb_php_vers%\%pfb_cpp_vers%\
@REM Initialize
set php_root=php%pfb_php_vers%\%pfb_cpp_vers%\%pfb_arch%\php-src\
set php_interbase=php_interbase-%PFB_VERS%-%pfb_php_vers%-%pfb_cpp_vers%

(for %%a in (x64 x86) do (
set pfb_arch=%%a
if not exist "%php_root%.git\" (
call :log "Cloning %pfb_php_tag% %pfb_arch%"
call phpsdk-%pfb_cpp_vers%-%pfb_arch%.bat -t %~dp0php-fb-sdk-init.bat || goto :error
)

if not exist "%pfb_build_root%\%%a\php-src\.git\" (
call :log "Cloning %pfb_php_tag% %%a"
call phpsdk-%pfb_cpp_vers%-%%a.bat -t %~dp0php-fb-sdk-init.bat || goto :error
)
if "%pfb_arch%" == "x86" (
set build_root=%php_root%
set php_interbase=%php_interbase%-x86
) else (
set build_root=%php_root%x64\
)

if "%%a" == "x86" (
set php_exe_arch=%pfb_build_root%%%a\php-src\
) else (
set php_exe_arch=%pfb_build_root%%%a\php-src\x64\
)
if %pfb_ts% equ 1 (
set build_root=%build_root%Release_TS\
) else (
set build_root=%build_root%Release\
set php_interbase=%php_interbase%-nts
)

setlocal enabledelayedexpansion
(for %%t in (0 1) do (
set pfb_ts=%%t
if "%%t" equ "1" (
set php_exe="!php_exe_arch!Release_TS\php.exe"
) else (
set php_exe="!php_exe_arch!Release\php.exe"
)
@REM Build
call :log "Building %php_interbase%.dll..."
call phpsdk-%pfb_cpp_vers%-%pfb_arch%.bat -t %~dp0php-fb-sdk-build.bat || goto :error

if "!php_exe!" == "" (
echo BUG: php_exe should be set at this point
exit 1
)
@REM Validate
set vb_check_code=^
if(!extension_loaded('interbase')){ print \"Extension not loaded\n\"; exit(1); }^
if('php-'.PHP_VERSION != '%pfb_php_tag%'){ printf(\"Version mismatch: expected '%pfb_php_tag%', but got '%%s' \n\", 'php-'.PHP_VERSION); exit(1); }^
if((int)ZEND_THREAD_SAFE != %pfb_ts%){ printf(\"Thread Safety mismatch: expected %pfb_ts%, but got %%d \n\", ZEND_THREAD_SAFE); exit(1); }^
if((PHP_INT_SIZE == 8 ? 'x64' : 'x86') != '%pfb_arch%'){ printf(\"Architecture mismatch: expected '%pfb_arch%', but got '%%s' \n\", (PHP_INT_SIZE == 8 ? 'x64' : 'x86')); exit(1); }

call phpsdk-%pfb_cpp_vers%-%%a.bat -t %~dp0php-fb-sdk-build.bat || goto :error
if "%pfb_arch%" == "x86" (
set vb_libs=%PFB_FB32_DIR%
) else (
set vb_libs=%PFB_FB64_DIR%
)

call :validate_build !php_exe! !pfb_arch! !pfb_ts! || goto :error
))
))
call :log "Validating %php_interbase%.dll..."
set vb_cmd=cmd /c set "PATH=%vb_libs%;%PATH%" %build_root%php_exe -dextension=.\php_interbase.dll -r "%vb_check_code%"
%vb_cmd% || goto :error

echo.
call :log "%pfb_php_tag% build OK"
call :log "Copying %php_interbase%.dll..."
copy "%build_root%php_interbase.dll" "%PFB_OUTPUT_DIR%%php_interbase%.dll" || goto :error

@REM copy compiled extension to target directory
copy %pfb_build_root%x64\php-src\x64\Release_TS\php_interbase.dll %PFB_OUTPUT_DIR%php_interbase-%PFB_VERS%-%pfb_php_vers%-%pfb_cpp_vers%-x64.dll
copy %pfb_build_root%x64\php-src\x64\Release\php_interbase.dll %PFB_OUTPUT_DIR%php_interbase-%PFB_VERS%-%pfb_php_vers%-%pfb_cpp_vers%-nts-x64.dll
copy %pfb_build_root%x86\php-src\Release_TS\php_interbase.dll %PFB_OUTPUT_DIR%php_interbase-%PFB_VERS%-%pfb_php_vers%-%pfb_cpp_vers%.dll
copy %pfb_build_root%x86\php-src\Release\php_interbase.dll %PFB_OUTPUT_DIR%php_interbase-%PFB_VERS%-%pfb_php_vers%-%pfb_cpp_vers%-nts.dll
call :log "Build OK" "%pfb_php_tag% %pfb_cpp_vers% %pfb_arch% Thread Safety %pfb_ts%" "%php_interbase%.dll"

exit /B 0
exit /B

:error
call :log "%pfb_php_tag% build FAILED"
@REM log =========================================================================================
@REM log <msg>
@REM example> call :log "<msg1>"
:log
echo ---------------------------------------------------------------------
for %%a in (%*) do ( echo %%~a )
echo ---------------------------------------------------------------------
exit /B

@REM usage =======================================================================================
:usage
call :log "Usage: %~nx0 php_tag cpp_vers [ts=0|1] [arch=x86|x64]" " Example: %~nx0 php-8.4.13 vs17 1 x86"
exit /B

@REM error =======================================================================================
:error
call :log "Build FAILED" "%pfb_php_tag% %pfb_cpp_vers% %pfb_arch% Thread Safety %pfb_ts%" "%php_interbase%.dll"
exit /B 1
32 changes: 21 additions & 11 deletions build_scripts/php-fb-config.bat
Original file line number Diff line number Diff line change
@@ -1,18 +1,28 @@
@REM
@REM git command must be in PATH
@REM

@echo off
@REM php-firebird source directory
set PFB_SOURCE_DIR=D:\php-firebird\

for /f %%i in ('git -C %PFB_SOURCE_DIR%\php-firebird\ rev-parse --short HEAD') do set GIT_HASH=%%i

@REM sets php-firebird version part in extension file, for example, php_interbase-<<3.0.1-ba8e63b>>-7.3-vc15.dll
set PFB_VERS=3.0.1-%GIT_HASH%
@REM Should point one level up. For example
@REM PFB_SOURCE_DIR=D:\php-firebird\ then your source should reside in D:\php-firebird\php-firebird\
set PFB_SOURCE_DIR=%~dp0..\..\

@REM Directory where all compiled files will be copied
set PFB_OUTPUT_DIR=D:\php-firebird\releases\
set PFB_OUTPUT_DIR=%PFB_SOURCE_DIR%releases\

@REM FB 32-bit and 64-bit libraries
set PFB_FB32_DIR=C:\Program Files\Firebird\Firebird_5_0-x86
set PFB_FB64_DIR=C:\Program Files\Firebird\Firebird_5_0

@REM Attach current git commit hash. git command must be in PATH
set USE_GIT_HASH=0

@REM Grab version
for /f "tokens=3" %%i in ('findstr /b /c:"#define PHP_INTERBASE_VER_MAJOR" %~dp0..\php_interbase.h') do set VER_MAJOR=%%i
for /f "tokens=3" %%i in ('findstr /b /c:"#define PHP_INTERBASE_VER_MINOR" %~dp0..\php_interbase.h') do set VER_MINOR=%%i
for /f "tokens=3" %%i in ('findstr /b /c:"#define PHP_INTERBASE_VER_REV" %~dp0..\php_interbase.h') do set VER_REV=%%i
for /f "tokens=3" %%i in ('findstr /b /c:"#define PHP_INTERBASE_VER_PRE" %~dp0..\php_interbase.h') do set VER_PRE=%%~i
set PFB_VERS=%VER_MAJOR%.%VER_MINOR%.%VER_REV%%VER_PRE%

if %USE_GIT_HASH% equ 1 (
for /f %%i in ('git -C %~dp0..\ rev-parse --short HEAD') do set PFB_VERS=%PFB_VERS%-%%i
)

set PFB_CONFIGURE_FLAGS=--enable-debug
10 changes: 5 additions & 5 deletions build_scripts/php-fb-sdk-build.bat
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@ exit /B

set build_msg=Building PHP-%pfb_php_vers%

if "%pfb_ts%" gtr "0" (
set build_msg=%build_msg% non-TS
set extra_args=--disable-zts
) else (
if %pfb_ts% equ 1 (
set build_msg=%build_msg% TS
set extra_args=
) else (
set build_msg=%build_msg% non-TS
set extra_args=--disable-zts
)

if "%pfb_arch%" == "x86" (
Expand All @@ -53,5 +53,5 @@ exit /B
call phpsdk_buildtree php%pfb_php_vers%
cd /D php-src
call buildconf.bat --force --add-modules-dir=%PFB_SOURCE_DIR%
call configure.bat --disable-all --enable-cli %extra_args% --with-interbase=%with_interbase%
call configure.bat --disable-all --enable-cli %PFB_CONFIGURE_FLAGS% %extra_args% --with-interbase=%with_interbase%
nmake
Loading