Fix ZipDirectoryReader under Hiphop
ZipDirectoryReaderError subclasses Exception, and sets the code property as a string. Php's documentation says this should be an int, so this is already a little bit weird. Under Hiphop, calling the parent constructor without the second parameter will set the code property to 0, because the parameter defaults to 0. This leads to uploads breaking, because calls to getErrorCode return 0 rather than the code that was passed in. The change renames the code property to errorCode, so it can't be confused with exception's code property, which should be an int. https://bugzilla.wikimedia.org/show_bug.cgi?id=39346 Patch by Chris Keeline <ckeeline@fb.com> Change-Id: I9b07a5f7f8ba7c980c0cb0da7b65816dc3b97c4c
This commit is contained in:
parent
d3f1d418de
commit
0ac587207e
1 changed files with 3 additions and 3 deletions
|
|
@ -696,10 +696,10 @@ class ZipDirectoryReader {
|
|||
* Internal exception class. Will be caught by private code.
|
||||
*/
|
||||
class ZipDirectoryReaderError extends Exception {
|
||||
var $code;
|
||||
var $errorCode;
|
||||
|
||||
function __construct( $code ) {
|
||||
$this->code = $code;
|
||||
$this->errorCode = $code;
|
||||
parent::__construct( "ZipDirectoryReader error: $code" );
|
||||
}
|
||||
|
||||
|
|
@ -707,6 +707,6 @@ class ZipDirectoryReaderError extends Exception {
|
|||
* @return mixed
|
||||
*/
|
||||
function getErrorCode() {
|
||||
return $this->code;
|
||||
return $this->errorCode;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue