开发者

Php error in closure compiler execution

When I run php-closure i get a PHP error

Undefined index:  HTTP_IF_NONE_MATCH in <b>/php-closure.php</b> on line <b>183</b>

Line 184 of php-closure is

trim($_SERVER['HTTP_IF_NONE_MATCH']) == $etag) {

This error only happens when closure has already written the compressed javascript file to the directory once, if the directory is emptied the error does not appear. What does this error mean and how can I avoid i开发者_如何学JAVAt?

Thank You So Much!


This is most likely a negligeable message. The code should check for the presence of HTTP_IF_NONE_MATCH in the server array first, before checking its value. What is set in $_SERVER tends to change from server to server (and the headers sent by the client) so probably the original developer had that value set, and didn't think to check for it.

You could prepend the line in question with a check

if (array_key_exists("HTTP_IF_NONE_MATCH", $_SERVER))

(depending whether the program's logic and flow permit this, of course)

Or turn down the error reporting so that notices are not displayed (not recommended but mybe necessary if you can't touch the package) by putting this into the very beginning of your application:

error_reporting(E_ALL ^ E_NOTICE); 

@Ivo has a great third alternative in his comment.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜