repo
stringlengths
5
53
pr_number
int32
1
321k
task_type
stringclasses
2 values
issue_text
stringlengths
0
81.2k
pr_title
stringlengths
1
319
pr_body
stringlengths
0
105k
base_sha
stringlengths
40
40
head_sha
stringlengths
40
40
gold_diff
stringlengths
0
202M
changed_files
listlengths
0
100
review_threads
listlengths
0
100
test_patch
stringlengths
0
23.4M
merged
bool
1 class
yhirose/cpp-httplib
2,376
issue_to_patch
Documentation Site on GitHub Pages
85b18a9c6431877188a706ba3c61679fa9de3e27
f88387dccf33fddf2a36946d5f2a4feed538aeda
diff --git a/.gitignore b/.gitignore index 1ea2142f62..40930943d4 100644 --- a/.gitignore +++ b/.gitignore @@ -57,6 +57,7 @@ test/*.log test/_build_* work/ benchmark/server* +docs-gen/target/ *.swp diff --git a/docs-gen/Cargo.lock b/docs-gen/Cargo.lock new file mode 100644 index 0000000000..6d12b6715b --- /dev/...
[ ".gitignore", "docs-gen/Cargo.lock", "docs-gen/Cargo.toml", "docs-gen/README.md", "docs-gen/src/builder.rs", "docs-gen/src/config.rs", "docs-gen/src/main.rs", "docs-gen/src/markdown.rs", "docs-src/config.toml", "docs-src/pages/en/cookbook/index.md", "docs-src/pages/en/index.md", "docs-src/page...
[]
true
yhirose/cpp-httplib
2,382
issue_to_patch
Removed unused local variable
Small fix for unused local variable causing treat warnings as errors to fail. ``` [build] E:\CodingProjects\04_Projects\NoteShare_Dec2025\build\MSVC 64bit\external\httplib.h(11799,28): error C2220: the following warning is treated as an error [E:\CodingProjects\04_Projects\NoteShare_Dec2025\build\MSVC 64bit\sharepa...
ae64a5ee90799dfba09b57be8fe6e52e82c6e43c
fbda9ef81a1b173e7f95d3d3e0db486247e7ac9d
diff --git a/httplib.h b/httplib.h index 766d6d8648..0417a45879 100644 --- a/httplib.h +++ b/httplib.h @@ -11801,7 +11801,7 @@ Server::process_request(Stream &strm, const std::string &remote_addr, #else try { routed = routing(req, res, strm); - } catch (std::exception &e) { + } catch (std::exception &) { ...
[ "httplib.h" ]
[]
true
yhirose/cpp-httplib
2,360
issue_to_patch
CMake component `MbedTLS` I think that [this pull request](https://github.com/yhirose/cpp-httplib/pull/2342) requires a small update of `CMakeLists.txt`. Probably a new component like `MbedTLS` to set the macro `CPPHTTPLIB_MBEDTLS_SUPPORT`. Overall conidition via `CPPHTTPLIB_SSL_ENABLED`. Sets macro `CPPHTTPLIB_OPEN...
[CMake] New compoments `MbedTLS` and `wolfSSL`
New CMake component `MbedTLS`. Fixes https://github.com/yhirose/cpp-httplib/issues/2345. A decision I needed to make. Use OpenSSL primarily and MbedTLS secondly. As OpenSSL is activated if available, this means that MbedTLS needs to be deactivated even if available. I tested all four cases `HTTPLIB_USE_OPENSSL_IF...
a9fc9359196210a7b5d81c20a77ed2f5501c0840
08c87be3fc9c08c326160baf2a1e033bb88ec326
diff --git a/CMakeLists.txt b/CMakeLists.txt index 96ede135d7..ae236c3767 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,11 +2,15 @@ Build options: * Standard BUILD_SHARED_LIBS is supported and sets HTTPLIB_SHARED default value. * HTTPLIB_USE_OPENSSL_IF_AVAILABLE (default on) + * HTTPLIB_USE_WOLFSSL_IF_AV...
[ "CMakeLists.txt", "cmake/httplibConfig.cmake.in" ]
[ { "comment": "typo", "path": "cmake/httplibConfig.cmake.in", "hunk": "@@ -4,6 +4,8 @@\n # Setting these here so they're accessible after install.\n # Might be useful for some users to check which settings were used.\n set(HTTPLIB_IS_USING_OPENSSL @HTTPLIB_IS_USING_OPENSSL@)\n+set(HTTPLIB_IS_USING_MBEDTL...
true
yhirose/cpp-httplib
2,360
comment_to_fix
[CMake] New compoments `MbedTLS` and `wolfSSL`
typo
a9fc9359196210a7b5d81c20a77ed2f5501c0840
08c87be3fc9c08c326160baf2a1e033bb88ec326
diff --git a/cmake/httplibConfig.cmake.in b/cmake/httplibConfig.cmake.in index 8ca8b991a2..933862a5e0 100644 --- a/cmake/httplibConfig.cmake.in +++ b/cmake/httplibConfig.cmake.in @@ -4,6 +4,8 @@ # Setting these here so they're accessible after install. # Might be useful for some users to check which settings were use...
[ "cmake/httplibConfig.cmake.in" ]
[ { "comment": "typo", "path": "cmake/httplibConfig.cmake.in", "hunk": "@@ -4,6 +4,8 @@\n # Setting these here so they're accessible after install.\n # Might be useful for some users to check which settings were used.\n set(HTTPLIB_IS_USING_OPENSSL @HTTPLIB_IS_USING_OPENSSL@)\n+set(HTTPLIB_IS_USING_MBEDTL...
true
yhirose/cpp-httplib
2,360
comment_to_fix
[CMake] New compoments `MbedTLS` and `wolfSSL`
Here, you are probably best off doing a foreach loop with WOLFSSL, OPENSSL, MBEDTLS. In that loop check if HTTPLIB_REQUIRE_${ssl} is true, and if so set a variable e.g. _ssl_backend_set However if that variable and _ssl_backend_set are both true, then error
a9fc9359196210a7b5d81c20a77ed2f5501c0840
08c87be3fc9c08c326160baf2a1e033bb88ec326
diff --git a/CMakeLists.txt b/CMakeLists.txt index 96ede135d7..ae236c3767 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,11 +2,15 @@ Build options: * Standard BUILD_SHARED_LIBS is supported and sets HTTPLIB_SHARED default value. * HTTPLIB_USE_OPENSSL_IF_AVAILABLE (default on) + * HTTPLIB_USE_WOLFSSL_IF_AV...
[ "CMakeLists.txt" ]
[ { "comment": "Here, you are probably best off doing a foreach loop with WOLFSSL, OPENSSL, MBEDTLS. In that loop check if HTTPLIB_REQUIRE_${ssl} is true, and if so set a variable e.g. _ssl_backend_set\r\n\r\nHowever if that variable and _ssl_backend_set are both true, then error", "path": "CMakeLists.txt", ...
true
yhirose/cpp-httplib
2,360
comment_to_fix
[CMake] New compoments `MbedTLS` and `wolfSSL`
Ditto
a9fc9359196210a7b5d81c20a77ed2f5501c0840
08c87be3fc9c08c326160baf2a1e033bb88ec326
diff --git a/CMakeLists.txt b/CMakeLists.txt index 96ede135d7..ae236c3767 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,11 +2,15 @@ Build options: * Standard BUILD_SHARED_LIBS is supported and sets HTTPLIB_SHARED default value. * HTTPLIB_USE_OPENSSL_IF_AVAILABLE (default on) + * HTTPLIB_USE_WOLFSSL_IF_AV...
[ "CMakeLists.txt" ]
[ { "comment": "Ditto", "path": "CMakeLists.txt", "hunk": "@@ -120,6 +130,24 @@ else()\n \t\tmessage(WARNING \"HTTPLIB_BUILD_MODULES requires CMake 3.28 or later. Current version is ${CMAKE_VERSION}. Modules support has been disabled.\")\n \tendif()\n endif()\n+\n+# Incompatibility between OpenSSL and Mbe...
true
yhirose/cpp-httplib
2,360
comment_to_fix
[CMake] New compoments `MbedTLS` and `wolfSSL`
This works, but for future ease of maintenance this may be better: ```cmake foreach(tls_lib OPENSSL WOLFSSL MBEDTLS) set(tls_required ${HTTPLIB_REQUIRE_${tls_lib}}) set(tls_use ${HTTPLIB_USE_${tls_lib}_IF_AVAILABLE}) if(tls_required or tls_use) set(tls_requested ON) endif() if (tls...
a9fc9359196210a7b5d81c20a77ed2f5501c0840
08c87be3fc9c08c326160baf2a1e033bb88ec326
diff --git a/CMakeLists.txt b/CMakeLists.txt index 96ede135d7..ae236c3767 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,11 +2,15 @@ Build options: * Standard BUILD_SHARED_LIBS is supported and sets HTTPLIB_SHARED default value. * HTTPLIB_USE_OPENSSL_IF_AVAILABLE (default on) + * HTTPLIB_USE_WOLFSSL_IF_AV...
[ "CMakeLists.txt" ]
[ { "comment": "This works, but for future ease of maintenance this may be better:\r\n```cmake\r\nforeach(tls_lib OPENSSL WOLFSSL MBEDTLS)\r\n set(tls_required ${HTTPLIB_REQUIRE_${tls_lib}})\r\n set(tls_use ${HTTPLIB_USE_${tls_lib}_IF_AVAILABLE})\r\n if(tls_required or tls_use)\r\n set(tls_request...
true
yhirose/cpp-httplib
2,360
comment_to_fix
[CMake] New compoments `MbedTLS` and `wolfSSL`
Is this necessary? I think with my suggestion it shouldn't be
a9fc9359196210a7b5d81c20a77ed2f5501c0840
08c87be3fc9c08c326160baf2a1e033bb88ec326
diff --git a/CMakeLists.txt b/CMakeLists.txt index 96ede135d7..ae236c3767 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,11 +2,15 @@ Build options: * Standard BUILD_SHARED_LIBS is supported and sets HTTPLIB_SHARED default value. * HTTPLIB_USE_OPENSSL_IF_AVAILABLE (default on) + * HTTPLIB_USE_WOLFSSL_IF_AV...
[ "CMakeLists.txt" ]
[ { "comment": "Is this necessary? I think with my suggestion it shouldn't be", "path": "CMakeLists.txt", "hunk": "@@ -120,6 +130,36 @@ else()\n \t\tmessage(WARNING \"HTTPLIB_BUILD_MODULES requires CMake 3.28 or later. Current version is ${CMAKE_VERSION}. Modules support has been disabled.\")\n \tendif()\...
true
yhirose/cpp-httplib
2,377
issue_to_patch
Make loading system certificates from the Keychain on macOS an opt-out feature
7c33fd47bf3ab74fe968e31c5e585598373e2d8c
f09894708592fd4d2cfb2b9100eb25d41f096148
diff --git a/CMakeLists.txt b/CMakeLists.txt index 45a0e16b98..96ede135d7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,7 +10,7 @@ * HTTPLIB_REQUIRE_ZLIB (default off) * HTTPLIB_REQUIRE_BROTLI (default off) * HTTPLIB_REQUIRE_ZSTD (default off) - * HTTPLIB_USE_CERTS_FROM_MACOSX_KEYCHAIN (default on) + * ...
[ "CMakeLists.txt", "README.md", "httplib.h", "meson.build", "meson_options.txt", "test/Makefile" ]
[]
diff --git a/test/Makefile b/test/Makefile index 4060466c0b..62e5756166 100644 --- a/test/Makefile +++ b/test/Makefile @@ -7,13 +7,13 @@ ifneq ($(OS), Windows_NT) PREFIX ?= $(shell brew --prefix) OPENSSL_DIR = $(PREFIX)/opt/openssl@3 OPENSSL_SUPPORT = -DCPPHTTPLIB_OPENSSL_SUPPORT -I$(OPENSSL_DIR)/include -L$(O...
true
yhirose/cpp-httplib
2,370
issue_to_patch
Add wolfSSL support
woflSSL support
718d7d92b993d8fdf6a74d82af8572b96787a909
dc5adc01852b532cbac598f6d7412364e06913d8
diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 69158d3f7d..378c0ce3d9 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -77,7 +77,7 @@ jobs: (github.event_name == 'workflow_dispatch' && github.event.inputs.test_linux == 'true') strategy: matri...
[ ".github/workflows/test.yaml", ".gitignore", "README.md", "httplib.h", "justfile", "test/Makefile" ]
[]
diff --git a/test/Makefile b/test/Makefile index be9e567a9f..4060466c0b 100644 --- a/test/Makefile +++ b/test/Makefile @@ -11,9 +11,13 @@ ifneq ($(OS), Windows_NT) MBEDTLS_DIR ?= $(shell brew --prefix mbedtls@3) MBEDTLS_SUPPORT = -DCPPHTTPLIB_MBEDTLS_SUPPORT -I$(MBEDTLS_DIR)/include -L$(MBEDTLS_DIR)/lib -lmbedtls...
true
yhirose/cpp-httplib
1,612
issue_to_patch
Fix successful decompress reported as Error::Read
Streams less than 4096 bytes are sometimes reported as failed reads because stream_.avail_in is not reduced to 0. The next iteration of the loop finds `prev_avail_in == strm_.avail_in` and return false. `ret = inflate(...)` returns `Z_STREAM_END` on the first iteration of the loop indicating that inflate is finished. T...
82acdca638b64e0c00b43e2b192fbce0a4de9567
28e34136e0ab52a31e1c9e020426e2cd5926d393
diff --git a/httplib.h b/httplib.h index 9753439abb..4691b7354b 100644 --- a/httplib.h +++ b/httplib.h @@ -3384,16 +3384,12 @@ inline bool gzip_decompressor::decompress(const char *data, size_t data_length, data += strm_.avail_in; std::array<char, CPPHTTPLIB_COMPRESSION_BUFSIZ> buff{}; - while (strm_.ava...
[ "httplib.h", "test/test.cc" ]
[]
diff --git a/test/test.cc b/test/test.cc index 7750a511cb..93d2bdbf44 100644 --- a/test/test.cc +++ b/test/test.cc @@ -3330,6 +3330,59 @@ TEST(GzipDecompressor, ChunkedDecompression) { ASSERT_EQ(data, decompressed_data); } +TEST(GzipDecompressor, DeflateDecompression) { + std::string original_text = "Raw deflate...
true
yhirose/cpp-httplib
1,046
issue_to_patch
Read buffer
e3e28c623165f9965efd2abbb7a31891c0fad684
40c2abb68a296a984144c31995349cf327b3d06b
diff --git a/httplib.h b/httplib.h index b65a89a72a..fae47fa75e 100644 --- a/httplib.h +++ b/httplib.h @@ -1671,6 +1671,10 @@ bool parse_range_header(const std::string &s, Ranges &ranges); int close_socket(socket_t sock); +ssize_t send_socket(socket_t sock, const void *ptr, size_t size, int flags); + +ssize_t read...
[ "httplib.h", "test/test.cc" ]
[]
diff --git a/test/test.cc b/test/test.cc index adbc1e47c1..913a358450 100644 --- a/test/test.cc +++ b/test/test.cc @@ -1349,11 +1349,13 @@ class ServerTest : public ::testing::Test { std::this_thread::sleep_for(std::chrono::seconds(2)); res.set_content("slow", "text/plain"); ...
true
yhirose/cpp-httplib
845
issue_to_patch
Add exception handler
This pull request adds the option to handle C++ exceptions caused by user handlers when routing. This allows users to react to exceptions globally by logging them and restarting safely. This may be used over try/catch's within the handlers to avoid repetition in error messages: an API might return the same error messag...
ae6cf70bc459ffc0f0f4c710b6c050f3b5d60cf2
9be81a62ea7a25299c75829eac1b65b698222b6a
diff --git a/README.md b/README.md index 952a757dd3..37d2db119e 100644 --- a/README.md +++ b/README.md @@ -177,6 +177,19 @@ svr.set_error_handler([](const auto& req, auto& res) { }); ``` +### Exception handler +The exception handler gets called if a user routing handler throws an error. + +```cpp +svr.set_exception...
[ "README.md", "httplib.h", "test/test.cc" ]
[ { "comment": "missing `, std::exception &e` in the argument list?", "path": "README.md", "hunk": "@@ -177,6 +177,16 @@ svr.set_error_handler([](const auto& req, auto& res) {\n });\n ```\n \n+### Exception handler\n+\n+```cpp\n+svr.set_error_handler([](const auto& req, auto& res) {", "resolving_sha":...
diff --git a/test/test.cc b/test/test.cc index 9b0b9a54ab..6325cdce92 100644 --- a/test/test.cc +++ b/test/test.cc @@ -6,6 +6,7 @@ #include <chrono> #include <future> #include <thread> +#include <stdexcept> #define SERVER_CERT_FILE "./cert.pem" #define SERVER_CERT2_FILE "./cert2.pem" @@ -978,6 +979,41 @@ TEST(Er...
true
yhirose/cpp-httplib
845
comment_to_fix
Add exception handler
missing `, std::exception &e` in the argument list?
ae6cf70bc459ffc0f0f4c710b6c050f3b5d60cf2
9be81a62ea7a25299c75829eac1b65b698222b6a
diff --git a/README.md b/README.md index 952a757dd3..37d2db119e 100644 --- a/README.md +++ b/README.md @@ -177,6 +177,19 @@ svr.set_error_handler([](const auto& req, auto& res) { }); ``` +### Exception handler +The exception handler gets called if a user routing handler throws an error. + +```cpp +svr.set_exception...
[ "README.md" ]
[ { "comment": "missing `, std::exception &e` in the argument list?", "path": "README.md", "hunk": "@@ -177,6 +177,16 @@ svr.set_error_handler([](const auto& req, auto& res) {\n });\n ```\n \n+### Exception handler\n+\n+```cpp\n+svr.set_error_handler([](const auto& req, auto& res) {", "resolving_sha":...
true
yhirose/cpp-httplib
845
comment_to_fix
Add exception handler
Could you explain the purpose of this method in one or a few sentences? This is to intercept `std::exception &e` from users' routing handlers, but not from cpp-httplib itself, right?
ae6cf70bc459ffc0f0f4c710b6c050f3b5d60cf2
9be81a62ea7a25299c75829eac1b65b698222b6a
diff --git a/README.md b/README.md index 952a757dd3..37d2db119e 100644 --- a/README.md +++ b/README.md @@ -177,6 +177,19 @@ svr.set_error_handler([](const auto& req, auto& res) { }); ``` +### Exception handler +The exception handler gets called if a user routing handler throws an error. + +```cpp +svr.set_exception...
[ "README.md" ]
[ { "comment": "Could you explain the purpose of this method in one or a few sentences? This is to intercept `std::exception &e` from users' routing handlers, but not from cpp-httplib itself, right?", "path": "README.md", "hunk": "@@ -177,6 +177,16 @@ svr.set_error_handler([](const auto& req, auto& res) {...
true
yhirose/cpp-httplib
845
comment_to_fix
Add exception handler
This test shouldn't be removed. It is for the default exception handler.
ae6cf70bc459ffc0f0f4c710b6c050f3b5d60cf2
9be81a62ea7a25299c75829eac1b65b698222b6a
diff --git a/test/test.cc b/test/test.cc index 9b0b9a54ab..6325cdce92 100644 --- a/test/test.cc +++ b/test/test.cc @@ -6,6 +6,7 @@ #include <chrono> #include <future> #include <thread> +#include <stdexcept> #define SERVER_CERT_FILE "./cert.pem" #define SERVER_CERT2_FILE "./cert2.pem" @@ -978,6 +979,41 @@ TEST(Er...
[ "test/test.cc" ]
[ { "comment": "This test shouldn't be removed. It is for the default exception handler.", "path": "test/test.cc", "hunk": "@@ -3348,34 +3384,6 @@ TEST(MountTest, Unmount) {\n ASSERT_FALSE(svr.is_running());\n }\n \n-TEST(ExceptionTest, ThrowExceptionInHandler) {\n- Server svr;\n-\n- svr.Get(\"/hi\", ...
true
yhirose/cpp-httplib
845
comment_to_fix
Add exception handler
`e` should never be re-thrown here. The original code (Ln 4848-4853) should be moved here instead. If a user really wants to re-throw it (it's dangerous though...), it should be re-thrown from a user's exception handler.
ae6cf70bc459ffc0f0f4c710b6c050f3b5d60cf2
9be81a62ea7a25299c75829eac1b65b698222b6a
diff --git a/httplib.h b/httplib.h index be1f9d6d64..8975ab6e20 100644 --- a/httplib.h +++ b/httplib.h @@ -598,6 +598,9 @@ class Server { public: using Handler = std::function<void(const Request &, Response &)>; + using ExceptionHandler = + std::function<void(const Request &, Response &, std::exception &e)>...
[ "httplib.h" ]
[ { "comment": "`e` should never be re-thrown here. The original code (Ln 4848-4853) should be moved here instead. If a user really wants to re-throw it (it's dangerous though...), it should be re-thrown from a user's exception handler.", "path": "httplib.h", "hunk": "@@ -5064,7 +5078,17 @@ Server::proces...
true
yhirose/cpp-httplib
845
comment_to_fix
Add exception handler
I would not like to have this function which looks confusing to users.
ae6cf70bc459ffc0f0f4c710b6c050f3b5d60cf2
9be81a62ea7a25299c75829eac1b65b698222b6a
diff --git a/httplib.h b/httplib.h index be1f9d6d64..8975ab6e20 100644 --- a/httplib.h +++ b/httplib.h @@ -598,6 +598,9 @@ class Server { public: using Handler = std::function<void(const Request &, Response &)>; + using ExceptionHandler = + std::function<void(const Request &, Response &, std::exception &e)>...
[ "httplib.h" ]
[ { "comment": "I would not like to have this function which looks confusing to users.", "path": "httplib.h", "hunk": "@@ -608,6 +611,9 @@ class Server {\n using HandlerWithContentReader = std::function<void(\n const Request &, Response &, const ContentReader &content_reader)>;\n \n+ using Except...
true
yhirose/cpp-httplib
845
comment_to_fix
Add exception handler
I would like to remove the `ExceptionHandlerWithResponse` version. It's really rare to return `Unhanded`.
ae6cf70bc459ffc0f0f4c710b6c050f3b5d60cf2
9be81a62ea7a25299c75829eac1b65b698222b6a
diff --git a/httplib.h b/httplib.h index be1f9d6d64..8975ab6e20 100644 --- a/httplib.h +++ b/httplib.h @@ -598,6 +598,9 @@ class Server { public: using Handler = std::function<void(const Request &, Response &)>; + using ExceptionHandler = + std::function<void(const Request &, Response &, std::exception &e)>...
[ "httplib.h" ]
[ { "comment": "I would like to remove the `ExceptionHandlerWithResponse` version. It's really rare to return `Unhanded`.", "path": "httplib.h", "hunk": "@@ -652,6 +658,8 @@ class Server {\n \n Server &set_error_handler(HandlerWithResponse handler);\n Server &set_error_handler(Handler handler);\n+ Se...
true
yhirose/cpp-httplib
845
comment_to_fix
Add exception handler
I have explained in the above that we don't need it.
ae6cf70bc459ffc0f0f4c710b6c050f3b5d60cf2
9be81a62ea7a25299c75829eac1b65b698222b6a
diff --git a/httplib.h b/httplib.h index be1f9d6d64..8975ab6e20 100644 --- a/httplib.h +++ b/httplib.h @@ -598,6 +598,9 @@ class Server { public: using Handler = std::function<void(const Request &, Response &)>; + using ExceptionHandler = + std::function<void(const Request &, Response &, std::exception &e)>...
[ "httplib.h" ]
[ { "comment": "I have explained in the above that we don't need it.", "path": "httplib.h", "hunk": "@@ -4281,6 +4290,19 @@ inline Server &Server::set_error_handler(Handler handler) {\n return *this;\n }\n \n+inline Server &Server::set_exception_handler(ExceptionHandlerWithResponse handler) {", "res...
true
yhirose/cpp-httplib
845
comment_to_fix
Add exception handler
The handler should be a void function.
ae6cf70bc459ffc0f0f4c710b6c050f3b5d60cf2
9be81a62ea7a25299c75829eac1b65b698222b6a
diff --git a/httplib.h b/httplib.h index be1f9d6d64..8975ab6e20 100644 --- a/httplib.h +++ b/httplib.h @@ -598,6 +598,9 @@ class Server { public: using Handler = std::function<void(const Request &, Response &)>; + using ExceptionHandler = + std::function<void(const Request &, Response &, std::exception &e)>...
[ "httplib.h" ]
[ { "comment": "The handler should be a void function.", "path": "httplib.h", "hunk": "@@ -4281,6 +4290,19 @@ inline Server &Server::set_error_handler(Handler handler) {\n return *this;\n }\n \n+inline Server &Server::set_exception_handler(ExceptionHandlerWithResponse handler) {\n+ exception_handler_ =...
true
yhirose/cpp-httplib
845
comment_to_fix
Add exception handler
It can be just as below. ```cpp exception_handler_(req, res, e); routed = true; ``
ae6cf70bc459ffc0f0f4c710b6c050f3b5d60cf2
9be81a62ea7a25299c75829eac1b65b698222b6a
diff --git a/httplib.h b/httplib.h index be1f9d6d64..8975ab6e20 100644 --- a/httplib.h +++ b/httplib.h @@ -598,6 +598,9 @@ class Server { public: using Handler = std::function<void(const Request &, Response &)>; + using ExceptionHandler = + std::function<void(const Request &, Response &, std::exception &e)>...
[ "httplib.h" ]
[ { "comment": "It can be just as below.\r\n\r\n```cpp\r\nexception_handler_(req, res, e);\r\nrouted = true;\r\n``", "path": "httplib.h", "hunk": "@@ -5064,7 +5078,17 @@ Server::process_request(Stream &strm, bool close_connection,\n }\n \n // Rounting\n- if (routing(req, res, strm)) {\n+ bool routed...
true
yhirose/cpp-httplib
2,166
issue_to_patch
Cleaner API
696c02f2bcc494011239e666ae46f5fde7d3260d
8561b6f6ac92c1e572cb475bc09088eae31479c5
diff --git a/httplib.h b/httplib.h index e7fe9efe6e..27c4501ffa 100644 --- a/httplib.h +++ b/httplib.h @@ -126,6 +126,10 @@ #define CPPHTTPLIB_RECV_BUFSIZ size_t(16384u) #endif +#ifndef CPPHTTPLIB_SEND_BUFSIZ +#define CPPHTTPLIB_SEND_BUFSIZ size_t(16384u) +#endif + #ifndef CPPHTTPLIB_COMPRESSION_BUFSIZ #define CP...
[ "httplib.h", "test/test.cc" ]
[]
diff --git a/test/test.cc b/test/test.cc index 4797795fea..204c2d2805 100644 --- a/test/test.cc +++ b/test/test.cc @@ -6115,6 +6115,273 @@ TEST(ServerStopTest, Decommision) { } } +// Helper function for string body upload progress tests +template <typename SetupHandler, typename ClientCall> +void TestStringBodyUp...
true
yhirose/cpp-httplib
2,268
issue_to_patch
Add Client methods with both content provider and receiver
Add most `Post` overloads for `Client`, with both content provider and content receiver. * Result Post(const std::string &path, size_t content_length, ContentProvider content_provider, const std::string &content_type, ContentReceiver content_receiver, UploadProgress progress = nullptr) * Result Post(const std::stri...
1acf18876fdbd1a4f3ff91f43cf21495af357850
2214859dc2ceb74940853a4d391bfad5800769c0
diff --git a/httplib.h b/httplib.h index 8411c8c93b..8ed840efd7 100644 --- a/httplib.h +++ b/httplib.h @@ -1421,14 +1421,18 @@ class ClientImpl { Result Post(const std::string &path, const char *body, size_t content_length, const std::string &content_type, UploadProgress progress = nullptr); Result Post(const std...
[ "httplib.h", "test/test.cc" ]
[ { "comment": "Could you explain why these lines need to be added? These are already added at line 3842 and 3843.", "path": "httplib.h", "hunk": "@@ -3847,6 +3847,8 @@ inline int getaddrinfo_with_timeout(const char *node, const char *service,\n \n // Allocate on the heap, so the resolver thread can kee...
diff --git a/test/test.cc b/test/test.cc index b54c0f0afb..6944c7be5a 100644 --- a/test/test.cc +++ b/test/test.cc @@ -3423,6 +3423,39 @@ class ServerTest : public ::testing::Test { EXPECT_EQ(req.body, LARGE_DATA); res.set_content(req.body, "text/plain"); }) + .Po...
true
yhirose/cpp-httplib
2,368
issue_to_patch
WebSocket and Dynamic Thread Pool support
Long waited features are finally supported! - WebSocket support - Dynamic Thread Pool support
d4180e923f846b44a3d30acd938438d6e64fc9f6
81cbc42b7d469a3222f41b30f6a29c25531cb3f6
diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 027eda56e7..69158d3f7d 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -103,6 +103,11 @@ jobs: - name: run fuzz test target if: matrix.tls_backend == 'openssl' run: cd test && make fuzz_te...
[ ".github/workflows/test.yaml", ".gitignore", "README-websocket.md", "README.md", "example/Makefile", "example/wsecho.cc", "httplib.h", "test/Makefile", "test/test.cc", "test/test_thread_pool.cc", "test/test_websocket_heartbeat.cc" ]
[]
diff --git a/test/Makefile b/test/Makefile index b8f5babee0..be9e567a9f 100644 --- a/test/Makefile +++ b/test/Makefile @@ -155,6 +155,10 @@ test_no_tls : test.cc include_httplib.cc ../httplib.h Makefile test_split_no_tls : test.cc ../httplib.h httplib.cc Makefile $(CXX) -o $@ $(CXXFLAGS) test.cc httplib.cc $(TEST_AR...
true
yhirose/cpp-httplib
2,364
issue_to_patch
Parallel test on CI
c1ee85d89ea2d857509164df6b759e36342ef2e4
45ed6c0ba9bfea00b3453ab2aecaa5c565771807
diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 31459e863d..027eda56e7 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -94,12 +94,12 @@ jobs: run: sudo apt-get install -y libmbedtls-dev - name: build and run tests (OpenSSL) if: matrix.t...
[ ".github/workflows/test.yaml", ".github/workflows/test_no_exceptions.yaml", ".github/workflows/test_offline.yaml", ".gitignore", "justfile", "test/Makefile", "test/test.cc" ]
[ { "comment": "https://github.com/google/gtest-parallel may be useful here", "path": "test/Makefile", "hunk": "@@ -56,6 +56,42 @@ STYLE_CHECK_FILES = $(filter-out httplib.h httplib.cc, \\\n all : test test_split\n \tLSAN_OPTIONS=suppressions=lsan_suppressions.txt ./test\n \n+SHARDS ?= 4\n+\n+define run_p...
diff --git a/.github/workflows/test_no_exceptions.yaml b/.github/workflows/test_no_exceptions.yaml index 7e71635f6c..f525297158 100644 --- a/.github/workflows/test_no_exceptions.yaml +++ b/.github/workflows/test_no_exceptions.yaml @@ -17,4 +17,4 @@ jobs: - name: Run tests with CPPHTTPLIB_NO_EXCEPTIONS run...
true
yhirose/cpp-httplib
2,367
issue_to_patch
Fix comparison of integers of different signs warning when compiling with BoringSSL.
This PR fixes the following warning: ``` httplib/httplib.h:15402:21: error: comparison of integers of different signs: 'int' and 'size_t' (aka 'unsigned long') [-Werror,-Wsign-compare] 15402 | for (int i = 0; i < count; i++) { | ~ ^ ~~~~~ 1 error generated. ``` The PR fixing the s...
8d225afc8cbd9b82fef3543dcb52fe504a2351ab
0bbb81caa4dc2b493de1c5524e1275547517e10e
diff --git a/httplib.h b/httplib.h index 4665957864..a35a1ae2e5 100644 --- a/httplib.h +++ b/httplib.h @@ -15341,7 +15341,7 @@ inline bool get_cert_sans(cert_t cert, std::vector<SanEntry> &sans) { if (!names) return true; // No SANs is valid auto count = sk_GENERAL_NAME_num(names); - for (int i = 0; i < count;...
[ "httplib.h" ]
[]
true
yhirose/cpp-httplib
2,365
issue_to_patch
Remove macOS select() fallback
macOS has supported `poll` for a long time now, so there's no need for the specific `select` code paths. With this commit, we can successfully build on visionOS.
ed5c5d325b14c0bfc7fae578a73b9deb5c0f0f3b
9e3eacfc0cadf6ac6ddba358bb36405c1bc7ab3c
diff --git a/httplib.h b/httplib.h index 7ffb753094..4665957864 100644 --- a/httplib.h +++ b/httplib.h @@ -4600,78 +4600,32 @@ inline int poll_wrapper(struct pollfd *fds, nfds_t nfds, int timeout) { #endif } -template <bool Read> -inline ssize_t select_impl(socket_t sock, time_t sec, time_t usec) { -#ifdef __APPLE_...
[ "httplib.h" ]
[]
true
yhirose/cpp-httplib
2,354
issue_to_patch
Fix compilation on BoringSSL by replacing ASN1_TIME_to_tm
BoringSSL doesn't expose `ASN1_TIME_to_tm`. This patch switches to using `ASN1_TIME_diff` to calculate `time_t`. This is supported by OpenSSL, LibreSSL, and BoringSSL, and also avoids the platform-specific `timegm` vs `_mkgmtime` logic.
1f1a799d13d6e482279b846c3555f6b3dbebf9b4
da520f83f6147604dd0e293619dfbaabfac79682
diff --git a/httplib.h b/httplib.h index 547028560f..acb83b0198 100644 --- a/httplib.h +++ b/httplib.h @@ -15455,18 +15455,20 @@ inline bool get_cert_validity(cert_t cert, time_t &not_before, auto na = X509_get0_notAfter(x509); if (!nb || !na) return false; - // Convert ASN1_TIME to time_t - struct tm tm_nb =...
[ "httplib.h" ]
[]
true
yhirose/cpp-httplib
2,355
issue_to_patch
Correct sign comparison error with sk_X509_OBJECT_num
In some build configurations, sk_X509_OBJECT_num (from BoringSSL) returns a size_t. Comparing this directly against a signed int loop counter triggers -Werror,-Wsign-compare. Instead, move the count into a local int variable so the compiler uses implicit conversion to ensure type consistency during the loop comparis...
8c4370247ad9355182e3fd5ea7d400fe1374cdcd
29e2a9fd3f03c994efcfc038668526eb3657d343
diff --git a/httplib.h b/httplib.h index 547028560f..18400abe4b 100644 --- a/httplib.h +++ b/httplib.h @@ -14739,7 +14739,8 @@ inline std::string x509_store_to_pem(X509_STORE *store) { std::string pem; auto objs = X509_STORE_get0_objects(store); if (!objs) return {}; - for (int i = 0; i < sk_X509_OBJECT_num(o...
[ "httplib.h" ]
[ { "comment": "Should `int` be `decltype(count)`?", "path": "httplib.h", "hunk": "@@ -15593,7 +15595,7 @@ inline std::vector<std::string> get_ca_names(ctx_t ctx) {\n auto objs = X509_STORE_get0_objects(store);\n if (!objs) { return names; }\n \n- int count = sk_X509_OBJECT_num(objs);\n+ auto count ...
true
yhirose/cpp-httplib
2,355
comment_to_fix
Correct sign comparison error with sk_X509_OBJECT_num
Should `int` be `decltype(count)`?
8c4370247ad9355182e3fd5ea7d400fe1374cdcd
29e2a9fd3f03c994efcfc038668526eb3657d343
diff --git a/httplib.h b/httplib.h index 547028560f..18400abe4b 100644 --- a/httplib.h +++ b/httplib.h @@ -14739,7 +14739,8 @@ inline std::string x509_store_to_pem(X509_STORE *store) { std::string pem; auto objs = X509_STORE_get0_objects(store); if (!objs) return {}; - for (int i = 0; i < sk_X509_OBJECT_num(o...
[ "httplib.h" ]
[ { "comment": "Should `int` be `decltype(count)`?", "path": "httplib.h", "hunk": "@@ -15593,7 +15595,7 @@ inline std::vector<std::string> get_ca_names(ctx_t ctx) {\n auto objs = X509_STORE_get0_objects(store);\n if (!objs) { return names; }\n \n- int count = sk_X509_OBJECT_num(objs);\n+ auto count ...
true
yhirose/cpp-httplib
2,363
issue_to_patch
Use iptables to disable network
14e37bd75b52a31d7e68ccd20bc4e1b505257b6e
630eee8bd9180a6e192208448bdc2fd948da2596
[ ".github/workflows/test_offline.yaml", "test/test.cc" ]
[]
diff --git a/.github/workflows/test_offline.yaml b/.github/workflows/test_offline.yaml index 64e86177b1..8814877e61 100644 --- a/.github/workflows/test_offline.yaml +++ b/.github/workflows/test_offline.yaml @@ -40,7 +40,13 @@ jobs: if: matrix.tls_backend == 'openssl' run: sudo apt-get install -y libss...
true
yiisoft/yii2
20,944
issue_to_patch
Fix MSSQL `QueryBuilder::renameColumn()` to pass `sp_rename` named arguments and a one-part new column name.
| Q | A | ------------- | --- | Is bugfix? | ✔️ | New feature? | ❌ | Breaks BC? | ❌
58a18a87bfd8e79a3a61f2b1757f77b2629623a1
9893aea1042cd67f661fe0cdb70e90fb4914a1c1
diff --git a/framework/CHANGELOG.md b/framework/CHANGELOG.md index 2ef5a57ccc7..f7177f83287 100644 --- a/framework/CHANGELOG.md +++ b/framework/CHANGELOG.md @@ -95,6 +95,7 @@ Yii Framework 2 Change Log - Enh #20941: Modernize MSSQL `yii\db\mssql\Schema` internals and remove dead `unsigned` detection (terabytesoftw) -...
[ "framework/CHANGELOG.md", "framework/db/mssql/QueryBuilder.php", "tests/framework/db/mssql/CommandTest.php", "tests/framework/db/mssql/QueryBuilderTest.php", "tests/framework/db/mssql/providers/CommandProvider.php", "tests/framework/db/mssql/providers/QueryBuilderProvider.php" ]
[]
diff --git a/tests/framework/db/mssql/CommandTest.php b/tests/framework/db/mssql/CommandTest.php index 2106052347c..bd19ab4fb1a 100644 --- a/tests/framework/db/mssql/CommandTest.php +++ b/tests/framework/db/mssql/CommandTest.php @@ -87,6 +87,66 @@ public function testRenameTableWithQuotedNames( } } + ...
true
yiisoft/yii2
20,943
issue_to_patch
Fix MSSQL `QueryBuilder::renameTable()` to call `sp_rename` with string parameters and one-part new table names.
| Q | A | ------------- | --- | Is bugfix? | ✔️ | New feature? | ❌ | Breaks BC? | ❌
d649d0b90101e76e0265a558bc67e6f73af9985b
9d25e787f6dc05ccbbec81aca9a9599f8fd3d8bd
diff --git a/framework/CHANGELOG.md b/framework/CHANGELOG.md index f4ca42bbda6..2ef5a57ccc7 100644 --- a/framework/CHANGELOG.md +++ b/framework/CHANGELOG.md @@ -94,6 +94,7 @@ Yii Framework 2 Change Log - Enh #20939: Replace `strpos()` with `str_contains()` in `yii\db\Schema` quoting methods and fix `quoteValue()` `@pa...
[ "framework/CHANGELOG.md", "framework/db/mssql/QueryBuilder.php", "tests/framework/db/mssql/CommandTest.php", "tests/framework/db/mssql/QueryBuilderTest.php", "tests/framework/db/mssql/providers/CommandProvider.php", "tests/framework/db/mssql/providers/QueryBuilderProvider.php" ]
[ { "comment": "_🎯 Functional Correctness_ | _🟠 Major_\n\n<details>\n<summary>🧩 Analysis chain</summary>\n\n🌐 Web query:\n\n`In SQL Server `sp_rename`, for `@objtype = 'OBJECT'`, must `@newname` be provided as a one-part string value (not a multipart/qualified name)?`\n\n💡 Result:\n\nYes, when using sp_renam...
diff --git a/tests/framework/db/mssql/CommandTest.php b/tests/framework/db/mssql/CommandTest.php index 8fc0161f8a3..2106052347c 100644 --- a/tests/framework/db/mssql/CommandTest.php +++ b/tests/framework/db/mssql/CommandTest.php @@ -10,15 +10,19 @@ namespace yiiunit\framework\db\mssql; +use PHPUnit\Framework\Attri...
true
yiisoft/yii2
20,943
comment_to_fix
Fix MSSQL `QueryBuilder::renameTable()` to call `sp_rename` with string parameters and one-part new table names.
_🎯 Functional Correctness_ | _🟠 Major_ <details> <summary>🧩 Analysis chain</summary> 🌐 Web query: `In SQL Server `sp_rename`, for `@objtype = 'OBJECT'`, must `@newname` be provided as a one-part string value (not a multipart/qualified name)?` 💡 Result: Yes, when using sp_rename in SQL Server with `@objtype` =...
d649d0b90101e76e0265a558bc67e6f73af9985b
9d25e787f6dc05ccbbec81aca9a9599f8fd3d8bd
diff --git a/framework/db/mssql/QueryBuilder.php b/framework/db/mssql/QueryBuilder.php index 172313e8b1b..2e3ca115ce0 100644 --- a/framework/db/mssql/QueryBuilder.php +++ b/framework/db/mssql/QueryBuilder.php @@ -12,6 +12,8 @@ use yii\base\InvalidArgumentException; use yii\base\NotSupportedException; +use yii\db\co...
[ "framework/db/mssql/QueryBuilder.php" ]
[ { "comment": "_🎯 Functional Correctness_ | _🟠 Major_\n\n<details>\n<summary>🧩 Analysis chain</summary>\n\n🌐 Web query:\n\n`In SQL Server `sp_rename`, for `@objtype = 'OBJECT'`, must `@newname` be provided as a one-part string value (not a multipart/qualified name)?`\n\n💡 Result:\n\nYes, when using sp_renam...
true
yiisoft/yii2
20,943
comment_to_fix
Fix MSSQL `QueryBuilder::renameTable()` to call `sp_rename` with string parameters and one-part new table names.
_🩺 Stability & Availability_ | _🟡 Minor_ | _⚡ Quick win_ **Protect DB cleanup with `try/finally` in the data-provider test.** If an assertion or rename execution fails, the trailing cleanup loop is skipped and later datasets can fail due to leftover tables. Wrap the test body in `try/finally` and keep drops in `fin...
d649d0b90101e76e0265a558bc67e6f73af9985b
9d25e787f6dc05ccbbec81aca9a9599f8fd3d8bd
diff --git a/tests/framework/db/mssql/CommandTest.php b/tests/framework/db/mssql/CommandTest.php index 8fc0161f8a3..2106052347c 100644 --- a/tests/framework/db/mssql/CommandTest.php +++ b/tests/framework/db/mssql/CommandTest.php @@ -10,15 +10,19 @@ namespace yiiunit\framework\db\mssql; +use PHPUnit\Framework\Attri...
[ "tests/framework/db/mssql/CommandTest.php" ]
[ { "comment": "_🩺 Stability & Availability_ | _🟡 Minor_ | _⚡ Quick win_\n\n**Protect DB cleanup with `try/finally` in the data-provider test.**\n\nIf an assertion or rename execution fails, the trailing cleanup loop is skipped and later datasets can fail due to leftover tables. Wrap the test body in `try/final...
true
yiisoft/yii2
20,943
comment_to_fix
Fix MSSQL `QueryBuilder::renameTable()` to call `sp_rename` with string parameters and one-part new table names.
_🎯 Functional Correctness_ | _🟡 Minor_ | _⚡ Quick win_ **Add a schema-qualified `new` name case to enforce one-part normalization.** The provider currently exercises qualified *old* names but not qualified *new* names. Add a case like `new = 'dbo.some_table'` so runtime tests validate the one-part `@newname` contra...
d649d0b90101e76e0265a558bc67e6f73af9985b
9d25e787f6dc05ccbbec81aca9a9599f8fd3d8bd
diff --git a/tests/framework/db/mssql/providers/CommandProvider.php b/tests/framework/db/mssql/providers/CommandProvider.php new file mode 100644 index 00000000000..39362e09120 --- /dev/null +++ b/tests/framework/db/mssql/providers/CommandProvider.php @@ -0,0 +1,83 @@ +<?php + +declare(strict_types=1); + +/** + * @link...
[ "tests/framework/db/mssql/providers/CommandProvider.php" ]
[ { "comment": "_🎯 Functional Correctness_ | _🟡 Minor_ | _⚡ Quick win_\n\n**Add a schema-qualified `new` name case to enforce one-part normalization.**\n\nThe provider currently exercises qualified *old* names but not qualified *new* names. Add a case like `new = 'dbo.some_table'` so runtime tests validate the ...
true
yiisoft/yii2
20,942
issue_to_patch
Fix MSSQL `yii\db\mssql\QueryBuilder::alterColumn()` to drop column default, check, and unique constraints before the `ALTER COLUMN` statement, allowing column redefinition on constrained columns without duplicate constraint name errors.
| Q | A | ------------- | --- | Is bugfix? | ✔️ | New feature? | ❌ | Breaks BC? | ❌
f7cf36e0e55871ad9f34f400540941e03c58cc57
acd1ae3f18a74ea0c8ab0cf0265b8c862f85cf45
diff --git a/framework/CHANGELOG.md b/framework/CHANGELOG.md index b746d6500a0..f4ca42bbda6 100644 --- a/framework/CHANGELOG.md +++ b/framework/CHANGELOG.md @@ -92,7 +92,8 @@ Yii Framework 2 Change Log - Bug #20937: Exclude configurable system schema names from MSSQL `yii\db\Schema::getSchemaNames()` to match the non-...
[ "framework/CHANGELOG.md", "framework/db/mssql/QueryBuilder.php", "framework/db/mssql/Schema.php", "tests/framework/db/mssql/CommandTest.php", "tests/framework/db/mssql/QueryBuilderTest.php", "tests/framework/db/mssql/QueryBuilderUnionTest.php", "tests/framework/db/mssql/providers/QueryBuilderProvider.ph...
[ { "comment": "_⚠️ Potential issue_ | _🟠 Major_ | _⚡ Quick win_\n\n**Drop the same constraint types you recreate.**\n\nLine 156 removes only default constraints, but Lines 178-193 always append new `CHECK`/`UNIQUE` constraints when the builder still carries those modifiers. An `alterColumn()` on a column that a...
diff --git a/tests/framework/db/mssql/CommandTest.php b/tests/framework/db/mssql/CommandTest.php index 98d4a56a5e4..8fc0161f8a3 100644 --- a/tests/framework/db/mssql/CommandTest.php +++ b/tests/framework/db/mssql/CommandTest.php @@ -1,5 +1,7 @@ <?php +declare(strict_types=1); + /** * @link https://www.yiiframewor...
true
yiisoft/yii2
20,942
comment_to_fix
Fix MSSQL `yii\db\mssql\QueryBuilder::alterColumn()` to drop column default, check, and unique constraints before the `ALTER COLUMN` statement, allowing column redefinition on constrained columns without duplicate constraint name errors.
_⚠️ Potential issue_ | _🟠 Major_ | _⚡ Quick win_ **Drop the same constraint types you recreate.** Line 156 removes only default constraints, but Lines 178-193 always append new `CHECK`/`UNIQUE` constraints when the builder still carries those modifiers. An `alterColumn()` on a column that already has one of those co...
f7cf36e0e55871ad9f34f400540941e03c58cc57
acd1ae3f18a74ea0c8ab0cf0265b8c862f85cf45
diff --git a/framework/db/mssql/QueryBuilder.php b/framework/db/mssql/QueryBuilder.php index ceeb4dc33b8..172313e8b1b 100644 --- a/framework/db/mssql/QueryBuilder.php +++ b/framework/db/mssql/QueryBuilder.php @@ -15,9 +15,12 @@ use yii\db\Expression; use yii\db\Query; +use function array_flip; +use function array_i...
[ "framework/db/mssql/QueryBuilder.php" ]
[ { "comment": "_⚠️ Potential issue_ | _🟠 Major_ | _⚡ Quick win_\n\n**Drop the same constraint types you recreate.**\n\nLine 156 removes only default constraints, but Lines 178-193 always append new `CHECK`/`UNIQUE` constraints when the builder still carries those modifiers. An `alterColumn()` on a column that a...
true
yiisoft/yii2
20,942
comment_to_fix
Fix MSSQL `yii\db\mssql\QueryBuilder::alterColumn()` to drop column default, check, and unique constraints before the `ALTER COLUMN` statement, allowing column redefinition on constrained columns without duplicate constraint name errors.
_🧹 Nitpick_ | _🔵 Trivial_ | _⚡ Quick win_ **Pass explicit table names to `countDefaultConstraints()` for consistency.** Both `testAlterColumnWithCatalogQualifiedTable()` (Line 328) and `testAlterColumnReplacesDefaultValue()` (Line 357) call `countDefaultConstraints($db)` without passing the table parameter, default...
f7cf36e0e55871ad9f34f400540941e03c58cc57
acd1ae3f18a74ea0c8ab0cf0265b8c862f85cf45
diff --git a/tests/framework/db/mssql/CommandTest.php b/tests/framework/db/mssql/CommandTest.php index 98d4a56a5e4..8fc0161f8a3 100644 --- a/tests/framework/db/mssql/CommandTest.php +++ b/tests/framework/db/mssql/CommandTest.php @@ -1,5 +1,7 @@ <?php +declare(strict_types=1); + /** * @link https://www.yiiframewor...
[ "tests/framework/db/mssql/CommandTest.php" ]
[ { "comment": "_🧹 Nitpick_ | _🔵 Trivial_ | _⚡ Quick win_\n\n**Pass explicit table names to `countDefaultConstraints()` for consistency.**\n\nBoth `testAlterColumnWithCatalogQualifiedTable()` (Line 328) and `testAlterColumnReplacesDefaultValue()` (Line 357) call `countDefaultConstraints($db)` without passing th...
true
yiisoft/yii2
20,941
issue_to_patch
Modernize MSSQL `yii\db\mssql\Schema` internals and remove dead `unsigned` detection.
| Q | A | ------------- | --- | Is bugfix? | ❌ | New feature? | ✔️ | Breaks BC? | ❌
eb6de08ff4a6aa63e4f0f5f02c24c6074738a9e1
1cf903c5ce6584aa4a4bcca350191593c150a31d
diff --git a/framework/CHANGELOG.md b/framework/CHANGELOG.md index 8d00eb9e8da..b746d6500a0 100644 --- a/framework/CHANGELOG.md +++ b/framework/CHANGELOG.md @@ -92,6 +92,7 @@ Yii Framework 2 Change Log - Bug #20937: Exclude configurable system schema names from MSSQL `yii\db\Schema::getSchemaNames()` to match the non-...
[ "framework/CHANGELOG.md", "framework/db/mssql/Schema.php" ]
[]
true
yiisoft/yii2
20,939
issue_to_patch
Replace `strpos()` with `str_contains()` in `yii\db\Schema` quoting methods and fix `quoteValue()` `@param` to `mixed`.
| Q | A | ------------- | --- | Is bugfix? | ❌ | New feature? | ✔️ | Breaks BC? | ❌
733998b2a863e6c39e6389f35a2ab873957009a5
97bbd044b9a83e97ebfb0aa8ae339006afbdd1d0
diff --git a/framework/CHANGELOG.md b/framework/CHANGELOG.md index 6a59bb7b534..8d00eb9e8da 100644 --- a/framework/CHANGELOG.md +++ b/framework/CHANGELOG.md @@ -91,6 +91,7 @@ Yii Framework 2 Change Log - Chg #20936: Remove redundant `resolveTableNames()` from MSSQL, MySQL, PostgreSQL, and Oracle schema classes; `loadT...
[ "framework/CHANGELOG.md", "framework/db/Schema.php", "tests/base/db/BaseSchemaQuote.php", "tests/base/db/providers/SchemaProvider.php", "tests/framework/db/mssql/SchemaQuoteTest.php", "tests/framework/db/mssql/SchemaTest.php", "tests/framework/db/mssql/providers/SchemaProvider.php", "tests/framework/d...
[ { "comment": "_🧹 Nitpick_ | _🔵 Trivial_ | _⚡ Quick win_\n\n**Missing `str_starts_with` import for consistency.**\n\n`str_starts_with()` is used at line 513 but is not included in the function imports. While it will work as a global function in PHP 8+, adding it would maintain consistency with the other import...
diff --git a/tests/base/db/BaseSchemaQuote.php b/tests/base/db/BaseSchemaQuote.php new file mode 100644 index 00000000000..32542663970 --- /dev/null +++ b/tests/base/db/BaseSchemaQuote.php @@ -0,0 +1,119 @@ +<?php + +declare(strict_types=1); + +/** + * @link https://www.yiiframework.com/ + * @copyright Copyright (c) 20...
true
yiisoft/yii2
20,939
comment_to_fix
Replace `strpos()` with `str_contains()` in `yii\db\Schema` quoting methods and fix `quoteValue()` `@param` to `mixed`.
_🧹 Nitpick_ | _🔵 Trivial_ | _⚡ Quick win_ **Missing `str_starts_with` import for consistency.** `str_starts_with()` is used at line 513 but is not included in the function imports. While it will work as a global function in PHP 8+, adding it would maintain consistency with the other imported functions. <details> <...
733998b2a863e6c39e6389f35a2ab873957009a5
97bbd044b9a83e97ebfb0aa8ae339006afbdd1d0
diff --git a/framework/db/Schema.php b/framework/db/Schema.php index 1ad525aa732..f8f3600d7a8 100644 --- a/framework/db/Schema.php +++ b/framework/db/Schema.php @@ -1,5 +1,7 @@ <?php +declare(strict_types=1); + /** * @link https://www.yiiframework.com/ * @copyright Copyright (c) 2008 Yii Software LLC @@ -17,6 +...
[ "framework/db/Schema.php" ]
[ { "comment": "_🧹 Nitpick_ | _🔵 Trivial_ | _⚡ Quick win_\n\n**Missing `str_starts_with` import for consistency.**\n\n`str_starts_with()` is used at line 513 but is not included in the function imports. While it will work as a global function in PHP 8+, adding it would maintain consistency with the other import...
true
yiisoft/yii2
20,938
issue_to_patch
Fix MSSQL `QueryBuilder::dropConstraintsForColumn()` to drop primary key, foreign key, and table-level check constraints, replacing deprecated `sys.sysconstraints` with modern catalog views.
| Q | A | ------------- | --- | Is bugfix? | ✔️ | New feature? | ❌ | Breaks BC? | ❌
e67b0c44e8b227b2a5e597c34669b00f66d8cfb4
83366023c601e9f3e6325f87d340d60007c6f707
diff --git a/framework/CHANGELOG.md b/framework/CHANGELOG.md index 0d5fa53829e..6a59bb7b534 100644 --- a/framework/CHANGELOG.md +++ b/framework/CHANGELOG.md @@ -90,6 +90,7 @@ Yii Framework 2 Change Log - Bug #20935: Fix MSSQL index, foreign key, and constraint metadata lookups for catalog-qualified table names (teraby...
[ "framework/CHANGELOG.md", "framework/db/mssql/QueryBuilder.php", "tests/framework/db/mssql/QueryBuilderTest.php", "tests/framework/db/mssql/providers/QueryBuilderProvider.php" ]
[ { "comment": "_⚠️ Potential issue_ | _🟡 Minor_ | _⚡ Quick win_\n\n**Use changelog convention and correct change type on Line 93.**\n\nLine 93 should follow the section’s `<Type> #<id>:` format and be marked as a bugfix, not enhancement, to match PR `#20938` intent and keep changelog traceability consistent.\n\...
diff --git a/tests/framework/db/mssql/QueryBuilderTest.php b/tests/framework/db/mssql/QueryBuilderTest.php index 6ac820604a6..0f3accbd7cb 100644 --- a/tests/framework/db/mssql/QueryBuilderTest.php +++ b/tests/framework/db/mssql/QueryBuilderTest.php @@ -10,14 +10,20 @@ namespace yiiunit\framework\db\mssql; +use Clo...
true
yiisoft/yii2
20,938
comment_to_fix
Fix MSSQL `QueryBuilder::dropConstraintsForColumn()` to drop primary key, foreign key, and table-level check constraints, replacing deprecated `sys.sysconstraints` with modern catalog views.
_⚠️ Potential issue_ | _🟡 Minor_ | _⚡ Quick win_ **Use changelog convention and correct change type on Line 93.** Line 93 should follow the section’s `<Type> #<id>:` format and be marked as a bugfix, not enhancement, to match PR `#20938` intent and keep changelog traceability consistent. <details> <summary>Suggeste...
e67b0c44e8b227b2a5e597c34669b00f66d8cfb4
83366023c601e9f3e6325f87d340d60007c6f707
diff --git a/framework/CHANGELOG.md b/framework/CHANGELOG.md index 0d5fa53829e..6a59bb7b534 100644 --- a/framework/CHANGELOG.md +++ b/framework/CHANGELOG.md @@ -90,6 +90,7 @@ Yii Framework 2 Change Log - Bug #20935: Fix MSSQL index, foreign key, and constraint metadata lookups for catalog-qualified table names (teraby...
[ "framework/CHANGELOG.md" ]
[ { "comment": "_⚠️ Potential issue_ | _🟡 Minor_ | _⚡ Quick win_\n\n**Use changelog convention and correct change type on Line 93.**\n\nLine 93 should follow the section’s `<Type> #<id>:` format and be marked as a bugfix, not enhancement, to match PR `#20938` intent and keep changelog traceability consistent.\n\...
true
yiisoft/yii2
20,938
comment_to_fix
Fix MSSQL `QueryBuilder::dropConstraintsForColumn()` to drop primary key, foreign key, and table-level check constraints, replacing deprecated `sys.sysconstraints` with modern catalog views.
_⚠️ Potential issue_ | _🟠 Major_ | _⚡ Quick win_ **Escape the `DECLARE` literals before embedding table/column names.** `$tableName` and `$column` are interpolated directly into T-SQL string literals here. If either identifier contains `'`, the generated batch becomes invalid, so `alterColumn()` / `dropColumn()` bre...
e67b0c44e8b227b2a5e597c34669b00f66d8cfb4
83366023c601e9f3e6325f87d340d60007c6f707
diff --git a/framework/db/mssql/QueryBuilder.php b/framework/db/mssql/QueryBuilder.php index 5314bcebac5..ceeb4dc33b8 100644 --- a/framework/db/mssql/QueryBuilder.php +++ b/framework/db/mssql/QueryBuilder.php @@ -16,6 +16,8 @@ use yii\db\Query; use function count; +use function str_replace; +use function strpos; ...
[ "framework/db/mssql/QueryBuilder.php" ]
[ { "comment": "_⚠️ Potential issue_ | _🟠 Major_ | _⚡ Quick win_\n\n**Escape the `DECLARE` literals before embedding table/column names.**\n\n`$tableName` and `$column` are interpolated directly into T-SQL string literals here. If either identifier contains `'`, the generated batch becomes invalid, so `alterColu...
true
yiisoft/yii2
20,938
comment_to_fix
Fix MSSQL `QueryBuilder::dropConstraintsForColumn()` to drop primary key, foreign key, and table-level check constraints, replacing deprecated `sys.sysconstraints` with modern catalog views.
_⚠️ Potential issue_ | _🟠 Major_ | _🏗️ Heavy lift_ **This lookup no longer covers every constraint form that the helper is expected to drop.** `alterColumn()` creates CHECK constraints with table-level `ALTER TABLE ... ADD CONSTRAINT ... CHECK (...)` syntax, but `sys.check_constraints.parent_column_id` is `0` for t...
e67b0c44e8b227b2a5e597c34669b00f66d8cfb4
83366023c601e9f3e6325f87d340d60007c6f707
diff --git a/framework/db/mssql/QueryBuilder.php b/framework/db/mssql/QueryBuilder.php index 5314bcebac5..ceeb4dc33b8 100644 --- a/framework/db/mssql/QueryBuilder.php +++ b/framework/db/mssql/QueryBuilder.php @@ -16,6 +16,8 @@ use yii\db\Query; use function count; +use function str_replace; +use function strpos; ...
[ "framework/db/mssql/QueryBuilder.php" ]
[ { "comment": "_⚠️ Potential issue_ | _🟠 Major_ | _🏗️ Heavy lift_\n\n**This lookup no longer covers every constraint form that the helper is expected to drop.**\n\n`alterColumn()` creates CHECK constraints with table-level `ALTER TABLE ... ADD CONSTRAINT ... CHECK (...)` syntax, but `sys.check_constraints.pare...
true
yiisoft/yii2
20,938
comment_to_fix
Fix MSSQL `QueryBuilder::dropConstraintsForColumn()` to drop primary key, foreign key, and table-level check constraints, replacing deprecated `sys.sysconstraints` with modern catalog views.
_⚠️ Potential issue_ | _🟠 Major_ | _⚡ Quick win_ **Escape the column name before embedding it in the T-SQL string literal.** Line 626 embeds `$column` directly into `N'{$column}'`. If the column name contains a single quote (e.g., `my'col`—which is valid in SQL Server when created as `[my'col]`), the generated T-SQL...
e67b0c44e8b227b2a5e597c34669b00f66d8cfb4
83366023c601e9f3e6325f87d340d60007c6f707
diff --git a/framework/db/mssql/QueryBuilder.php b/framework/db/mssql/QueryBuilder.php index 5314bcebac5..ceeb4dc33b8 100644 --- a/framework/db/mssql/QueryBuilder.php +++ b/framework/db/mssql/QueryBuilder.php @@ -16,6 +16,8 @@ use yii\db\Query; use function count; +use function str_replace; +use function strpos; ...
[ "framework/db/mssql/QueryBuilder.php" ]
[ { "comment": "_⚠️ Potential issue_ | _🟠 Major_ | _⚡ Quick win_\n\n**Escape the column name before embedding it in the T-SQL string literal.**\n\nLine 626 embeds `$column` directly into `N'{$column}'`. If the column name contains a single quote (e.g., `my'col`—which is valid in SQL Server when created as `[my'c...
true
yiisoft/yii2
20,937
issue_to_patch
Exclude configurable system schema names from MSSQL `yii\db\Schema::getSchemaNames()` to match the non-system schema contract.
| Q | A | ------------- | --- | Is bugfix? | ✔️ | New feature? | ❌ | Breaks BC? | ❌
dce74588f25e6f3f221b571c0466c5787afa5172
7e1b4595c880d4cd677039cc7f82018e8fd19d71
diff --git a/framework/CHANGELOG.md b/framework/CHANGELOG.md index cecbaa5351b..0d5fa53829e 100644 --- a/framework/CHANGELOG.md +++ b/framework/CHANGELOG.md @@ -89,6 +89,7 @@ Yii Framework 2 Change Log - Enh #20934: Replace MSSQL `INFORMATION_SCHEMA.TABLES` in `Schema::findTableNames()` and `Schema::findViewNames()` w...
[ "framework/CHANGELOG.md", "framework/db/Schema.php", "framework/db/mssql/Schema.php", "tests/framework/db/mssql/SchemaTest.php", "tests/framework/db/mssql/providers/SchemaProvider.php" ]
[]
diff --git a/tests/framework/db/mssql/SchemaTest.php b/tests/framework/db/mssql/SchemaTest.php index e58dc020eee..57e6b8f9ab5 100644 --- a/tests/framework/db/mssql/SchemaTest.php +++ b/tests/framework/db/mssql/SchemaTest.php @@ -22,7 +22,9 @@ use yiiunit\base\db\BaseSchema; use yiiunit\framework\db\mssql\providers\Sc...
true
yiisoft/yii2
20,936
issue_to_patch
Remove redundant `resolveTableNames()` from MSSQL, MySQL, PostgreSQL, and Oracle schema classes; `loadTableSchema()` now uses `resolveTableName()`.
| Q | A | ------------- | --- | Is bugfix? | ✔️ | New feature? | ❌ | Breaks BC? | ✔️
5c2419a3be165643175da71cb1387e936af772c3
2f6e6dc3aa6b6dace4c62c08db1f6ae5bd350e90
diff --git a/framework/CHANGELOG.md b/framework/CHANGELOG.md index 0143d15d653..cecbaa5351b 100644 --- a/framework/CHANGELOG.md +++ b/framework/CHANGELOG.md @@ -88,6 +88,7 @@ Yii Framework 2 Change Log - Enh #20933: Replace MSSQL `INFORMATION_SCHEMA.KEY_COLUMN_USAGE` and `TABLE_CONSTRAINTS` in `Schema::findTableConstr...
[ "framework/CHANGELOG.md", "framework/UPGRADE-22.md", "framework/db/QueryBuilder.php", "framework/db/mssql/Schema.php", "framework/db/mysql/Schema.php", "framework/db/oci/Schema.php", "framework/db/pgsql/Schema.php", "tests/framework/db/mssql/SchemaTest.php", "tests/framework/db/oci/SchemaTest.php" ]
[ { "comment": "_⚠️ Potential issue_ | _🟡 Minor_ | _⚡ Quick win_\n\n**Use the quote-stripped single-part name here.**\n\nLine 86 falls back to `$name` instead of `$parts[0]`. For unqualified quoted input like `\"MyTable\"`, `TableSchema::$name` keeps the quotes, so the later `ALL_TAB_COLUMNS` / constraint lookup...
diff --git a/tests/framework/db/mssql/SchemaTest.php b/tests/framework/db/mssql/SchemaTest.php index e0edc64b2d9..e58dc020eee 100644 --- a/tests/framework/db/mssql/SchemaTest.php +++ b/tests/framework/db/mssql/SchemaTest.php @@ -364,48 +364,6 @@ public function testReleaseSavepointIsNoOp(): void $db->transacti...
true
yiisoft/yii2
20,936
comment_to_fix
Remove redundant `resolveTableNames()` from MSSQL, MySQL, PostgreSQL, and Oracle schema classes; `loadTableSchema()` now uses `resolveTableName()`.
_⚠️ Potential issue_ | _🟡 Minor_ | _⚡ Quick win_ **Use the quote-stripped single-part name here.** Line 86 falls back to `$name` instead of `$parts[0]`. For unqualified quoted input like `"MyTable"`, `TableSchema::$name` keeps the quotes, so the later `ALL_TAB_COLUMNS` / constraint lookups bind the wrong table name ...
5c2419a3be165643175da71cb1387e936af772c3
2f6e6dc3aa6b6dace4c62c08db1f6ae5bd350e90
diff --git a/framework/db/oci/Schema.php b/framework/db/oci/Schema.php index a7eaab8701c..a41379c6a61 100644 --- a/framework/db/oci/Schema.php +++ b/framework/db/oci/Schema.php @@ -25,6 +25,9 @@ use yii\helpers\ArrayHelper; use yii\db\Schema as BaseSchema; +use function explode; +use function str_replace; + /** ...
[ "framework/db/oci/Schema.php" ]
[ { "comment": "_⚠️ Potential issue_ | _🟡 Minor_ | _⚡ Quick win_\n\n**Use the quote-stripped single-part name here.**\n\nLine 86 falls back to `$name` instead of `$parts[0]`. For unqualified quoted input like `\"MyTable\"`, `TableSchema::$name` keeps the quotes, so the later `ALL_TAB_COLUMNS` / constraint lookup...
true
yiisoft/yii2
20,935
issue_to_patch
Fix MSSQL index, foreign key, and constraint metadata lookups for catalog-qualified table names.
| Q | A | ------------- | --- | Is bugfix? | ✔️ | New feature? | ❌ | Breaks BC? | ❌
2a68575dc822bdbef5795c9a726544dc9afc4b58
a2b067dc4dcd0cfd3df3e9531a0d945d8ec0ab64
diff --git a/framework/CHANGELOG.md b/framework/CHANGELOG.md index fd5dc0b4840..0143d15d653 100644 --- a/framework/CHANGELOG.md +++ b/framework/CHANGELOG.md @@ -87,6 +87,7 @@ Yii Framework 2 Change Log - Bug #20931: Fix `yii\caching\DbCache` MSSQL reference schema using the invalid `BLOB` type instead of `varbinary(ma...
[ "framework/CHANGELOG.md", "framework/db/mssql/Schema.php", "tests/framework/db/mssql/SchemaConstraintsTest.php", "tests/framework/db/mssql/providers/ConstraintsProvider.php" ]
[ { "comment": "_⚠️ Potential issue_ | _🟠 Major_ | _⚡ Quick win_\n\n**Ensure fixture cleanup runs on assertion failures.**\n\nCleanup currently runs only on the success path (e.g., Line 216, Line 266, Line 324, Line 366, Line 413, Line 460). If an assertion fails earlier, test tables are left behind and can casc...
diff --git a/tests/framework/db/mssql/SchemaConstraintsTest.php b/tests/framework/db/mssql/SchemaConstraintsTest.php index fa9212eba6e..3e441d55b64 100644 --- a/tests/framework/db/mssql/SchemaConstraintsTest.php +++ b/tests/framework/db/mssql/SchemaConstraintsTest.php @@ -12,7 +12,12 @@ use PHPUnit\Framework\Attribu...
true
yiisoft/yii2
20,935
comment_to_fix
Fix MSSQL index, foreign key, and constraint metadata lookups for catalog-qualified table names.
_⚠️ Potential issue_ | _🟠 Major_ | _⚡ Quick win_ **Ensure fixture cleanup runs on assertion failures.** Cleanup currently runs only on the success path (e.g., Line 216, Line 266, Line 324, Line 366, Line 413, Line 460). If an assertion fails earlier, test tables are left behind and can cascade into later failures. W...
2a68575dc822bdbef5795c9a726544dc9afc4b58
a2b067dc4dcd0cfd3df3e9531a0d945d8ec0ab64
diff --git a/tests/framework/db/mssql/SchemaConstraintsTest.php b/tests/framework/db/mssql/SchemaConstraintsTest.php index fa9212eba6e..3e441d55b64 100644 --- a/tests/framework/db/mssql/SchemaConstraintsTest.php +++ b/tests/framework/db/mssql/SchemaConstraintsTest.php @@ -12,7 +12,12 @@ use PHPUnit\Framework\Attribu...
[ "tests/framework/db/mssql/SchemaConstraintsTest.php" ]
[ { "comment": "_⚠️ Potential issue_ | _🟠 Major_ | _⚡ Quick win_\n\n**Ensure fixture cleanup runs on assertion failures.**\n\nCleanup currently runs only on the success path (e.g., Line 216, Line 266, Line 324, Line 366, Line 413, Line 460). If an assertion fails earlier, test tables are left behind and can casc...
true
yiisoft/yii2
20,934
issue_to_patch
Replace MSSQL `INFORMATION_SCHEMA.TABLES` in `Schema::findTableNames()` and `Schema::findViewNames()` with catalog-qualified `sys.objects` and `sys.views` catalog views.
| Q | A | ------------- | --- | Is bugfix? | ❌ | New feature? | ✔️ | Breaks BC? | ❌
5f5756712dabfb7ab5d9e69d2fc57888dd47aa6a
6634313dcb113c7491801279e38c9010c1a72e65
diff --git a/framework/CHANGELOG.md b/framework/CHANGELOG.md index 9717090f1ce..fd5dc0b4840 100644 --- a/framework/CHANGELOG.md +++ b/framework/CHANGELOG.md @@ -86,6 +86,7 @@ Yii Framework 2 Change Log - Bug #20931: Fix `yii\caching\DbCache` reading PostgreSQL `bytea` cached data as a stream by converting it in `yii\d...
[ "framework/CHANGELOG.md", "framework/db/mssql/Schema.php", "tests/framework/db/mssql/SchemaTest.php", "tests/framework/db/mssql/providers/SchemaProvider.php" ]
[]
diff --git a/tests/framework/db/mssql/SchemaTest.php b/tests/framework/db/mssql/SchemaTest.php index f198c44919f..e0edc64b2d9 100644 --- a/tests/framework/db/mssql/SchemaTest.php +++ b/tests/framework/db/mssql/SchemaTest.php @@ -13,6 +13,7 @@ use PHPUnit\Framework\Attributes\DataProviderExternal; use PHPUnit\Framewor...
true
yiisoft/yii2
20,933
issue_to_patch
Replace MSSQL `INFORMATION_SCHEMA.KEY_COLUMN_USAGE` and `TABLE_CONSTRAINTS` in `Schema::findTableConstraints()` with `sys.key_constraints`, and preserve composite key column order with `sys.index_columns.key_ordinal`.
| Q | A | ------------- | --- | Is bugfix? | ❌ | New feature? | ✔️ | Breaks BC? | ❌
97bbf066daeb5b3965712bf6bd15f2a5932d7f1a
e0714e7d61706fe9cb1b06655f52c06d454cb617
diff --git a/framework/CHANGELOG.md b/framework/CHANGELOG.md index cf5efb0b09b..9717090f1ce 100644 --- a/framework/CHANGELOG.md +++ b/framework/CHANGELOG.md @@ -85,6 +85,7 @@ Yii Framework 2 Change Log - Chg #19595: Store `yii\web\DbSession` `data` as `varbinary(max)` on MSSQL and cast it through `yii\db\mssql\ColumnS...
[ "framework/CHANGELOG.md", "framework/db/mssql/Schema.php", "tests/framework/db/mssql/SchemaConstraintsTest.php", "tests/framework/db/mssql/SchemaTest.php", "tests/framework/db/mssql/providers/ConstraintsProvider.php" ]
[]
diff --git a/tests/framework/db/mssql/SchemaConstraintsTest.php b/tests/framework/db/mssql/SchemaConstraintsTest.php index 9b25df270cd..fa9212eba6e 100644 --- a/tests/framework/db/mssql/SchemaConstraintsTest.php +++ b/tests/framework/db/mssql/SchemaConstraintsTest.php @@ -13,6 +13,8 @@ use PHPUnit\Framework\Attributes...
true
yiisoft/yii2
20,932
issue_to_patch
Sync to master brach.
| Q | A | ------------- | --- | Is bugfix? | ✔️ | New feature? | ❌ | Breaks BC? | ❌
49d41252e91b37aea87054bb5ca00993941d8e24
7329d0eeb9eac513c5de3fadb00034184096be96
diff --git a/docs/guide/caching-data.md b/docs/guide/caching-data.md index 89b1e54506b..6add029880c 100644 --- a/docs/guide/caching-data.md +++ b/docs/guide/caching-data.md @@ -281,6 +281,11 @@ Below is a summary of the available cache dependencies: the dependency associated with the cached data, if there is any, ha...
[ "docs/guide/caching-data.md", "docs/guide/security-authorization.md", "docs/guide/security-best-practices.md", "framework/CHANGELOG.md", "framework/log/FileTarget.php", "tests/framework/log/FileTargetTest.php", "tests/framework/web/HtmlResponseFormatterTest.php" ]
[]
diff --git a/tests/framework/log/FileTargetTest.php b/tests/framework/log/FileTargetTest.php index 580b5707528..c97928fa57c 100644 --- a/tests/framework/log/FileTargetTest.php +++ b/tests/framework/log/FileTargetTest.php @@ -113,6 +113,43 @@ public function testRotate(): void $this->assertFileDoesNotExist($log...
true
yiisoft/yii2
20,931
issue_to_patch
MSSql schema getting identity column fails when crossing databases ### Problem Active record schema inspection fails to identify MSSql identity columns in a specific circumstance. ### What steps will reproduce the problem? Using a CActiveRecord model with MSSql where tableName is something like ``` class Blah...
Fix MSSQL column discovery and binary data handling (DbSession, DbCache).
| Q | A | ------------- | --- | Is bugfix? | ✔️ | New feature? | ❌ | Breaks BC? | ✔️ | Fixed issues | #13048, #19595
bbd8de9c1b01fac1691264230eb4cbe96b52aec4
a8b50ef58f83e149535587b4b05cab39f00479b5
diff --git a/framework/CHANGELOG.md b/framework/CHANGELOG.md index df16c938709..a376426c642 100644 --- a/framework/CHANGELOG.md +++ b/framework/CHANGELOG.md @@ -81,6 +81,10 @@ Yii Framework 2 Change Log - Enh #20923: Add explicit default values to `ColumnSchema` properties in `yii\db`, `yii\db\mssql`, and `yii\db\pgsq...
[ "framework/CHANGELOG.md", "framework/UPGRADE-22.md", "framework/caching/DbCache.php", "framework/caching/migrations/schema-mssql.sql", "framework/db/ColumnSchema.php", "framework/db/mssql/ColumnSchema.php", "framework/db/mssql/Schema.php", "framework/db/pgsql/ColumnSchema.php", "framework/web/DbSess...
[ { "comment": "_🧹 Nitpick_ | _🔵 Trivial_ | _⚡ Quick win_\n\n**Consider explicit handling of stream read failures.**\n\nIf `stream_get_contents()` fails and returns `false`, the current code falls through to `parent::phpTypecast($value)`, which would likely convert `false` to an empty string for string-typed co...
diff --git a/tests/base/db/BaseSchema.php b/tests/base/db/BaseSchema.php index 0ae6bf96727..01c102a63fa 100644 --- a/tests/base/db/BaseSchema.php +++ b/tests/base/db/BaseSchema.php @@ -350,11 +350,6 @@ public function testQuoteSpecialNames(): void $schema->quoteTableName('{{%profile}}'), 'Tabl...
true
yiisoft/yii2
20,931
comment_to_fix
Fix MSSQL column discovery and binary data handling (DbSession, DbCache).
_🧹 Nitpick_ | _🔵 Trivial_ | _⚡ Quick win_ **Consider explicit handling of stream read failures.** If `stream_get_contents()` fails and returns `false`, the current code falls through to `parent::phpTypecast($value)`, which would likely convert `false` to an empty string for string-typed columns. This could mask str...
bbd8de9c1b01fac1691264230eb4cbe96b52aec4
a8b50ef58f83e149535587b4b05cab39f00479b5
diff --git a/framework/db/mssql/ColumnSchema.php b/framework/db/mssql/ColumnSchema.php index 2bfe4705605..63ab85f6b9d 100644 --- a/framework/db/mssql/ColumnSchema.php +++ b/framework/db/mssql/ColumnSchema.php @@ -11,12 +11,18 @@ namespace yii\db\mssql; use yii\db\Expression; +use yii\db\PdoValue; use function bi...
[ "framework/db/mssql/ColumnSchema.php" ]
[ { "comment": "_🧹 Nitpick_ | _🔵 Trivial_ | _⚡ Quick win_\n\n**Consider explicit handling of stream read failures.**\n\nIf `stream_get_contents()` fails and returns `false`, the current code falls through to `parent::phpTypecast($value)`, which would likely convert `false` to an empty string for string-typed co...
true
yiisoft/yii2
20,931
comment_to_fix
Fix MSSQL column discovery and binary data handling (DbSession, DbCache).
_🧹 Nitpick_ | _🔵 Trivial_ | _⚡ Quick win_ **Consider explicit handling of stream read failures.** Similar to the MSSQL implementation, if `stream_get_contents()` fails and returns `false`, it falls through to `parent::phpTypecast($value)` on line 132, which could convert the failure to an empty string. This would m...
bbd8de9c1b01fac1691264230eb4cbe96b52aec4
a8b50ef58f83e149535587b4b05cab39f00479b5
diff --git a/framework/db/pgsql/ColumnSchema.php b/framework/db/pgsql/ColumnSchema.php index cdc67ba91c9..77fe2bab6f4 100644 --- a/framework/db/pgsql/ColumnSchema.php +++ b/framework/db/pgsql/ColumnSchema.php @@ -16,11 +16,14 @@ use yii\db\JsonExpression; use function bindec; +use function get_resource_type; use f...
[ "framework/db/pgsql/ColumnSchema.php" ]
[ { "comment": "_🧹 Nitpick_ | _🔵 Trivial_ | _⚡ Quick win_\n\n**Consider explicit handling of stream read failures.**\n\nSimilar to the MSSQL implementation, if `stream_get_contents()` fails and returns `false`, it falls through to `parent::phpTypecast($value)` on line 132, which could convert the failure to an ...
true
yiisoft/yii2
20,931
comment_to_fix
Fix MSSQL column discovery and binary data handling (DbSession, DbCache).
_🧹 Nitpick_ | _🔵 Trivial_ | _⚡ Quick win_ **Add property type hint for consistency.** The `$value` property should be typed as `private string $value;` to match the constructor parameter type and maintain consistency with `declare(strict_types=1)`. <details> <summary>♻️ Proposed fix</summary> ```diff - pri...
bbd8de9c1b01fac1691264230eb4cbe96b52aec4
a8b50ef58f83e149535587b4b05cab39f00479b5
diff --git a/tests/data/base/StringableObject.php b/tests/data/base/StringableObject.php new file mode 100644 index 00000000000..c6cb716166e --- /dev/null +++ b/tests/data/base/StringableObject.php @@ -0,0 +1,28 @@ +<?php + +declare(strict_types=1); + +/** + * @link https://www.yiiframework.com/ + * @copyright Copyrigh...
[ "tests/data/base/StringableObject.php" ]
[ { "comment": "_🧹 Nitpick_ | _🔵 Trivial_ | _⚡ Quick win_\n\n**Add property type hint for consistency.**\n\nThe `$value` property should be typed as `private string $value;` to match the constructor parameter type and maintain consistency with `declare(strict_types=1)`.\n\n\n\n\n\n<details>\n<summary>♻️ Propose...
true
yiisoft/yii2
20,888
issue_to_patch
Fix #20261: Preserve modification time when rotating log files
| Q | A | ------------- | --- | Is bugfix? | ❌ | New feature? | ❌ | Tests added? | ✔️ | Breaks BC? | ❌ | Fixed issues | #20261 ## What does this PR do? Preserves the modification time of a log file when `yii\log\FileTarget` rotates it by copy, so the rotated file's mtime reflects when t...
d77f4bb160c3a405a91f66da9893b7f617d79093
53ca5c032828766d3b4de391490dc97881cbcbcf
diff --git a/framework/CHANGELOG.md b/framework/CHANGELOG.md index 9b8f2906284..eecb82c2708 100644 --- a/framework/CHANGELOG.md +++ b/framework/CHANGELOG.md @@ -18,6 +18,7 @@ Yii Framework 2 Change Log - Bug #20891: Fix `@property` annotation for `Request::$bodyParams` (mspirkov) - Bug #20889: Remove unreachable PHP ...
[ "framework/CHANGELOG.md", "framework/log/FileTarget.php", "tests/framework/log/FileTargetTest.php" ]
[ { "comment": "`@touch($newFile, $mtime)` runs even when `@copy()` fails. Since `touch()` creates the file when it doesn't exist, a failed copy (I/O error, or a concurrent rotation that unlinks the destination) could leave behind an empty\nrotated file. Gating the touch on a successful copy avoids that:\n\n```ph...
diff --git a/tests/framework/log/FileTargetTest.php b/tests/framework/log/FileTargetTest.php index 8e722377dc7..96956c41b0f 100644 --- a/tests/framework/log/FileTargetTest.php +++ b/tests/framework/log/FileTargetTest.php @@ -113,6 +113,43 @@ public function testRotate(): void $this->assertFileDoesNotExist($log...
true
yiisoft/yii2
20,888
comment_to_fix
Fix #20261: Preserve modification time when rotating log files
`@touch($newFile, $mtime)` runs even when `@copy()` fails. Since `touch()` creates the file when it doesn't exist, a failed copy (I/O error, or a concurrent rotation that unlinks the destination) could leave behind an empty rotated file. Gating the touch on a successful copy avoids that: ```php private function rotate...
d77f4bb160c3a405a91f66da9893b7f617d79093
53ca5c032828766d3b4de391490dc97881cbcbcf
diff --git a/framework/log/FileTarget.php b/framework/log/FileTarget.php index 8dd8e3bff7d..acb16008a46 100644 --- a/framework/log/FileTarget.php +++ b/framework/log/FileTarget.php @@ -194,7 +194,12 @@ private function clearLogFile($rotateFile) */ private function rotateByCopy($rotateFile, $newFile) { -...
[ "framework/log/FileTarget.php" ]
[ { "comment": "`@touch($newFile, $mtime)` runs even when `@copy()` fails. Since `touch()` creates the file when it doesn't exist, a failed copy (I/O error, or a concurrent rotation that unlinks the destination) could leave behind an empty\nrotated file. Gating the touch on a successful copy avoids that:\n\n```ph...
true
yiisoft/yii2
20,930
issue_to_patch
Add schema providers and enhance schema tests for across databases.
| Q | A | ------------- | --- | Is bugfix? | ✔️ | New feature? | ❌ | Breaks BC? | ❌
139635be2d0ad344811aedb901655430d8022cb6
e37a601487433ddf6117292d7911bef850954f8a
diff --git a/composer.lock b/composer.lock index 2ba14915eb7..73fba923ac7 100644 --- a/composer.lock +++ b/composer.lock @@ -389,16 +389,16 @@ }, { "name": "composer/composer", - "version": "2.10.0", + "version": "2.10.1", "source": { "t...
[ "composer.lock", "phpstan-baseline.neon", "tests/base/db/BaseActiveRecord.php", "tests/base/db/BaseColumnSchema.php", "tests/base/db/BaseCommand.php", "tests/base/db/BaseConnection.php", "tests/base/db/BaseQuery.php", "tests/base/db/BaseSchema.php", "tests/base/db/BaseSchemaCache.php", "tests/base...
[ { "comment": "_⚠️ Potential issue_ | _🔴 Critical_ | _⚡ Quick win_\n\n**Incorrect parameter in refreshTableSchema call.**\n\nLine 222 passes `$testTablePrefix` (a prefix like `\"ty\"`) to `refreshTableSchema()`, but the method expects a table name, not a prefix. This should be `$testTableName` to match the patt...
diff --git a/tests/base/db/BaseActiveRecord.php b/tests/base/db/BaseActiveRecord.php index f6584f819e2..09f689e0bca 100644 --- a/tests/base/db/BaseActiveRecord.php +++ b/tests/base/db/BaseActiveRecord.php @@ -1920,9 +1920,13 @@ public function testValueEscapingInFindByCondition(string $modelClassName, array public...
true
yiisoft/yii2
20,930
comment_to_fix
Add schema providers and enhance schema tests for across databases.
_⚠️ Potential issue_ | _🔴 Critical_ | _⚡ Quick win_ **Incorrect parameter in refreshTableSchema call.** Line 222 passes `$testTablePrefix` (a prefix like `"ty"`) to `refreshTableSchema()`, but the method expects a table name, not a prefix. This should be `$testTableName` to match the pattern at line 205. <detail...
139635be2d0ad344811aedb901655430d8022cb6
e37a601487433ddf6117292d7911bef850954f8a
diff --git a/tests/base/db/BaseSchemaCache.php b/tests/base/db/BaseSchemaCache.php new file mode 100644 index 00000000000..6d20e268723 --- /dev/null +++ b/tests/base/db/BaseSchemaCache.php @@ -0,0 +1,242 @@ +<?php + +declare(strict_types=1); + +/** + * @link https://www.yiiframework.com/ + * @copyright Copyright (c) 20...
[ "tests/base/db/BaseSchemaCache.php" ]
[ { "comment": "_⚠️ Potential issue_ | _🔴 Critical_ | _⚡ Quick win_\n\n**Incorrect parameter in refreshTableSchema call.**\n\nLine 222 passes `$testTablePrefix` (a prefix like `\"ty\"`) to `refreshTableSchema()`, but the method expects a table name, not a prefix. This should be `$testTableName` to match the patt...
true
yiisoft/yii2
20,930
comment_to_fix
Add schema providers and enhance schema tests for across databases.
_🧹 Nitpick_ | _🔵 Trivial_ | _💤 Low value_ **Consider combining the two array_walk calls.** Lines 282-289 and 291-298 share the same condition (`!in_array($name, ['char_col', 'char_col2', 'char_col3'])`) and iterate over the same array. Combining them into a single walk would reduce overhead and improve clarity. ...
139635be2d0ad344811aedb901655430d8022cb6
e37a601487433ddf6117292d7911bef850954f8a
diff --git a/tests/framework/db/mssql/providers/ColumnSchemaProvider.php b/tests/framework/db/mssql/providers/ColumnSchemaProvider.php index b083f9538ea..1f0ee606e71 100644 --- a/tests/framework/db/mssql/providers/ColumnSchemaProvider.php +++ b/tests/framework/db/mssql/providers/ColumnSchemaProvider.php @@ -13,15 +13,1...
[ "tests/framework/db/mssql/providers/ColumnSchemaProvider.php" ]
[ { "comment": "_🧹 Nitpick_ | _🔵 Trivial_ | _💤 Low value_\n\n**Consider combining the two array_walk calls.**\n\nLines 282-289 and 291-298 share the same condition (`!in_array($name, ['char_col', 'char_col2', 'char_col3'])`) and iterate over the same array. Combining them into a single walk would reduce overhe...
true
yiisoft/yii2
20,930
comment_to_fix
Add schema providers and enhance schema tests for across databases.
_⚠️ Potential issue_ | _🔴 Critical_ | _⚡ Quick win_ **Fix PHP 7.4 compatibility: non-capturing catch syntax is not supported.** Line 72 uses `catch (Exception)` without a variable, which is PHP 8.0+ syntax. This codebase targets PHP 7.4, so you must include a variable in the catch clause. <details> <summary>🛡️ ...
139635be2d0ad344811aedb901655430d8022cb6
e37a601487433ddf6117292d7911bef850954f8a
diff --git a/tests/framework/db/oci/SchemaConstraintsTest.php b/tests/framework/db/oci/SchemaConstraintsTest.php new file mode 100644 index 00000000000..b2e2634f024 --- /dev/null +++ b/tests/framework/db/oci/SchemaConstraintsTest.php @@ -0,0 +1,159 @@ +<?php + +declare(strict_types=1); + +/** + * @link https://www.yiif...
[ "tests/framework/db/oci/SchemaConstraintsTest.php" ]
[ { "comment": "_⚠️ Potential issue_ | _🔴 Critical_ | _⚡ Quick win_\n\n**Fix PHP 7.4 compatibility: non-capturing catch syntax is not supported.**\n\nLine 72 uses `catch (Exception)` without a variable, which is PHP 8.0+ syntax. This codebase targets PHP 7.4, so you must include a variable in the catch clause.\n...
true
yiisoft/yii2
20,930
comment_to_fix
Add schema providers and enhance schema tests for across databases.
_⚠️ Potential issue_ | _🟡 Minor_ | _⚡ Quick win_ **Use strict comparison for null check.** Replace `==` with `===` for null comparison to follow strict comparison best practices. <details> <summary>🔧 Proposed fix</summary> ```diff - if (static::$db == null) { + if (static::$db === null) { ``` </de...
139635be2d0ad344811aedb901655430d8022cb6
e37a601487433ddf6117292d7911bef850954f8a
diff --git a/tests/framework/log/SqliteTargetTest.php b/tests/framework/log/SqliteTargetTest.php index 6d31077550e..95ef3ff4202 100644 --- a/tests/framework/log/SqliteTargetTest.php +++ b/tests/framework/log/SqliteTargetTest.php @@ -8,24 +8,52 @@ namespace yiiunit\framework\log; +use PHPUnit\Framework\Attributes\G...
[ "tests/framework/log/SqliteTargetTest.php" ]
[ { "comment": "_⚠️ Potential issue_ | _🟡 Minor_ | _⚡ Quick win_\n\n**Use strict comparison for null check.**\n\nReplace `==` with `===` for null comparison to follow strict comparison best practices.\n\n\n\n<details>\n<summary>🔧 Proposed fix</summary>\n\n```diff\n- if (static::$db == null) {\n+ i...
true
yiisoft/yii2
20,929
issue_to_patch
Fix `yii\db\oci\Schema::insert()` returning only the first primary key value for composite keys, caused by a reused `foreach` reference.
| Q | A | ------------- | --- | Is bugfix? | ✔️ | New feature? | ❌ | Breaks BC? | ❌ | Fixed issues | <!-- comma-separated list of tickets # fixed by the PR, if any -->
3cbf93b4b003f27438e0d16ef1a121f3ac5da329
36459e36083b06ecf1974a4425371811f02b201f
diff --git a/framework/CHANGELOG.md b/framework/CHANGELOG.md index c8d49bd0d9e..df16c938709 100644 --- a/framework/CHANGELOG.md +++ b/framework/CHANGELOG.md @@ -80,6 +80,7 @@ Yii Framework 2 Change Log - Enh #20922: Consolidate SQLite data-type conversion into `ColumnSchema::defaultPhpTypecast()` and fix `DEFAULT NULL...
[ "framework/CHANGELOG.md", "framework/db/oci/Schema.php", "tests/base/db/BaseSchema.php", "tests/framework/db/oci/ActiveRecordTest.php" ]
[]
diff --git a/tests/base/db/BaseSchema.php b/tests/base/db/BaseSchema.php index 0b3bdf1579f..a880c1fdeb3 100644 --- a/tests/base/db/BaseSchema.php +++ b/tests/base/db/BaseSchema.php @@ -254,6 +254,42 @@ public function testCompositeFk(): void $this->assertEquals('item_id', $table->foreignKeys['FK_composite_fk_o...
true
yiisoft/yii2
20,928
issue_to_patch
Remove legacy MySQL version support code from `yii\db\mysql\Schema`.
| Q | A | ------------- | --- | Is bugfix? | ✔️ | New feature? | ❌ | Breaks BC? | ✔️
3ca89c7b91f2dcfb99f43622566674e83ec736d2
3a91ee3753d901c6b9f3e69761e5cefb6741a444
diff --git a/docs/guide/db-dao.md b/docs/guide/db-dao.md index 4249a03157a..2e7519583bf 100644 --- a/docs/guide/db-dao.md +++ b/docs/guide/db-dao.md @@ -11,16 +11,12 @@ you have to take extra effort to create a database-agnostic application. In Yii 2.0, DAO supports the following databases out of the box: -- [MySQ...
[ "docs/guide/db-dao.md", "framework/CHANGELOG.md", "framework/UPGRADE-22.md", "framework/db/mssql/Schema.php", "framework/db/mysql/Schema.php" ]
[]
true
yiisoft/yii2
20,913
issue_to_patch
Hardening: consider safer serialization formats for cache and RBAC storage Yii2 currently uses PHP serialization for some trusted persistence formats, including cache entries with dependencies and RBAC item/rule data. This is expected behavior today and is not directly exploitable through normal Yii APIs: an attacker ...
Remove unreachable PHP < 7 cookie deserialization fallback in `yii\web\Request::loadCookies()`.
| Q | A | ------------- | --- | Is bugfix? | ✔️ | New feature? | ❌ | Breaks BC? | ❌ | Fixed issues | #20889
a560bc87616ce4334b05ce4619122dd872bd8696
40df4d9f060bd741d97b15a9be191c3e598ed0a7
diff --git a/docs/guide/caching-data.md b/docs/guide/caching-data.md index 89b1e54506b..6add029880c 100644 --- a/docs/guide/caching-data.md +++ b/docs/guide/caching-data.md @@ -281,6 +281,11 @@ Below is a summary of the available cache dependencies: the dependency associated with the cached data, if there is any, ha...
[ "docs/guide/caching-data.md", "docs/guide/security-authorization.md", "docs/guide/security-best-practices.md", "framework/CHANGELOG.md", "framework/web/Request.php" ]
[ { "comment": "_⚠️ Potential issue_ | _🟡 Minor_ | _⚡ Quick win_\n\n<details>\n<summary>🧩 Analysis chain</summary>\n\n🏁 Script executed:\n\n```shell\n#!/bin/bash\nset -euo pipefail\n\necho \"== Cache serializer API ==\"\nrg -n -C3 '\\$serializer|serialize\\(|unserialize\\(' framework docs --iglob '*Cache*.php'...
true
yiisoft/yii2
20,913
comment_to_fix
Remove unreachable PHP < 7 cookie deserialization fallback in `yii\web\Request::loadCookies()`.
_⚠️ Potential issue_ | _🟡 Minor_ | _⚡ Quick win_ <details> <summary>🧩 Analysis chain</summary> 🏁 Script executed: ```shell #!/bin/bash set -euo pipefail echo "== Cache serializer API ==" rg -n -C3 '\$serializer|serialize\(|unserialize\(' framework docs --iglob '*Cache*.php' --iglob '*.md' ``` Repository: yiisof...
a560bc87616ce4334b05ce4619122dd872bd8696
40df4d9f060bd741d97b15a9be191c3e598ed0a7
diff --git a/docs/guide/security-best-practices.md b/docs/guide/security-best-practices.md index 291575c846f..6e0380d4011 100644 --- a/docs/guide/security-best-practices.md +++ b/docs/guide/security-best-practices.md @@ -269,6 +269,27 @@ Avoiding arbitrary object instantiations Yii [configurations](concept-configurati...
[ "docs/guide/security-best-practices.md" ]
[ { "comment": "_⚠️ Potential issue_ | _🟡 Minor_ | _⚡ Quick win_\n\n<details>\n<summary>🧩 Analysis chain</summary>\n\n🏁 Script executed:\n\n```shell\n#!/bin/bash\nset -euo pipefail\n\necho \"== Cache serializer API ==\"\nrg -n -C3 '\\$serializer|serialize\\(|unserialize\\(' framework docs --iglob '*Cache*.php'...
true
yiisoft/yii2
20,913
comment_to_fix
Remove unreachable PHP < 7 cookie deserialization fallback in `yii\web\Request::loadCookies()`.
_🧹 Nitpick_ | _🔵 Trivial_ | _⚡ Quick win_ **Consider breaking the long sentence for better readability.** Lines 282-284 form a complex sentence with a semicolon that lists cache dependencies and two RBAC implementations. Consider splitting this into separate sentences for clarity. <details> <summary>✏️ Suggeste...
a560bc87616ce4334b05ce4619122dd872bd8696
40df4d9f060bd741d97b15a9be191c3e598ed0a7
diff --git a/docs/guide/security-best-practices.md b/docs/guide/security-best-practices.md index 291575c846f..6e0380d4011 100644 --- a/docs/guide/security-best-practices.md +++ b/docs/guide/security-best-practices.md @@ -269,6 +269,27 @@ Avoiding arbitrary object instantiations Yii [configurations](concept-configurati...
[ "docs/guide/security-best-practices.md" ]
[ { "comment": "_🧹 Nitpick_ | _🔵 Trivial_ | _⚡ Quick win_\n\n**Consider breaking the long sentence for better readability.**\n\nLines 282-284 form a complex sentence with a semicolon that lists cache dependencies and two RBAC implementations. Consider splitting this into separate sentences for clarity.\n\n\n\n\...
true
yiisoft/yii2
20,913
comment_to_fix
Remove unreachable PHP < 7 cookie deserialization fallback in `yii\web\Request::loadCookies()`.
`allowed_classes => false` prevents PHP from instantiating application classes, but it can still return `__PHP_Incomplete_Class` for a serialized object payload. So “cookie values can never instantiate objects” is broader than the guarantee the code provides. Could you reword this to say Yii prevents application/gadget...
a560bc87616ce4334b05ce4619122dd872bd8696
40df4d9f060bd741d97b15a9be191c3e598ed0a7
diff --git a/docs/guide/security-best-practices.md b/docs/guide/security-best-practices.md index 291575c846f..6e0380d4011 100644 --- a/docs/guide/security-best-practices.md +++ b/docs/guide/security-best-practices.md @@ -269,6 +269,27 @@ Avoiding arbitrary object instantiations Yii [configurations](concept-configurati...
[ "docs/guide/security-best-practices.md" ]
[ { "comment": "`allowed_classes => false` prevents PHP from instantiating application classes, but it can still return `__PHP_Incomplete_Class` for a serialized object payload. So “cookie values can never instantiate objects” is broader than the guarantee the code provides. Could you reword this to say Yii preve...
true
yiisoft/yii2
20,913
comment_to_fix
Remove unreachable PHP < 7 cookie deserialization fallback in `yii\web\Request::loadCookies()`.
This warning says both columns contain rule data, but `DbManager` stores actual rule objects in `auth_rule.data` and arbitrary item data from `Item::$data` in `auth_item.data` (`addItem()`/`updateItem()`). Please reword this as “rule and item data”, or name `auth_item.data` separately, so the docs match the storage mod...
a560bc87616ce4334b05ce4619122dd872bd8696
40df4d9f060bd741d97b15a9be191c3e598ed0a7
diff --git a/docs/guide/security-authorization.md b/docs/guide/security-authorization.md index 52ebc4be3fe..f95be603201 100644 --- a/docs/guide/security-authorization.md +++ b/docs/guide/security-authorization.md @@ -252,6 +252,13 @@ Read more about working with migrations from different namespaces in The `authManag...
[ "docs/guide/security-authorization.md" ]
[ { "comment": "This warning says both columns contain rule data, but `DbManager` stores actual rule objects in `auth_rule.data` and arbitrary item data from `Item::$data` in `auth_item.data` (`addItem()`/`updateItem()`). Please reword this as “rule and item data”, or name `auth_item.data` separately, so the docs...
true
yiisoft/yii2
20,778
issue_to_patch
Add unit tests for `HtmlResponseFormatter`
| Q | A | ------------- | --- | Is bugfix? | :x: | New feature? | :x: | Breaks BC? | :x: | Fixed issues | ## What does this PR do? Add unit tests for `HtmlResponseFormatter`: charset appending logic, content type preservation, data-to-content copy, and null data handling. ### Before / ...
8d6afeafb71db84cc1ce5313726794c5e219f659
e7126ca4374c1e0ba90df3b90ee7b1756379ac8e
[ "tests/framework/web/HtmlResponseFormatterTest.php" ]
[ { "comment": "_🧹 Nitpick_ | _🔵 Trivial_ | _⚡ Quick win_\n\n**Remove redundant `tearDown()` override (or delegate only to parent).**\n\nLine 34-38 manually calls `destroyApplication()` before `parent::tearDown()`, but `yiiunit\\TestCase::tearDown()` already performs destruction in the expected lifecycle. This ...
diff --git a/tests/framework/web/HtmlResponseFormatterTest.php b/tests/framework/web/HtmlResponseFormatterTest.php new file mode 100644 index 00000000000..c295e604fdf --- /dev/null +++ b/tests/framework/web/HtmlResponseFormatterTest.php @@ -0,0 +1,141 @@ +<?php + +/** + * @link https://www.yiiframework.com/ + * @copyri...
true
yiisoft/yii2
20,778
comment_to_fix
Add unit tests for `HtmlResponseFormatter`
_🧹 Nitpick_ | _🔵 Trivial_ | _⚡ Quick win_ **Remove redundant `tearDown()` override (or delegate only to parent).** Line 34-38 manually calls `destroyApplication()` before `parent::tearDown()`, but `yiiunit\TestCase::tearDown()` already performs destruction in the expected lifecycle. This is redundant and reverses t...
8d6afeafb71db84cc1ce5313726794c5e219f659
e7126ca4374c1e0ba90df3b90ee7b1756379ac8e
diff --git a/tests/framework/web/HtmlResponseFormatterTest.php b/tests/framework/web/HtmlResponseFormatterTest.php new file mode 100644 index 00000000000..c295e604fdf --- /dev/null +++ b/tests/framework/web/HtmlResponseFormatterTest.php @@ -0,0 +1,141 @@ +<?php + +/** + * @link https://www.yiiframework.com/ + * @copyri...
[ "tests/framework/web/HtmlResponseFormatterTest.php" ]
[ { "comment": "_🧹 Nitpick_ | _🔵 Trivial_ | _⚡ Quick win_\n\n**Remove redundant `tearDown()` override (or delegate only to parent).**\n\nLine 34-38 manually calls `destroyApplication()` before `parent::tearDown()`, but `yiiunit\\TestCase::tearDown()` already performs destruction in the expected lifecycle. This ...
true
yiisoft/yii2
20,923
issue_to_patch
Add explicit default values to `ColumnSchema` properties in `yii\db`, `yii\db\mssql`, and `yii\db\pgsql`.
| Q | A | ------------- | --- | Is bugfix? | ❌ | New feature? | ✔️ | Breaks BC? | ❌
ba34f48ec0600011280fd5a47149a086c2990ce0
7248b49ef0e89838d4fcce74bc34c1cb722288b0
diff --git a/framework/CHANGELOG.md b/framework/CHANGELOG.md index 4dab8855cc8..a55f8f17121 100644 --- a/framework/CHANGELOG.md +++ b/framework/CHANGELOG.md @@ -78,6 +78,7 @@ Yii Framework 2 Change Log - Enh #20920: Consolidate Oracle data-type conversion into `ColumnSchema::defaultPhpTypecast()` and fix `CURRENT_TIME...
[ "framework/CHANGELOG.md", "framework/db/ColumnSchema.php", "framework/db/mssql/ColumnSchema.php", "framework/db/mysql/ColumnSchema.php", "framework/db/oci/ColumnSchema.php", "framework/db/pgsql/ColumnSchema.php" ]
[]
true
yiisoft/yii2
20,922
issue_to_patch
Consolidate SQLite data-type conversion into `ColumnSchema::defaultPhpTypecast()` and fix `DEFAULT NULL` and escaped-quote defaults.
| Q | A | ------------- | --- | Is bugfix? | ❌ | New feature? | ✔️ | Breaks BC? | ❌
8580d5e073fe8f487cc4e82fcb759d80c02fecf1
484ddedb10d9733c58c456bf70ab66db605a71e4
diff --git a/framework/CHANGELOG.md b/framework/CHANGELOG.md index 239d235bd84..4dab8855cc8 100644 --- a/framework/CHANGELOG.md +++ b/framework/CHANGELOG.md @@ -77,6 +77,7 @@ Yii Framework 2 Change Log - Enh #20919: Consolidate MySQL data-type conversion into `ColumnSchema::defaultPhpTypecast()` and preserve explicit ...
[ "framework/CHANGELOG.md", "framework/db/sqlite/ColumnSchema.php", "framework/db/sqlite/Schema.php", "tests/framework/db/sqlite/ColumnSchemaTest.php", "tests/framework/db/sqlite/SchemaTest.php", "tests/framework/db/sqlite/providers/ColumnSchemaProvider.php" ]
[ { "comment": "_⚠️ Potential issue_ | _🟠 Major_ | _⚡ Quick win_\n\n**Preserve non-string defaults before coercing to SQLite text.**\n\nThis override string-casts every non-null input, so the public `defaultPhpTypecast()` API no longer behaves like the base class for already-typed values or expression/query obje...
diff --git a/tests/framework/db/sqlite/ColumnSchemaTest.php b/tests/framework/db/sqlite/ColumnSchemaTest.php new file mode 100644 index 00000000000..fe922914241 --- /dev/null +++ b/tests/framework/db/sqlite/ColumnSchemaTest.php @@ -0,0 +1,72 @@ +<?php + +declare(strict_types=1); + +/** + * @link https://www.yiiframewor...
true
yiisoft/yii2
20,922
comment_to_fix
Consolidate SQLite data-type conversion into `ColumnSchema::defaultPhpTypecast()` and fix `DEFAULT NULL` and escaped-quote defaults.
_⚠️ Potential issue_ | _🟠 Major_ | _⚡ Quick win_ **Preserve non-string defaults before coercing to SQLite text.** This override string-casts every non-null input, so the public `defaultPhpTypecast()` API no longer behaves like the base class for already-typed values or expression/query objects. A non-string fast pat...
8580d5e073fe8f487cc4e82fcb759d80c02fecf1
484ddedb10d9733c58c456bf70ab66db605a71e4
diff --git a/framework/db/sqlite/ColumnSchema.php b/framework/db/sqlite/ColumnSchema.php new file mode 100644 index 00000000000..a597e347da8 --- /dev/null +++ b/framework/db/sqlite/ColumnSchema.php @@ -0,0 +1,71 @@ +<?php + +declare(strict_types=1); + +/** + * @link https://www.yiiframework.com/ + * @copyright Copyrigh...
[ "framework/db/sqlite/ColumnSchema.php" ]
[ { "comment": "_⚠️ Potential issue_ | _🟠 Major_ | _⚡ Quick win_\n\n**Preserve non-string defaults before coercing to SQLite text.**\n\nThis override string-casts every non-null input, so the public `defaultPhpTypecast()` API no longer behaves like the base class for already-typed values or expression/query obje...
true
yiisoft/yii2
20,922
comment_to_fix
Consolidate SQLite data-type conversion into `ColumnSchema::defaultPhpTypecast()` and fix `DEFAULT NULL` and escaped-quote defaults.
_🛠️ Refactor suggestion_ | _🟠 Major_ | _⚡ Quick win_ **Drop the temporary tables in a `finally` block.** These tests mutate the shared SQLite schema but only clean up before creation. If an assertion fails, or later `BaseSchema` tests reuse the same database, the leftover tables make the suite order-dependent. ...
8580d5e073fe8f487cc4e82fcb759d80c02fecf1
484ddedb10d9733c58c456bf70ab66db605a71e4
diff --git a/tests/framework/db/sqlite/SchemaTest.php b/tests/framework/db/sqlite/SchemaTest.php index 2bec2152078..295bcd95230 100644 --- a/tests/framework/db/sqlite/SchemaTest.php +++ b/tests/framework/db/sqlite/SchemaTest.php @@ -1,5 +1,7 @@ <?php +declare(strict_types=1); + /** * @link https://www.yiiframewor...
[ "tests/framework/db/sqlite/SchemaTest.php" ]
[ { "comment": "_🛠️ Refactor suggestion_ | _🟠 Major_ | _⚡ Quick win_\n\n**Drop the temporary tables in a `finally` block.**\n\nThese tests mutate the shared SQLite schema but only clean up before creation. If an assertion fails, or later `BaseSchema` tests reuse the same database, the leftover tables make the s...
true
yiisoft/yii2
20,921
issue_to_patch
Consolidate PostgreSQL data-type conversion into `ColumnSchema::defaultPhpTypecast()` and fix `phpTypecastValue()` for native boolean value.
| Q | A | ------------- | --- | Is bugfix? | ❌ | New feature? | ✔️ | Breaks BC? | ❌
f768e13701ba32a6d557a26e2ba3b9c301c0b122
5bd44e31fb7caa46c6f27fab2190b6927b43e1cb
diff --git a/framework/CHANGELOG.md b/framework/CHANGELOG.md index ce362f02035..239d235bd84 100644 --- a/framework/CHANGELOG.md +++ b/framework/CHANGELOG.md @@ -33,49 +33,50 @@ Yii Framework 2 Change Log - Enh #20801: Update PHP `8.3` and PHPUnit `11.5` compatibility (terabytesoftw) - Chg #20804: Remove Yii runtime a...
[ "framework/CHANGELOG.md", "framework/db/pgsql/ColumnSchema.php", "framework/db/pgsql/Schema.php", "tests/framework/db/mssql/SchemaTest.php", "tests/framework/db/mysql/SchemaTest.php", "tests/framework/db/oci/SchemaTest.php", "tests/framework/db/pgsql/ColumnSchemaTest.php", "tests/framework/db/pgsql/Sc...
[ { "comment": "_⚠️ Potential issue_ | _🟡 Minor_ | _⚡ Quick win_\n\n**Add the PR reference in this changelog item.**\n\nPlease include the PR number (e.g., `Enh #<PR_NUMBER>:`) for consistency and traceability in `framework/CHANGELOG.md`. \n \n\nBased on learnings, `framework/CHANGELOG.md` entries in this repos...
diff --git a/tests/framework/db/mssql/SchemaTest.php b/tests/framework/db/mssql/SchemaTest.php index 2711cc07193..5b8f7e71901 100644 --- a/tests/framework/db/mssql/SchemaTest.php +++ b/tests/framework/db/mssql/SchemaTest.php @@ -8,6 +8,7 @@ namespace yiiunit\framework\db\mssql; +use PHPUnit\Framework\Attributes\Gr...
true
yiisoft/yii2
20,921
comment_to_fix
Consolidate PostgreSQL data-type conversion into `ColumnSchema::defaultPhpTypecast()` and fix `phpTypecastValue()` for native boolean value.
_⚠️ Potential issue_ | _🟡 Minor_ | _⚡ Quick win_ **Add the PR reference in this changelog item.** Please include the PR number (e.g., `Enh #<PR_NUMBER>:`) for consistency and traceability in `framework/CHANGELOG.md`. Based on learnings, `framework/CHANGELOG.md` entries in this repository should reference the pu...
f768e13701ba32a6d557a26e2ba3b9c301c0b122
5bd44e31fb7caa46c6f27fab2190b6927b43e1cb
diff --git a/framework/CHANGELOG.md b/framework/CHANGELOG.md index ce362f02035..239d235bd84 100644 --- a/framework/CHANGELOG.md +++ b/framework/CHANGELOG.md @@ -33,49 +33,50 @@ Yii Framework 2 Change Log - Enh #20801: Update PHP `8.3` and PHPUnit `11.5` compatibility (terabytesoftw) - Chg #20804: Remove Yii runtime a...
[ "framework/CHANGELOG.md" ]
[ { "comment": "_⚠️ Potential issue_ | _🟡 Minor_ | _⚡ Quick win_\n\n**Add the PR reference in this changelog item.**\n\nPlease include the PR number (e.g., `Enh #<PR_NUMBER>:`) for consistency and traceability in `framework/CHANGELOG.md`. \n \n\nBased on learnings, `framework/CHANGELOG.md` entries in this repos...
true
yiisoft/yii2
20,921
comment_to_fix
Consolidate PostgreSQL data-type conversion into `ColumnSchema::defaultPhpTypecast()` and fix `phpTypecastValue()` for native boolean value.
_⚠️ Potential issue_ | _🟠 Major_ | _⚡ Quick win_ **Typecast zero defaults before storing schema metadata.** Line 551 still gates the new caster on PHP truthiness, so a reflected `column_default` of `'0'` never reaches `defaultPhpTypecast()`. Integer columns declared with `DEFAULT 0` will keep the raw string instead ...
f768e13701ba32a6d557a26e2ba3b9c301c0b122
5bd44e31fb7caa46c6f27fab2190b6927b43e1cb
diff --git a/framework/db/pgsql/Schema.php b/framework/db/pgsql/Schema.php index 3d71ee60084..f5e2a5883a4 100644 --- a/framework/db/pgsql/Schema.php +++ b/framework/db/pgsql/Schema.php @@ -16,7 +16,6 @@ use yii\db\Constraint; use yii\db\ConstraintFinderInterface; use yii\db\ConstraintFinderTrait; -use yii\db\Express...
[ "framework/db/pgsql/Schema.php" ]
[ { "comment": "_⚠️ Potential issue_ | _🟠 Major_ | _⚡ Quick win_\n\n**Typecast zero defaults before storing schema metadata.**\n\nLine 551 still gates the new caster on PHP truthiness, so a reflected `column_default` of `'0'` never reaches `defaultPhpTypecast()`. Integer columns declared with `DEFAULT 0` will ke...
true
yiisoft/yii2
20,921
comment_to_fix
Consolidate PostgreSQL data-type conversion into `ColumnSchema::defaultPhpTypecast()` and fix `phpTypecastValue()` for native boolean value.
_⚠️ Potential issue_ | _🟠 Major_ | _⚡ Quick win_ **Preserve `nextval(...)` defaults on non-primary auto-increment columns.** `loadColumnSchema()` still marks `nextval(...)` defaults as auto-increment and extracts `sequenceName` at Line 585-Line 590, but this branch now typecasts every non-null non-PK default. With t...
f768e13701ba32a6d557a26e2ba3b9c301c0b122
5bd44e31fb7caa46c6f27fab2190b6927b43e1cb
diff --git a/framework/db/pgsql/Schema.php b/framework/db/pgsql/Schema.php index 3d71ee60084..f5e2a5883a4 100644 --- a/framework/db/pgsql/Schema.php +++ b/framework/db/pgsql/Schema.php @@ -16,7 +16,6 @@ use yii\db\Constraint; use yii\db\ConstraintFinderInterface; use yii\db\ConstraintFinderTrait; -use yii\db\Express...
[ "framework/db/pgsql/Schema.php" ]
[ { "comment": "_⚠️ Potential issue_ | _🟠 Major_ | _⚡ Quick win_\n\n**Preserve `nextval(...)` defaults on non-primary auto-increment columns.**\n\n`loadColumnSchema()` still marks `nextval(...)` defaults as auto-increment and extracts `sequenceName` at Line 585-Line 590, but this branch now typecasts every non-n...
true
yiisoft/yii2
20,882
issue_to_patch
Fix `Sort::createUrl()` and `Pagination::createUrl()` to fall back when no controller is active, supporting standalone actions discovered through `Module::$actionNamespace`.
| Q | A | ------------- | --- | Is bugfix? | ✔️ | New feature? | ❌ | Breaks BC? | ❌
fa9bd28bebb2da0540a516cd5e903a5f4b3583c0
b76577b1b0ca285bac4fe7ec39d84c19696b2207
diff --git a/composer.lock b/composer.lock index 595956640b4..48ea4d43e72 100644 --- a/composer.lock +++ b/composer.lock @@ -1426,11 +1426,11 @@ }, { "name": "phpstan/phpstan", - "version": "2.1.54", + "version": "2.1.55", "dist": { "typ...
[ "composer.lock", "framework/CHANGELOG.md", "framework/data/Pagination.php", "framework/data/Sort.php", "tests/framework/data/PaginationTest.php", "tests/framework/data/SortTest.php" ]
[ { "comment": "_⚠️ Potential issue_ | _🟡 Minor_ | _⚡ Quick win_\n\n<details>\n<summary>🧩 Analysis chain</summary>\n\n🏁 Script executed:\n\n```shell\n#!/bin/bash\nset -euo pipefail\n\n# Verify whether the repo already contains subclasses of Pagination\n# or additional resolveRoute() declarations that could be ...
diff --git a/tests/framework/data/PaginationTest.php b/tests/framework/data/PaginationTest.php index da532d8bd79..b2614735d40 100644 --- a/tests/framework/data/PaginationTest.php +++ b/tests/framework/data/PaginationTest.php @@ -1,5 +1,7 @@ <?php +declare(strict_types=1); + /** * @link https://www.yiiframework.co...
true
yiisoft/yii2
20,882
comment_to_fix
Fix `Sort::createUrl()` and `Pagination::createUrl()` to fall back when no controller is active, supporting standalone actions discovered through `Module::$actionNamespace`.
_⚠️ Potential issue_ | _🟡 Minor_ | _⚡ Quick win_ <details> <summary>🧩 Analysis chain</summary> 🏁 Script executed: ```shell #!/bin/bash set -euo pipefail # Verify whether the repo already contains subclasses of Pagination # or additional resolveRoute() declarations that could be signature-sensitive. rg -nP --type...
fa9bd28bebb2da0540a516cd5e903a5f4b3583c0
b76577b1b0ca285bac4fe7ec39d84c19696b2207
diff --git a/framework/data/Pagination.php b/framework/data/Pagination.php index a45a43b7f61..959d96813ee 100644 --- a/framework/data/Pagination.php +++ b/framework/data/Pagination.php @@ -10,6 +10,7 @@ use Yii; use yii\base\BaseObject; +use yii\base\InvalidConfigException; use yii\web\Link; use yii\web\Linkable;...
[ "framework/data/Pagination.php" ]
[ { "comment": "_⚠️ Potential issue_ | _🟡 Minor_ | _⚡ Quick win_\n\n<details>\n<summary>🧩 Analysis chain</summary>\n\n🏁 Script executed:\n\n```shell\n#!/bin/bash\nset -euo pipefail\n\n# Verify whether the repo already contains subclasses of Pagination\n# or additional resolveRoute() declarations that could be ...
true
yiisoft/yii2
20,920
issue_to_patch
Consolidate Oracle data-type conversion into `ColumnSchema::defaultPhpTypecast()` and fix `CURRENT_TIMESTAMP` defaults returned as `null`.
| Q | A | ------------- | --- | Is bugfix? | ❌ | New feature? | ✔️ | Breaks BC? | ❌
dd4ad5da511cc181a308e33134be805ac60ff92a
68cc9b7726f29ce7f9c38f10ece38d0417221487
diff --git a/framework/CHANGELOG.md b/framework/CHANGELOG.md index ed7fa663cfd..ce362f02035 100644 --- a/framework/CHANGELOG.md +++ b/framework/CHANGELOG.md @@ -75,6 +75,7 @@ Yii Framework 2 Change Log - Bug: Fix `yii\helpers\Url::current()` and `yii\helpers\Url::canonical()` to fall back to `Application::$requestedRo...
[ "framework/CHANGELOG.md", "framework/db/ColumnSchema.php", "framework/db/mssql/ColumnSchema.php", "framework/db/oci/ColumnSchema.php", "framework/db/oci/Schema.php", "tests/framework/db/ColumnSchemaTest.php", "tests/framework/db/mssql/ColumnSchemaTest.php", "tests/framework/db/mysql/ColumnSchemaTest.p...
[ { "comment": "_⚠️ Potential issue_ | _🟡 Minor_ | _⚡ Quick win_\n\n**Make the `NULL` literal check case-insensitive.**\n\nOracle stores `DATA_DEFAULT` text verbatim, so a column defined with lowercase `DEFAULT null` arrives here as `'null'` and bypasses this guard. It then falls through to `parent::defaultPhpTy...
diff --git a/tests/framework/db/ColumnSchemaTest.php b/tests/framework/db/ColumnSchemaTest.php index 8668046a006..1bc9d1d8825 100644 --- a/tests/framework/db/ColumnSchemaTest.php +++ b/tests/framework/db/ColumnSchemaTest.php @@ -1,7 +1,10 @@ <?php +declare(strict_types=1); + namespace yiiunit\framework\db; +use P...
true
yiisoft/yii2
20,920
comment_to_fix
Consolidate Oracle data-type conversion into `ColumnSchema::defaultPhpTypecast()` and fix `CURRENT_TIMESTAMP` defaults returned as `null`.
_⚠️ Potential issue_ | _🟡 Minor_ | _⚡ Quick win_ **Make the `NULL` literal check case-insensitive.** Oracle stores `DATA_DEFAULT` text verbatim, so a column defined with lowercase `DEFAULT null` arrives here as `'null'` and bypasses this guard. It then falls through to `parent::defaultPhpTypecast()` and (for string ...
dd4ad5da511cc181a308e33134be805ac60ff92a
68cc9b7726f29ce7f9c38f10ece38d0417221487
diff --git a/framework/db/oci/ColumnSchema.php b/framework/db/oci/ColumnSchema.php index 5cd44570c49..b61c08b1997 100644 --- a/framework/db/oci/ColumnSchema.php +++ b/framework/db/oci/ColumnSchema.php @@ -14,11 +14,21 @@ use yii\db\PdoValue; use function is_string; +use function preg_match; use function str_replac...
[ "framework/db/oci/ColumnSchema.php" ]
[ { "comment": "_⚠️ Potential issue_ | _🟡 Minor_ | _⚡ Quick win_\n\n**Make the `NULL` literal check case-insensitive.**\n\nOracle stores `DATA_DEFAULT` text verbatim, so a column defined with lowercase `DEFAULT null` arrives here as `'null'` and bypasses this guard. It then falls through to `parent::defaultPhpTy...
true
yiisoft/yii2
20,919
issue_to_patch
Consolidate MySQL data-type conversion into `ColumnSchema::defaultPhpTypecast()` and preserve explicit `CURRENT_TIMESTAMP(0)` default precision.
| Q | A | ------------- | --- | Is bugfix? | ❌ | New feature? | ✔️ | Breaks BC? | ❌
07d7a582d5f29295a341688fa607d9229e8f473b
507ac9e31afbbc08f7b49016195c6d4b1be0da24
diff --git a/framework/CHANGELOG.md b/framework/CHANGELOG.md index 7dda5e33deb..ed7fa663cfd 100644 --- a/framework/CHANGELOG.md +++ b/framework/CHANGELOG.md @@ -74,6 +74,7 @@ Yii Framework 2 Change Log - Bug: Fix `Sort::createUrl()` and `Pagination::createUrl()` to fall back when no controller is active, supporting st...
[ "framework/CHANGELOG.md", "framework/db/mysql/ColumnSchema.php", "framework/db/mysql/Schema.php", "tests/framework/db/mysql/ColumnSchemaTest.php", "tests/framework/db/mysql/SchemaTest.php", "tests/framework/db/mysql/providers/ColumnSchemaProvider.php" ]
[]
diff --git a/tests/framework/db/mysql/ColumnSchemaTest.php b/tests/framework/db/mysql/ColumnSchemaTest.php new file mode 100644 index 00000000000..0ad0c895c6c --- /dev/null +++ b/tests/framework/db/mysql/ColumnSchemaTest.php @@ -0,0 +1,72 @@ +<?php + +declare(strict_types=1); + +/** + * @link https://www.yiiframework.c...
true
yiisoft/yii2
20,918
issue_to_patch
Consolidate MSSQL data-type conversion into `ColumnSchema`: harden `defaultPhpTypecast()` for unicode (`N'...'`), escaped quotes, and expression defaults; add `getOutputColumnDeclaration()` used by `QueryBuilder::insert()`.
| Q | A | ------------- | --- | Is bugfix? | ❌ | New feature? | ✔️ | Breaks BC? | ❌
bb89a9d0526e9286d4559a8e51d43cb51dd66cba
bd90ac83e38cf4a96f5c4985aed2b65f999c4033
diff --git a/composer.lock b/composer.lock index 48ea4d43e72..2ba14915eb7 100644 --- a/composer.lock +++ b/composer.lock @@ -248,16 +248,16 @@ }, { "name": "composer/ca-bundle", - "version": "1.5.11", + "version": "1.5.12", "source": { "...
[ "composer.lock", "framework/CHANGELOG.md", "framework/db/mssql/ColumnSchema.php", "framework/db/mssql/QueryBuilder.php", "framework/db/mssql/Schema.php", "phpstan-baseline.neon", "tests/framework/db/mssql/ColumnSchemaTest.php", "tests/framework/db/mssql/SchemaTest.php", "tests/framework/db/mssql/pro...
[ { "comment": "_⚠️ Potential issue_ | _🟡 Minor_ | _⚡ Quick win_\n\n**Add a combined unicode + escaped-quote default case**\n\nThe hardening target includes unicode literals and escaped quotes; add a single case such as `(N'it''s') => \"it's\"` to cover the combined parsing path and prevent regressions.\n\n \n\n...
diff --git a/tests/framework/db/mssql/ColumnSchemaTest.php b/tests/framework/db/mssql/ColumnSchemaTest.php new file mode 100644 index 00000000000..34144da741b --- /dev/null +++ b/tests/framework/db/mssql/ColumnSchemaTest.php @@ -0,0 +1,110 @@ +<?php + +declare(strict_types=1); + +/** + * @link https://www.yiiframework....
true
yiisoft/yii2
20,918
comment_to_fix
Consolidate MSSQL data-type conversion into `ColumnSchema`: harden `defaultPhpTypecast()` for unicode (`N'...'`), escaped quotes, and expression defaults; add `getOutputColumnDeclaration()` used by `QueryBuilder::insert()`.
_⚠️ Potential issue_ | _🟡 Minor_ | _⚡ Quick win_ **Add a combined unicode + escaped-quote default case** The hardening target includes unicode literals and escaped quotes; add a single case such as `(N'it''s') => "it's"` to cover the combined parsing path and prevent regressions. <details> <summary>Suggested pro...
bb89a9d0526e9286d4559a8e51d43cb51dd66cba
bd90ac83e38cf4a96f5c4985aed2b65f999c4033
diff --git a/tests/framework/db/mssql/providers/ColumnSchemaProvider.php b/tests/framework/db/mssql/providers/ColumnSchemaProvider.php new file mode 100644 index 00000000000..b083f9538ea --- /dev/null +++ b/tests/framework/db/mssql/providers/ColumnSchemaProvider.php @@ -0,0 +1,243 @@ +<?php + +declare(strict_types=1); ...
[ "tests/framework/db/mssql/providers/ColumnSchemaProvider.php" ]
[ { "comment": "_⚠️ Potential issue_ | _🟡 Minor_ | _⚡ Quick win_\n\n**Add a combined unicode + escaped-quote default case**\n\nThe hardening target includes unicode literals and escaped quotes; add a single case such as `(N'it''s') => \"it's\"` to cover the combined parsing path and prevent regressions.\n\n \n\n...
true
yiisoft/yii2
20,918
comment_to_fix
Consolidate MSSQL data-type conversion into `ColumnSchema`: harden `defaultPhpTypecast()` for unicode (`N'...'`), escaped quotes, and expression defaults; add `getOutputColumnDeclaration()` used by `QueryBuilder::insert()`.
_⚠️ Potential issue_ | _🟡 Minor_ | _⚡ Quick win_ **Add coverage for pre-sized `char(n)` / `nchar(n)` dbType values** `Schema` commonly provides `char`/`nchar` with embedded size in `dbType`; this provider currently tests only bare names. Please add cases like `char(10)` and `nchar(20)` to ensure `getOutputColumnDecl...
bb89a9d0526e9286d4559a8e51d43cb51dd66cba
bd90ac83e38cf4a96f5c4985aed2b65f999c4033
diff --git a/tests/framework/db/mssql/providers/ColumnSchemaProvider.php b/tests/framework/db/mssql/providers/ColumnSchemaProvider.php new file mode 100644 index 00000000000..b083f9538ea --- /dev/null +++ b/tests/framework/db/mssql/providers/ColumnSchemaProvider.php @@ -0,0 +1,243 @@ +<?php + +declare(strict_types=1); ...
[ "tests/framework/db/mssql/providers/ColumnSchemaProvider.php" ]
[ { "comment": "_⚠️ Potential issue_ | _🟡 Minor_ | _⚡ Quick win_\n\n**Add coverage for pre-sized `char(n)` / `nchar(n)` dbType values**\n\n`Schema` commonly provides `char`/`nchar` with embedded size in `dbType`; this provider currently tests only bare names. Please add cases like `char(10)` and `nchar(20)` to e...
true
yiisoft/yii2
20,917
issue_to_patch
Sync to master brach.
| Q | A | ------------- | --- | Is bugfix? | ✔️ | New feature? | ❌ | Breaks BC? | ❌
066e168d674268637bb568cd40c31a106a4e1412
32151face43e1e9fb2dcfd65def3161cc1cf458c
diff --git a/build/controllers/ReleaseController.php b/build/controllers/ReleaseController.php index 4ffa7142f05..e7c36cf436a 100644 --- a/build/controllers/ReleaseController.php +++ b/build/controllers/ReleaseController.php @@ -854,6 +854,7 @@ protected function openChangelogs($what, $version) protected function ...
[ "build/controllers/ReleaseController.php", "framework/CHANGELOG.md", "framework/i18n/PhpMessageSource.php", "tests/framework/ReleaseControllerTest.php", "tests/framework/i18n/PhpMessageSourceTest.php", "tests/framework/i18n/stubs/ExposedPhpMessageSource.php" ]
[]
diff --git a/tests/framework/ReleaseControllerTest.php b/tests/framework/ReleaseControllerTest.php new file mode 100644 index 00000000000..a11769c4182 --- /dev/null +++ b/tests/framework/ReleaseControllerTest.php @@ -0,0 +1,160 @@ +<?php + +/** + * @link https://www.yiiframework.com/ + * @copyright Copyright (c) 2008 Y...
true
yiisoft/yii2
20,916
issue_to_patch
Refactor category provider methods in `PhpMessageSourceTest` to static.
| Q | A | ------------- | --- | Is bugfix? | ✔️ | New feature? | ❌ | Breaks BC? | ❌
7b8d9d3c146d6860d0f5fcaf43d491012df3a828
cc76865a9010a565cfb45ea5b072bc53b92dac1b
[ "tests/framework/i18n/PhpMessageSourceTest.php" ]
[]
diff --git a/tests/framework/i18n/PhpMessageSourceTest.php b/tests/framework/i18n/PhpMessageSourceTest.php index 48895781039..52f8ed949e9 100644 --- a/tests/framework/i18n/PhpMessageSourceTest.php +++ b/tests/framework/i18n/PhpMessageSourceTest.php @@ -35,7 +35,7 @@ protected function setUp(): void * * @ret...
true
yiisoft/yii2
20,895
issue_to_patch
Harden PhpMessageSource category path handling `yii\i18n\PhpMessageSource` builds message file paths from the translation category. Category names intentionally support slash-separated namespaces such as `app/error`, `modules/users/validation`, and `widgets/menu/messages`, but unsafe path segments are currently not re...
Harden `yii\i18n\PhpMessageSource` category path handling to reject `..` segments, absolute paths, and stream-wrapper categories.
| Q | A | ------------- | --- | Is bugfix? | ✔️ | New feature? | ❌ | Breaks BC? | ❌ | Fixed issues | #20890
3dea6d59b9a54e1eaa599081ae30bfd4a976d69a
1f4fb57bd147ea7b4870ed260d14197da4da3770
diff --git a/framework/CHANGELOG.md b/framework/CHANGELOG.md index 4bba8cbfa39..3a9a40dca30 100644 --- a/framework/CHANGELOG.md +++ b/framework/CHANGELOG.md @@ -16,6 +16,7 @@ Yii Framework 2 Change Log - Bug #20891: Fix `@return` annotation for `RequestParserInterface::parse()`, `JsonParser::parse()`, `Request::getBod...
[ "framework/CHANGELOG.md", "framework/i18n/PhpMessageSource.php", "tests/framework/i18n/PhpMessageSourceTest.php", "tests/framework/i18n/stubs/ExposedPhpMessageSource.php" ]
[ { "comment": "_⚠️ Potential issue_ | _🟠 Major_ | _⚡ Quick win_\n\n**Don't overconstrain the first category segment.**\n\nThis regex now rejects safe relative categories whose first segment starts with `.` or `-` (for example, `.messages`), even though they still resolve under `basePath` and are outside the thr...
diff --git a/tests/framework/i18n/PhpMessageSourceTest.php b/tests/framework/i18n/PhpMessageSourceTest.php new file mode 100644 index 00000000000..48895781039 --- /dev/null +++ b/tests/framework/i18n/PhpMessageSourceTest.php @@ -0,0 +1,195 @@ +<?php + +/** + * @link https://www.yiiframework.com/ + * @copyright Copyrigh...
true
yiisoft/yii2
20,895
comment_to_fix
Harden `yii\i18n\PhpMessageSource` category path handling to reject `..` segments, absolute paths, and stream-wrapper categories.
_⚠️ Potential issue_ | _🟠 Major_ | _⚡ Quick win_ **Don't overconstrain the first category segment.** This regex now rejects safe relative categories whose first segment starts with `.` or `-` (for example, `.messages`), even though they still resolve under `basePath` and are outside the threat model described in thi...
3dea6d59b9a54e1eaa599081ae30bfd4a976d69a
1f4fb57bd147ea7b4870ed260d14197da4da3770
diff --git a/framework/i18n/PhpMessageSource.php b/framework/i18n/PhpMessageSource.php index 8ef075e4744..fc1033c666e 100644 --- a/framework/i18n/PhpMessageSource.php +++ b/framework/i18n/PhpMessageSource.php @@ -11,6 +11,9 @@ use Yii; use yii\base\InvalidArgumentException; +use function sprintf; +use function str_...
[ "framework/i18n/PhpMessageSource.php" ]
[ { "comment": "_⚠️ Potential issue_ | _🟠 Major_ | _⚡ Quick win_\n\n**Don't overconstrain the first category segment.**\n\nThis regex now rejects safe relative categories whose first segment starts with `.` or `-` (for example, `.messages`), even though they still resolve under `basePath` and are outside the thr...
true
yiisoft/yii2
20,895
comment_to_fix
Harden `yii\i18n\PhpMessageSource` category path handling to reject `..` segments, absolute paths, and stream-wrapper categories.
_⚠️ Potential issue_ | _🟠 Major_ | _⚡ Quick win_ **Narrow the drive-letter check to actual absolute Windows paths.** `^[A-Za-z]:` also rejects safe relative categories like `app:errors`, which still resolve under `basePath` and are not stream-wrapper inputs. That broadens the hardening beyond the PR contract and int...
3dea6d59b9a54e1eaa599081ae30bfd4a976d69a
1f4fb57bd147ea7b4870ed260d14197da4da3770
diff --git a/framework/i18n/PhpMessageSource.php b/framework/i18n/PhpMessageSource.php index 8ef075e4744..fc1033c666e 100644 --- a/framework/i18n/PhpMessageSource.php +++ b/framework/i18n/PhpMessageSource.php @@ -11,6 +11,9 @@ use Yii; use yii\base\InvalidArgumentException; +use function sprintf; +use function str_...
[ "framework/i18n/PhpMessageSource.php" ]
[ { "comment": "_⚠️ Potential issue_ | _🟠 Major_ | _⚡ Quick win_\n\n**Narrow the drive-letter check to actual absolute Windows paths.**\n\n`^[A-Za-z]:` also rejects safe relative categories like `app:errors`, which still resolve under `basePath` and are not stream-wrapper inputs. That broadens the hardening beyo...
true
yiisoft/yii2
20,911
issue_to_patch
Fix release changelog version detection
## Summary - keep the release command's selected version authoritative - update the active CHANGELOG `under development` section to the selected version before sorting - normalize invalid `Fix #...` changelog entries to canonical `Bug #...` before sorting - fail loudly when no matching changelog section exists after th...
540c7de68aad91907481f8cb34ba97ae91aec973
2ebf83509323de04076ddf5d9ca9552741595a93
diff --git a/build/controllers/ReleaseController.php b/build/controllers/ReleaseController.php index b5f53881186..e7c36cf436a 100644 --- a/build/controllers/ReleaseController.php +++ b/build/controllers/ReleaseController.php @@ -854,6 +854,7 @@ protected function openChangelogs($what, $version) protected function ...
[ "build/controllers/ReleaseController.php", "tests/framework/ReleaseControllerTest.php" ]
[ { "comment": "_⚠️ Potential issue_ | _🟠 Major_ | _⚡ Quick win_\n\n**Use exact version-boundary matching when locating the changelog section.**\n\n`splitChangelog()` still uses substring matching for headings. A requested version like `2.0.5` can incorrectly match `2.0.50 ...`, mark the section as found, and so...
diff --git a/tests/framework/ReleaseControllerTest.php b/tests/framework/ReleaseControllerTest.php index 4197ecd16d5..a11769c4182 100644 --- a/tests/framework/ReleaseControllerTest.php +++ b/tests/framework/ReleaseControllerTest.php @@ -11,21 +11,33 @@ namespace yiiunit\framework; use ReflectionClass; +use Reflecti...
true
yiisoft/yii2
20,911
comment_to_fix
Fix release changelog version detection
_⚠️ Potential issue_ | _🟠 Major_ | _⚡ Quick win_ **Use exact version-boundary matching when locating the changelog section.** `splitChangelog()` still uses substring matching for headings. A requested version like `2.0.5` can incorrectly match `2.0.50 ...`, mark the section as found, and sort the wrong block instead...
540c7de68aad91907481f8cb34ba97ae91aec973
2ebf83509323de04076ddf5d9ca9552741595a93
diff --git a/build/controllers/ReleaseController.php b/build/controllers/ReleaseController.php index b5f53881186..e7c36cf436a 100644 --- a/build/controllers/ReleaseController.php +++ b/build/controllers/ReleaseController.php @@ -854,6 +854,7 @@ protected function openChangelogs($what, $version) protected function ...
[ "build/controllers/ReleaseController.php" ]
[ { "comment": "_⚠️ Potential issue_ | _🟠 Major_ | _⚡ Quick win_\n\n**Use exact version-boundary matching when locating the changelog section.**\n\n`splitChangelog()` still uses substring matching for headings. A requested version like `2.0.5` can incorrectly match `2.0.50 ...`, mark the section as found, and so...
true
yiisoft/yii2
20,911
comment_to_fix
Fix release changelog version detection
_🧹 Nitpick_ | _🔵 Trivial_ | _⚡ Quick win_ **Clean up the temporary directories created by these tests.** Both `testGetReleaseVersionsUsesChangelogDevelopmentVersion` (Lines 60-69) and `testResortChangelogsFailsWhenVersionSectionIsMissing` (Lines 84-92) create directories and files under `sys_get_temp_dir()` that ar...
540c7de68aad91907481f8cb34ba97ae91aec973
2ebf83509323de04076ddf5d9ca9552741595a93
diff --git a/tests/framework/ReleaseControllerTest.php b/tests/framework/ReleaseControllerTest.php index 4197ecd16d5..a11769c4182 100644 --- a/tests/framework/ReleaseControllerTest.php +++ b/tests/framework/ReleaseControllerTest.php @@ -11,21 +11,33 @@ namespace yiiunit\framework; use ReflectionClass; +use Reflecti...
[ "tests/framework/ReleaseControllerTest.php" ]
[ { "comment": "_🧹 Nitpick_ | _🔵 Trivial_ | _⚡ Quick win_\n\n**Clean up the temporary directories created by these tests.**\n\nBoth `testGetReleaseVersionsUsesChangelogDevelopmentVersion` (Lines 60-69) and `testResortChangelogsFailsWhenVersionSectionIsMissing` (Lines 84-92) create directories and files under `s...
true