Skip to content

trigger error when concatenation is blocked #79

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion ngx-http-concat.php
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,19 @@ function concat_get_path( $uri ) {
concat_http_status_exit( 400 );

// array( '/foo/bar.css', '/foo1/bar/baz.css' )
if ( 0 == count( $args ) || count( $args ) > $concat_max_files )
if ( 0 == count( $args ) || count( $args ) > $concat_max_files ) {
if ( count( $args ) > $concat_max_files ) {
trigger_error(
sprintf(
'Cannot concatenate over %d files in %s',
$concat_max_files,
$_SERVER['REQUEST_URI']
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would this actually be ngx-http-concat.php's URI?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Error I captured in a sandbox environment (truncated middle for readability) :

PHP message: PHP Warning: Cannot concatenate over 150 files in /_static/??-eJy...Nv6Bufg== in /var/www/wp-content/mu-plugins/http-concat/ngx-http-concat.php on line 120

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@trepmal in that case is the url helpful in any meaningful way in terms of providing information for debug?

Copy link
Contributor Author

@trepmal trepmal Jan 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there are several cases which could result in a 400. I think it's helpful to have the info just in case there are multiple issues.

#78 could make this moot though

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I think with #78 merged this may be closed

),
E_USER_WARNING
);
}
concat_http_status_exit( 400 );
}

// If we're in a subdirectory context, use that as the root.
// We can't assume that the root serves the same content as the subdir.
Expand Down
Loading