Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
8 changes: 8 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@ PHP NEWS
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
?? ??? ????, PHP 8.5.8

- Embed:
. Added --enable-embed=static support on Windows: php<N>embed.lib is now
produced as a self-contained static library (no php<N>.dll dependency)
by linking PHP core, statically built extensions, and the embed SAPI
into a single .lib, with the corresponding source-side adjustments
(PHP/Zend/SAPI/TSRM export defines and TSRMLS cache deduplication).
(Luther Monson)

- GD:
. Fixed bug GH-22121 (Double free in gdImageSetStyle() after
overflow-triggered early return). (iliaal)
Expand Down
10 changes: 10 additions & 0 deletions sapi/embed/config.w32
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,15 @@ var PHP_EMBED_PGO = false;

if (PHP_EMBED != "no") {
SAPI('embed', 'php_embed.c', 'php' + PHP_VERSION + 'embed.lib', '/DZEND_ENABLE_STATIC_TSRMLS_CACHE=1');
if (PHP_EMBED == "static") {
// Static embed mode: php<N>embed.lib is intended to contain PHP
// core, extensions and the embed SAPI in a single static library
// (no php<N>.dll at runtime). php_embed.c must reach PHP/Zend/
// SAPI/TSRM symbols directly rather than through dllimport thunks.
ADD_FLAG('CFLAGS_EMBED',
'/D PHP_EMBED_STATIC' +
' /D PHP_EXPORTS /D LIBZEND_EXPORTS' +
' /D SAPI_EXPORTS /D TSRM_EXPORTS');
}
PHP_INSTALL_HEADERS("sapi/embed", "php_embed.h");
}
2 changes: 1 addition & 1 deletion sapi/embed/php_embed.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ static const char HARDCODED_INI[] =
"max_execution_time=0\n"
"max_input_time=-1\n\0";

#if defined(PHP_WIN32) && defined(ZTS)
#if defined(PHP_WIN32) && defined(ZTS) && !defined(PHP_EMBED_STATIC)
ZEND_TSRMLS_CACHE_DEFINE()
#endif

Expand Down
14 changes: 11 additions & 3 deletions win32/build/confutils.js
Original file line number Diff line number Diff line change
Expand Up @@ -1197,6 +1197,14 @@ function SAPI(sapiname, file_list, makefiletarget, cflags, obj_dir, duplicate_so
var ld;
var manifest;

// In --enable-embed=static, php<N>embed.lib must contain PHP core, all
// statically built extensions, and the embed SAPI itself - no runtime
// dependency on php<N>.dll. Substitute the PHP object groups for the
// import lib in both the dependency line and the link command.
var is_static_embed = (sapiname == "embed" && PHP_EMBED == "static");
var dep_phplib_deps = is_static_embed ? "$(PHP_GLOBAL_OBJS) $(STATIC_EXT_OBJS) $(ASM_OBJS)" : "$(BUILD_DIR)\\$(PHPLIB)";
var link_phplib_args = is_static_embed ? "$(PHP_GLOBAL_OBJS_RESP) $(STATIC_EXT_OBJS_RESP) $(ASM_OBJS) $(STATIC_EXT_LIBS)" : "$(BUILD_DIR)\\$(PHPLIB)";

if (typeof(obj_dir) == "undefined") {
sapiname_for_printing = configure_module_dirname;
} else {
Expand Down Expand Up @@ -1228,7 +1236,7 @@ function SAPI(sapiname, file_list, makefiletarget, cflags, obj_dir, duplicate_so
if (MODE_PHPIZE) {
MFO.WriteLine("$(BUILD_DIR)\\" + makefiletarget + ": $(DEPS_" + SAPI + ") $(" + SAPI + "_GLOBAL_OBJS) $(PHPLIB) $(BUILD_DIR)\\" + resname + " $(BUILD_DIR)\\" + manifest_name);
} else {
MFO.WriteLine("$(BUILD_DIR)\\" + makefiletarget + ": $(DEPS_" + SAPI + ") $(" + SAPI + "_GLOBAL_OBJS) $(BUILD_DIR)\\$(PHPLIB) $(BUILD_DIR)\\" + resname + " $(BUILD_DIR)\\" + manifest_name);
MFO.WriteLine("$(BUILD_DIR)\\" + makefiletarget + ": $(DEPS_" + SAPI + ") $(" + SAPI + "_GLOBAL_OBJS) " + dep_phplib_deps + " $(BUILD_DIR)\\" + resname + " $(BUILD_DIR)\\" + manifest_name);
}

var is_lib = makefiletarget.match(new RegExp("\\.lib$"));
Expand Down Expand Up @@ -1276,10 +1284,10 @@ function SAPI(sapiname, file_list, makefiletarget, cflags, obj_dir, duplicate_so
}
} else {
if (ld) {
MFO.WriteLine("\t" + ld + " /nologo /out:$(BUILD_DIR)\\" + makefiletarget + " " + ldflags + " $(" + SAPI + "_GLOBAL_OBJS_RESP) $(BUILD_DIR)\\$(PHPLIB) $(ARFLAGS_" + SAPI + ") $(LIBS_" + SAPI + ") $(BUILD_DIR)\\" + resname);
MFO.WriteLine("\t" + ld + " /nologo /out:$(BUILD_DIR)\\" + makefiletarget + " " + ldflags + " $(" + SAPI + "_GLOBAL_OBJS_RESP) " + link_phplib_args + " $(ARFLAGS_" + SAPI + ") $(LIBS_" + SAPI + ") $(BUILD_DIR)\\" + resname);
} else {
ld = CMD_MOD1 + '"$(LINK)"';
MFO.WriteLine("\t" + ld + " /nologo " + " $(" + SAPI + "_GLOBAL_OBJS_RESP) $(BUILD_DIR)\\$(PHPLIB) $(LIBS_" + SAPI + ") $(BUILD_DIR)\\" + resname + " /out:$(BUILD_DIR)\\" + makefiletarget + " " + ldflags + " $(LDFLAGS_" + SAPI + ")");
MFO.WriteLine("\t" + ld + " /nologo " + " $(" + SAPI + "_GLOBAL_OBJS_RESP) " + link_phplib_args + " $(LIBS_" + SAPI + ") $(BUILD_DIR)\\" + resname + " /out:$(BUILD_DIR)\\" + makefiletarget + " " + ldflags + " $(LDFLAGS_" + SAPI + ")");
}
}

Expand Down
Loading