From 7ed26c01f5b7aeccd9e2bfd544c79d073df93530 Mon Sep 17 00:00:00 2001 From: Ayesh Karunaratne Date: Wed, 21 Feb 2024 19:16:25 +0700 Subject: [PATCH 1/5] GitHub Actions: Update action versions to avoid node:16 warnings (#13453) Note 16 is now EOL, so old GitHub Actions that use node 16 now triggers a warning. This updates all existing workflows except `dwieeb/needs-reply` to their latest versions. --- .github/workflows/close-stale-feature-requests.yml | 2 +- .github/workflows/close-stale-prs.yml | 2 +- .github/workflows/labeler.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/close-stale-feature-requests.yml b/.github/workflows/close-stale-feature-requests.yml index bc4df0a326ea6..6a464df018f41 100644 --- a/.github/workflows/close-stale-feature-requests.yml +++ b/.github/workflows/close-stale-feature-requests.yml @@ -15,7 +15,7 @@ jobs: issues: write pull-requests: write steps: - - uses: actions/stale@v6 + - uses: actions/stale@v9 with: days-before-close: 14 days-before-stale: 90 diff --git a/.github/workflows/close-stale-prs.yml b/.github/workflows/close-stale-prs.yml index e870b5e3a7809..ab17c074155f3 100644 --- a/.github/workflows/close-stale-prs.yml +++ b/.github/workflows/close-stale-prs.yml @@ -15,7 +15,7 @@ jobs: issues: write pull-requests: write steps: - - uses: actions/stale@v6 + - uses: actions/stale@v9 with: days-before-close: 7 days-before-stale: 60 diff --git a/.github/workflows/labeler.yml b/.github/workflows/labeler.yml index c76ba196430ad..2945fc60c511a 100644 --- a/.github/workflows/labeler.yml +++ b/.github/workflows/labeler.yml @@ -11,6 +11,6 @@ jobs: pull-requests: write runs-on: ubuntu-latest steps: - - uses: actions/labeler@v4 + - uses: actions/labeler@v5 with: repo-token: "${{ secrets.GITHUB_TOKEN }}" From 1bef861527d44ff5f6bf6ee313ffcf035842f06c Mon Sep 17 00:00:00 2001 From: Ilija Tovilo Date: Tue, 20 Feb 2024 13:01:58 +0100 Subject: [PATCH 2/5] Add vscode chapter to docs Closes GH-13441 --- docs/source/index.rst | 1 + docs/source/introduction/ides/index.rst | 10 ++ .../introduction/ides/visual-studio-code.rst | 132 ++++++++++++++++++ 3 files changed, 143 insertions(+) create mode 100644 docs/source/introduction/ides/index.rst create mode 100644 docs/source/introduction/ides/visual-studio-code.rst diff --git a/docs/source/index.rst b/docs/source/index.rst index f800042275383..667f761497be4 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -7,6 +7,7 @@ :hidden: introduction/high-level-overview + introduction/ides/index .. toctree:: :caption: Core diff --git a/docs/source/introduction/ides/index.rst b/docs/source/introduction/ides/index.rst new file mode 100644 index 0000000000000..e12e0d5c7ccd0 --- /dev/null +++ b/docs/source/introduction/ides/index.rst @@ -0,0 +1,10 @@ +###### + IDEs +###### + +.. toctree:: + :hidden: + + visual-studio-code + +Here you can find instructions on how to effectively use common IDEs for php-src development. diff --git a/docs/source/introduction/ides/visual-studio-code.rst b/docs/source/introduction/ides/visual-studio-code.rst new file mode 100644 index 0000000000000..3493c00e83aa7 --- /dev/null +++ b/docs/source/introduction/ides/visual-studio-code.rst @@ -0,0 +1,132 @@ +#################### + Visual Studio Code +#################### + +.. note:: + + These instructions have been tested on Linux. macOS should mostly work the same. For Windows, + ymmv. + +An IDE can make navigating large code bases tremendously easier. Visual Studio Code is a popular and +free IDE that is well-suited for C development. It contains syntax highlighting, navigation, +auto-completion and a debugger. Check the `official website `__ for +installation instructions. + +.. note:: + + The ``settings.json`` file referenced below can be opened in the Settings page by pressing the + "Open Settings (JSON)" button in the top right corner. Most of these settings can also be + adjusted through the GUI. + +***************** + C/C++ extension +***************** + +The `C/C++ extension`_ provides most of the features we'll need for php-src development. You can +find it in the extensions marketplace. You will also need ``gcc`` or ``clang`` installed. The +extension will mostly work out of the box, but it is advisable to use the ``compile_commands.json`` +file. It contains a list of all compiled files, along with the commands used to compile them. It +provides the extension with the necessary information about include paths and other compiler flags. + +.. _c/c++ extension: https://marketplace.visualstudio.com/items?itemName=ms-vscode.cpptools + +To generate the ``compile_commands.json`` file, you can use the compiledb_ tool. Install it using +``pip``, and then prefix your ``make`` command accordingly: + +.. _compiledb: https://github.com/nickdiego/compiledb + +.. code:: bash + + # Install compiledb + pip install compiledb + # Compile php-src and generate compile_commands.json + compiledb make -j8 + +To tell the C/C++ extension to use the ``compile_commands.json`` file, add the following to your +``settings.json`` file: + +.. code:: json + + { + "C_Cpp.default.compileCommands": "${workspaceFolder}/compile_commands.json" + } + +******** + clangd +******** + +The C/C++ extension usually works well enough. Some people find that ``clangd`` works better. +``clangd`` is a language server built on top of the ``clang`` compiler. It only provides navigation +and code completion but no syntax highlighting and no debugger. As such, it should be used in +conjunction with the C/C++ extension. For the two extensions not to clash, add the following to your +``settings.json`` file: + +.. code:: json + + { + "C_Cpp.intelliSenseEngine": "disabled" + } + +Follow the `official installation instructions for clangd +`__, and then install the `clangd extension`_. +Alternatively, you can let the extension install ``clangd`` for you. ``clangd`` requires a +``compile_commands.json`` file, so make sure to follow the instructions from the previous section. +By default, ``clangd`` will auto-include header files on completion. php-src headers are somewhat +peculiar, so you might want to disable this option in your ``settings.json`` file: + +.. _clangd extension: https://marketplace.visualstudio.com/items?itemName=llvm-vs-code-extensions.vscode-clangd + +.. code:: json + + { + "clangd.arguments": [ + "-header-insertion=never" + ] + } + +***** + gdb +***** + +The C/C++ extension provides the ability to use Visual Studio Code as a frontend for ``gdb``. Of +course, you will need ``gdb`` installed on your system, and php-src must be compiled with the +``--enable-debug`` configure flag. Copy the following into your projects ``.vscode/launch.json`` +file: + +.. code:: json + + { + "version": "0.2.0", + "configurations": [ + { + "name": "(gdb) Launch", + "type": "cppdbg", + "request": "launch", + "program": "${workspaceFolder}/sapi/cli/php", + "args": [ + // Any options you want to test with + // "-dopcache.enable_cli=1", + "${relativeFile}", + ], + "stopAtEntry": false, + "cwd": "${workspaceFolder}", + // Useful if you build with --enable-address-sanitizer + "environment": [ + { "name": "USE_ZEND_ALLOC", "value": "0" }, + { "name": "USE_TRACKED_ALLOC", "value": "1" }, + { "name": "LSAN_OPTIONS", "value": "detect_leaks=0" }, + ], + "externalConsole": false, + "MIMode": "gdb", + "setupCommands": [ + { "text": "source ${workspaceFolder}/.gdbinit" }, + ] + } + ] + } + +Set any breakpoint in your C code, open a ``php`` (or ``phpt``) file and start debugging from the +"Run and Debug" tab in the sidebar. + +.. + _todo: lldb should work mostly the same, I believe. It's available by default on macOS, and as such might be more convenient. From ef61ed10c2b6d8cbfc3facd5382415f199158be7 Mon Sep 17 00:00:00 2001 From: Appla Date: Wed, 21 Feb 2024 22:33:15 +0800 Subject: [PATCH 3/5] Remove redundant getpid function call (#13454) --- Zend/zend_max_execution_timer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Zend/zend_max_execution_timer.c b/Zend/zend_max_execution_timer.c index 92b70fbb2a6ad..16c2b7e2b8d23 100644 --- a/Zend/zend_max_execution_timer.c +++ b/Zend/zend_max_execution_timer.c @@ -66,7 +66,7 @@ ZEND_API void zend_max_execution_timer_init(void) /* {{{ */ zend_strerror_noreturn(E_ERROR, errno, "Could not create timer"); } - EG(pid) = getpid(); + EG(pid) = pid; # ifdef MAX_EXECUTION_TIMERS_DEBUG fprintf(stderr, "Timer %#jx created on thread %d\n", (uintmax_t) EG(max_execution_timer_timer), sev.sigev_notify_thread_id); From 1721288e1cbe4b8512439d3ccea84c84ff63c8e3 Mon Sep 17 00:00:00 2001 From: Ayesh Karunaratne Date: Wed, 21 Feb 2024 23:16:48 +0700 Subject: [PATCH 4/5] CI: Fix labeler.yml file to support actions/labeler@v5 --- .github/labeler.yml | 322 ++++++++++++++++++++++++++++++++------------ 1 file changed, 238 insertions(+), 84 deletions(-) diff --git a/.github/labeler.yml b/.github/labeler.yml index 6dbb253277244..675aed5ebc76c 100644 --- a/.github/labeler.yml +++ b/.github/labeler.yml @@ -1,237 +1,391 @@ "Category: Engine": -- Zend/* + - changed-files: + - any-glob-to-any-file: + - Zend/* "Category: Optimizer": -- Zend/Optimizer/**/* + - changed-files: + - any-glob-to-any-file: + - Zend/Optimizer/**/* "Category: Build System": -- '**/*.m4' -- '**/*.w32' -- build/**/* -- buildconf -- buildconf.bat -- configure.ac -- scripts/**/* -- win32/build/**/* + - changed-files: + - any-glob-to-any-file: + - '**/*.m4' + - '**/*.w32' + - build/**/* + - buildconf + - buildconf.bat + - configure.ac + - scripts/**/* + - win32/build/**/* "Extension: bcmath": -- ext/bcmath/**/* + - changed-files: + - any-glob-to-any-file: + - ext/bcmath/**/* "Extension: bz2": -- ext/bz2/**/* + - changed-files: + - any-glob-to-any-file: + - ext/bz2/**/* "Extension: calendar": -- ext/calendar/**/* + - changed-files: + - any-glob-to-any-file: + - ext/calendar/**/* "Extension: com_dotnet": -- ext/com_dotnet/**/* + - changed-files: + - any-glob-to-any-file: + - ext/com_dotnet/**/* "Extension: ctype": -- ext/ctype/**/* + - changed-files: + - any-glob-to-any-file: + - ext/ctype/**/* "Extension: curl": -- ext/curl/**/* + - changed-files: + - any-glob-to-any-file: + - ext/curl/**/* "Extension: date": -- ext/date/**/* + - changed-files: + - any-glob-to-any-file: + - ext/date/**/* "Extension: dba": -- ext/dba/**/* + - changed-files: + - any-glob-to-any-file: + - ext/dba/**/* "Extension: dom": -- ext/dom/**/* + - changed-files: + - any-glob-to-any-file: + - ext/dom/**/* "Extension: enchant": -- ext/enchant/**/* + - changed-files: + - any-glob-to-any-file: + - ext/enchant/**/* "Extension: exif": -- ext/exif/**/* + - changed-files: + - any-glob-to-any-file: + - ext/exif/**/* "Extension: ffi": -- ext/ffi/**/* + - changed-files: + - any-glob-to-any-file: + - ext/ffi/**/* "Extension: fileinfo": -- ext/fileinfo/**/* + - changed-files: + - any-glob-to-any-file: + - ext/fileinfo/**/* "Extension: filter": -- ext/filter/**/* + - changed-files: + - any-glob-to-any-file: + - ext/filter/**/* "Extension: ftp": -- ext/ftp/**/* + - changed-files: + - any-glob-to-any-file: + - ext/ftp/**/* "Extension: gd": -- ext/gd/**/* + - changed-files: + - any-glob-to-any-file: + - ext/gd/**/* "Extension: gettext": -- ext/gettext/**/* + - changed-files: + - any-glob-to-any-file: + - ext/gettext/**/* "Extension: gmp": -- ext/gmp/**/* + - changed-files: + - any-glob-to-any-file: + - ext/gmp/**/* "Extension: hash": -- ext/hash/**/* + - changed-files: + - any-glob-to-any-file: + - ext/hash/**/* "Extension: iconv": -- ext/iconv/**/* + - changed-files: + - any-glob-to-any-file: + - ext/iconv/**/* "Extension: intl": -- ext/intl/**/* + - changed-files: + - any-glob-to-any-file: + - ext/intl/**/* "Extension: json": -- ext/json/**/* + - changed-files: + - any-glob-to-any-file: + - ext/json/**/* "Extension: ldap": -- ext/ldap/**/* + - changed-files: + - any-glob-to-any-file: + - ext/ldap/**/* "Extension: libxml": -- ext/libxml/**/* + - changed-files: + - any-glob-to-any-file: + - ext/libxml/**/* "Extension: mbstring": -- ext/mbstring/**/* + - changed-files: + - any-glob-to-any-file: + - ext/mbstring/**/* "Extension: mysqli": -- ext/mysqli/**/* + - changed-files: + - any-glob-to-any-file: + - ext/mysqli/**/* "Extension: mysqlnd": -- ext/mysqlnd/**/* + - changed-files: + - any-glob-to-any-file: + - ext/mysqlnd/**/* "Extension: odbc": -- ext/odbc/**/* + - changed-files: + - any-glob-to-any-file: + - ext/odbc/**/* "Extension: opcache": -- ext/opcache/**/* + - changed-files: + - any-glob-to-any-file: + - ext/opcache/**/* "Extension: openssl": -- ext/openssl/**/* + - changed-files: + - any-glob-to-any-file: + - ext/openssl/**/* "Extension: pcntl": -- ext/pcntl/**/* + - changed-files: + - any-glob-to-any-file: + - ext/pcntl/**/* "Extension: pcre": -- ext/pcre/**/* + - changed-files: + - any-glob-to-any-file: + - ext/pcre/**/* "Extension: pdo (core)": -- ext/pdo/**/* + - changed-files: + - any-glob-to-any-file: + - ext/pdo/**/* "Extension: pdo_dblib": -- ext/pdo_dblib/**/* + - changed-files: + - any-glob-to-any-file: + - ext/pdo_dblib/**/* "Extension: pdo_firebird": -- ext/pdo_firebird/**/* + - changed-files: + - any-glob-to-any-file: + - ext/pdo_firebird/**/* "Extension: pdo_mysql": -- ext/pdo_mysql/**/* + - changed-files: + - any-glob-to-any-file: + - ext/pdo_mysql/**/* "Extension: pdo_odbc": -- ext/pdo_odbc/**/* + - changed-files: + - any-glob-to-any-file: + - ext/pdo_odbc/**/* "Extension: pdo_pgsql": -- ext/pdo_pgsql/**/* + - changed-files: + - any-glob-to-any-file: + - ext/pdo_pgsql/**/* "Extension: pdo_sqlite": -- ext/pdo_sqlite/**/* + - changed-files: + - any-glob-to-any-file: + - ext/pdo_sqlite/**/* "Extension: pgsql": -- ext/pgsql/**/* + - changed-files: + - any-glob-to-any-file: + - ext/pgsql/**/* "Extension: phar": -- ext/phar/**/* + - changed-files: + - any-glob-to-any-file: + - ext/phar/**/* "Extension: posix": -- ext/posix/**/* + - changed-files: + - any-glob-to-any-file: + - ext/posix/**/* "Extension: random": -- ext/random/**/* + - changed-files: + - any-glob-to-any-file: + - ext/random/**/* "Extension: readline": -- ext/readline/**/* + - changed-files: + - any-glob-to-any-file: + - ext/readline/**/* "Extension: reflection": -- ext/reflection/**/* + - changed-files: + - any-glob-to-any-file: + - ext/reflection/**/* "Extension: session": -- ext/session/**/* + - changed-files: + - any-glob-to-any-file: + - ext/session/**/* "Extension: shmop": -- ext/shmop/**/* + - changed-files: + - any-glob-to-any-file: + - ext/shmop/**/* "Extension: simplexml": -- ext/simplexml/**/* + - changed-files: + - any-glob-to-any-file: + - ext/simplexml/**/* "Extension: snmp": -- ext/snmp/**/* + - changed-files: + - any-glob-to-any-file: + - ext/snmp/**/* "Extension: soap": -- ext/soap/**/* + - changed-files: + - any-glob-to-any-file: + - ext/soap/**/* "Extension: sockets": -- ext/sockets/**/* + - changed-files: + - any-glob-to-any-file: + - ext/sockets/**/* "Extension: sodium": -- ext/sodium/**/* + - changed-files: + - any-glob-to-any-file: + - ext/sodium/**/* "Extension: spl": -- ext/spl/**/* + - changed-files: + - any-glob-to-any-file: + - ext/spl/**/* "Extension: sqlite3": -- ext/sqlite3/**/* + - changed-files: + - any-glob-to-any-file: + - ext/sqlite3/**/* "Extension: standard": -- ext/standard/**/* + - changed-files: + - any-glob-to-any-file: + - ext/standard/**/* "Extension: sysvmsg": -- ext/sysvmsg/**/* + - changed-files: + - any-glob-to-any-file: + - ext/sysvmsg/**/* "Extension: sysvsem": -- ext/sysvsem/**/* + - changed-files: + - any-glob-to-any-file: + - ext/sysvsem/**/* "Extension: sysvshm": -- ext/sysvshm/**/* + - changed-files: + - any-glob-to-any-file: + - ext/sysvshm/**/* "Extension: tidy": -- ext/tidy/**/* + - changed-files: + - any-glob-to-any-file: + - ext/tidy/**/* "Extension: tokenizer": -- ext/tokenizer/**/* + - changed-files: + - any-glob-to-any-file: + - ext/tokenizer/**/* "Extension: xml": -- ext/xml/**/* + - changed-files: + - any-glob-to-any-file: + - ext/xml/**/* "Extension: xmlreader": -- ext/xmlreader/**/* + - changed-files: + - any-glob-to-any-file: + - ext/xmlreader/**/* "Extension: xmlwriter": -- ext/xmlwriter/**/* + - changed-files: + - any-glob-to-any-file: + - ext/xmlwriter/**/* "Extension: xsl": -- ext/xsl/**/* + - changed-files: + - any-glob-to-any-file: + - ext/xsl/**/* "Extension: zend_test": -- ext/zend_test/**/* + - changed-files: + - any-glob-to-any-file: + - ext/zend_test/**/* "Extension: zip": -- ext/zip/**/* + - changed-files: + - any-glob-to-any-file: + - ext/zip/**/* "Extension: zlib": -- ext/zlib/**/* + - changed-files: + - any-glob-to-any-file: + - ext/zlib/**/* "SAPI: apache2handler": -- sapi/apache2handler/**/* + - changed-files: + - any-glob-to-any-file: + - sapi/apache2handler/**/* "SAPI: cgi": -- sapi/cgi/**/* + - changed-files: + - any-glob-to-any-file: + - sapi/cgi/**/* "SAPI: cli": -- sapi/cli/**/* + - changed-files: + - any-glob-to-any-file: + - sapi/cli/**/* "SAPI: fpm": -- sapi/fpm/**/* + - changed-files: + - any-glob-to-any-file: + - sapi/fpm/**/* "SAPI: fuzzer": -- sapi/fuzzer/**/* + - changed-files: + - any-glob-to-any-file: + - sapi/fuzzer/**/* "SAPI: litespeed": -- sapi/litespeed/**/* + - changed-files: + - any-glob-to-any-file: + - sapi/litespeed/**/* "SAPI: phpdbg": -- sapi/phpdbg/**/* + - changed-files: + - any-glob-to-any-file: + - sapi/phpdbg/**/* From ab9bfec66f8f3ccc97de1d5ec9fa40ffcb382d5d Mon Sep 17 00:00:00 2001 From: Ayesh Karunaratne Date: Wed, 21 Feb 2024 23:22:36 +0700 Subject: [PATCH 5/5] t --- ext/opcache/ZendAccelerator.c | 1 + 1 file changed, 1 insertion(+) diff --git a/ext/opcache/ZendAccelerator.c b/ext/opcache/ZendAccelerator.c index b9149fa1fa12a..67109f850c328 100644 --- a/ext/opcache/ZendAccelerator.c +++ b/ext/opcache/ZendAccelerator.c @@ -19,6 +19,7 @@ +----------------------------------------------------------------------+ */ + #include "main/php.h" #include "main/php_globals.h" #include "zend.h"