protobuf/php/tests/compile_extension.sh
Joshua Haberman b0d90e3abe
Fixed PHP memory leaks and arginfo errors (#8614)
* Fixed a bunch of incorrect arginfo and a few incorrect error messages.

* Passes mem check test with no leaks!

* WIP.

* Fix build warning that was causing Bazel build to fail.

* Added compatibility code for PHP <8.0.

* Added test_valgrind target and made tests Valgrind-clean.

* Updated Valgrind test to fail if memory leaks are detected.

* Removed intermediate shell script so commands are easier to cut, paste, and modify.

* Passing all Valgrind tests!

* Hoist addref into ObjCache_Get().

* Removed special case of map descriptors by keying object map on upb_msgdef.

* Removed all remaining RETURN_ZVAL() macros.

* Removed all explicit reference add/del operations.

* Added REFCOUNTING.md to Makefile.am.
2021-05-13 23:16:49 -07:00

30 lines
699 B
Bash
Executable File

#!/bin/bash
set -e
cd $(dirname $0)
../prepare_c_extension.sh
pushd ../ext/google/protobuf > /dev/null
CONFIGURE_OPTIONS=("./configure" "--with-php-config=$(which php-config)")
if [ "$1" != "--release" ]; then
CONFIGURE_OPTIONS+=("CFLAGS=-g -O0 -Wall -DPBPHP_ENABLE_ASSERTS")
fi
FINGERPRINT="$(sha256sum $(which php)) ${CONFIGURE_OPTIONS[@]}"
# If the PHP interpreter we are building against or the arguments
# have changed, we must regenerated the Makefile.
if [[ ! -f BUILD_STAMP ]] || [[ "$(cat BUILD_STAMP)" != "$FINGERPRINT" ]]; then
phpize --clean
rm -f configure.in configure.ac
phpize
"${CONFIGURE_OPTIONS[@]}"
echo "$FINGERPRINT" > BUILD_STAMP
fi
make
popd > /dev/null