You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@thrift.apache.org by "kpumuk (via GitHub)" <gi...@apache.org> on 2026/10/20 22:50:43 UTC

[PR] Fix PHPStan and Java Spotless failures [thrift]

kpumuk opened a new pull request, #4032:
URL: https://github.com/apache/thrift/pull/4032

   <!-- Explain the changes in the pull request below: -->
   
   Restore the PHP static-analysis and Java formatting checks that currently fail on master and affect otherwise unrelated pull requests.
   
   The [PHPStan job](https://github.com/apache/thrift/actions/runs/39507920723/job/118922344780) fails with:
   
   ```text
   Comparison operation ">" between 16384000 and 0 is always true.
   ```
   
   The default string-size limit is a fixed, positive constant. Remove the redundant comparison without changing which sizes are rejected.
   
   The [Java Spotless job](https://github.com/apache/thrift/actions/runs/39507920661/job/118922371865) fails with:
   
   ```text
   Execution failed for task ':spotlessJavaCheck'.
   > The following files had format violations:
         src/main/java/org/apache/thrift/server/TSaslNonblockingServer.java
   ```
   
   Reflow the affected Javadoc to match Spotless; no Java runtime code changes.
   
   <!-- We recommend you review the checklist/tips before submitting a pull request. -->
   
   - [ ] Did you create an [Apache Jira](https://issues.apache.org/jira/projects/THRIFT/issues/) ticket?  ([Request account here](https://selfserve.apache.org/jira-account.html), not required for trivial changes)
   - [ ] If a ticket exists: Does your pull request title follow the pattern "THRIFT-NNNN: describe my issue"?
   - [x] Did you squash your changes to a single commit?  (not required, but preferred)
   - [x] Did you do your best to avoid breaking changes?  If one was needed, did you label the Jira ticket with "Breaking-Change"?
   - [ ] If your change does not involve any code, include `[skip ci]` anywhere in the commit message to free up build resources.
   
   <!--
     The Contributing Guide at:
     https://github.com/apache/thrift/blob/master/CONTRIBUTING.md
     has more details and tips for committing properly.
   -->
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@thrift.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Fix PHPStan and Java Spotless failures [thrift]

Posted by "kpumuk (via GitHub)" <gi...@apache.org>.
kpumuk merged PR #4032:
URL: https://github.com/apache/thrift/pull/4032


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@thrift.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Fix PHPStan and Java Spotless failures [thrift]

Posted by "kpumuk (via GitHub)" <gi...@apache.org>.
kpumuk commented on code in PR #4032:
URL: https://github.com/apache/thrift/pull/4032#discussion_r4331251429


##########
lib/php/lib/Transport/TTransport.php:
##########
@@ -73,7 +73,7 @@ public function decrementRecursionDepth(): void
     public function checkStringSize(int $len): void
     {
         $max = TProtocol::DEFAULT_MAX_STRING_SIZE;
-        if ($max > 0 && $len > $max) {

Review Comment:
   I mean... it is initialized right above...



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@thrift.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Fix PHPStan and Java Spotless failures [thrift]

Posted by "fishy (via GitHub)" <gi...@apache.org>.
fishy commented on code in PR #4032:
URL: https://github.com/apache/thrift/pull/4032#discussion_r4331506918


##########
lib/php/lib/Transport/TTransport.php:
##########
@@ -73,7 +73,7 @@ public function decrementRecursionDepth(): void
     public function checkStringSize(int $len): void
     {
         $max = TProtocol::DEFAULT_MAX_STRING_SIZE;
-        if ($max > 0 && $len > $max) {

Review Comment:
   yes but the initialization can be moved around in the future?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@thrift.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Fix PHPStan and Java Spotless failures [thrift]

Posted by "fishy (via GitHub)" <gi...@apache.org>.
fishy commented on code in PR #4032:
URL: https://github.com/apache/thrift/pull/4032#discussion_r4331225298


##########
lib/php/lib/Transport/TTransport.php:
##########
@@ -73,7 +73,7 @@ public function decrementRecursionDepth(): void
     public function checkStringSize(int $len): void
     {
         $max = TProtocol::DEFAULT_MAX_STRING_SIZE;
-        if ($max > 0 && $len > $max) {

Review Comment:
   for this one, can we silence it instead (with a suppressing comment or something like that)? I feel this is still a good protection if there's a bug introduced in the future to change `$max` to be negative.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@thrift.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Fix PHPStan and Java Spotless failures [thrift]

Posted by "kpumuk (via GitHub)" <gi...@apache.org>.
kpumuk commented on code in PR #4032:
URL: https://github.com/apache/thrift/pull/4032#discussion_r4331590849


##########
lib/php/lib/Transport/TTransport.php:
##########
@@ -73,7 +73,7 @@ public function decrementRecursionDepth(): void
     public function checkStringSize(int $len): void
     {
         $max = TProtocol::DEFAULT_MAX_STRING_SIZE;
-        if ($max > 0 && $len > $max) {

Review Comment:
   On the second thought, it is actually not a protection, but rather protection removal. If `$max` is suddenly a negative, then the condition will never trigger and the length will never be validated - unlimited size. On the other hand with the current proposal, if $max is ever negative - every call will fail.
   
   So I would argue current proposal has a better protection from bugs :-)



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@thrift.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org