diff --git a/src/php/bin/php_extension_doxygen_filter.awk b/src/php/bin/php_extension_doxygen_filter.awk index 3d1ec2b543a8f..8728ffaeba4cb 100644 --- a/src/php/bin/php_extension_doxygen_filter.awk +++ b/src/php/bin/php_extension_doxygen_filter.awk @@ -20,7 +20,7 @@ function sed_gensub(regexp, replacement, how, target, cmd_, ret_) { # ar gsub(/'/, "'\"'\"'", target); gsub(/\\\\/, "\\", regexp); - cmd_ = "printf '" target "' | sed -E 's/" regexp "/" replacement "/" tolower(how) "'"; + cmd_ = "printf '" target "' | sed -nE 's/" regexp "/" replacement "/" tolower(how) "p'"; if (cmd_ | getline ret_ != 1) { close(cmd_); error = "ERROR: running command: " cmd_ ", ret_: " ret_; @@ -85,7 +85,7 @@ inDocComment==1 && $0 ~ classLineRegex { } # end of class document -inDocComment==1 && /\*\// && classDocComment == "" { +inDocComment==1 && /\*\// && className && classDocComment == "" { classDocComment = docComment; docComment = ""; } diff --git a/src/php/bin/php_extension_to_php_doc.sh b/src/php/bin/php_extension_to_php_doc.sh index 852204df61823..59f80a4ad7f7f 100755 --- a/src/php/bin/php_extension_to_php_doc.sh +++ b/src/php/bin/php_extension_to_php_doc.sh @@ -28,7 +28,8 @@ COMMAND="${1:-}" # parse class and methods for FILENAME in call_credentials.c call.c channel.c channel_credentials.c \ server_credentials.c server.c timeval.c ; do - CLASS_NAME=$(sed -E 's/(^|_)(\w)/\U\2/g' <<< "${FILENAME%.*}") + CLASS_NAME=$(awk -F _ '{for(i=1; i<=NF; i++) printf "%s", toupper(substr($i,1,1)) substr($i, 2);}' \ + <<< "${FILENAME%.*}") if [[ "$COMMAND" == "generate" ]]; then echo Generating lib/Grpc/$CLASS_NAME.php ... awk -f php_extension_doxygen_filter.awk ../ext/grpc/$FILENAME \