From 4fcb3e0d343bb2a4bd405fce816020986e040434 Mon Sep 17 00:00:00 2001 From: Peter Date: Tue, 13 Jun 2023 01:19:11 +0800 Subject: [PATCH] Fix cross-compilation check in phar generation for FreeBSD FreeBSD's shell is very POSIX strict. This patch makes sure it works correctly under FreeBSD too. Closes GH-11441. --- NEWS | 3 +++ ext/phar/Makefile.frag | 6 +++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/NEWS b/NEWS index 6baaae22e86..2335b5d7d39 100644 --- a/NEWS +++ b/NEWS @@ -47,6 +47,9 @@ PHP NEWS . Fixed bug GH-9356 Incomplete validation of IPv6 Address fields in subjectAltNames (James Lucas, Jakub Zelenka). +- Phar: + . Fix cross-compilation check in phar generation for FreeBSD. (peter279k) + - SPL: . Fixed bug GH-11338 (SplFileInfo empty getBasename with more than one slash). (nielsdos) diff --git a/ext/phar/Makefile.frag b/ext/phar/Makefile.frag index e5646b20292..7a867dd7df2 100644 --- a/ext/phar/Makefile.frag +++ b/ext/phar/Makefile.frag @@ -35,7 +35,7 @@ TEST_PHP_EXECUTABLE_RES = $(shell echo "$(TEST_PHP_EXECUTABLE)" | grep -c 'Exec $(builddir)/phar.php: $(srcdir)/build_precommand.php $(srcdir)/phar/*.inc $(srcdir)/phar/*.php $(SAPI_CLI_PATH) -@(echo "Generating phar.php"; \ - if [ $(TEST_PHP_EXECUTABLE_RES) -ne 1 ]; then \ + if [ "$(TEST_PHP_EXECUTABLE_RES)" != 1 ]; then \ $(PHP_PHARCMD_EXECUTABLE) $(PHP_PHARCMD_SETTINGS) $(srcdir)/build_precommand.php > $(builddir)/phar.php; \ else \ echo "Skipping phar.php generating during cross compilation"; \ @@ -43,7 +43,7 @@ $(builddir)/phar.php: $(srcdir)/build_precommand.php $(srcdir)/phar/*.inc $(srcd $(builddir)/phar.phar: $(builddir)/phar.php $(builddir)/phar/phar.inc $(srcdir)/phar/*.inc $(srcdir)/phar/*.php $(SAPI_CLI_PATH) -@(echo "Generating phar.phar"; \ - if [ $(TEST_PHP_EXECUTABLE_RES) -ne 1 ]; then \ + if [ "$(TEST_PHP_EXECUTABLE_RES)" != 1 ]; then \ rm -f $(builddir)/phar.phar; \ rm -f $(srcdir)/phar.phar; \ $(PHP_PHARCMD_EXECUTABLE) $(PHP_PHARCMD_SETTINGS) $(builddir)/phar.php pack -f $(builddir)/phar.phar -a pharcommand -c auto -x \\.svn -p 0 -s $(srcdir)/phar/phar.php -h sha1 -b "$(PHP_PHARCMD_BANG)" $(srcdir)/phar/; \ @@ -53,7 +53,7 @@ $(builddir)/phar.phar: $(builddir)/phar.php $(builddir)/phar/phar.inc $(srcdir)/ fi) install-pharcmd: pharcmd - @(if [ $(TEST_PHP_EXECUTABLE_RES) -ne 1 ]; then \ + @(if [ "$(TEST_PHP_EXECUTABLE_RES)" != 1 ]; then \ $(mkinstalldirs) $(INSTALL_ROOT)$(bindir); \ $(INSTALL) $(builddir)/phar.phar $(INSTALL_ROOT)$(bindir)/$(program_prefix)phar$(program_suffix).phar; \ rm -f $(INSTALL_ROOT)$(bindir)/$(program_prefix)phar$(program_suffix); \