@@ -486,7 +486,7 @@ function () use ( $parts, $path ) {
486
486
private function statDirectory ( $ parts , $ path , $ flags ) {
487
487
// Stat "directories": buckets, or "s3://"
488
488
if ( ! $ parts ['Bucket ' ] ||
489
- $ this ->getClient ()->doesBucketExist ( $ parts ['Bucket ' ] )
489
+ $ this ->getClient ()->doesBucketExistV2 ( $ parts ['Bucket ' ], false )
490
490
) {
491
491
return $ this ->formatUrlStat ( $ path );
492
492
}
@@ -723,9 +723,13 @@ public function dir_readdir() {
723
723
$ this ->objectIterator ->next ();
724
724
725
725
// Remove the prefix from the result to emulate other stream wrappers.
726
- return $ this ->openedBucketPrefix
726
+ $ retVal = $ this ->openedBucketPrefix
727
727
? substr ( $ result , strlen ( $ this ->openedBucketPrefix ) )
728
728
: $ result ;
729
+ if ( $ retVal === '' ) {
730
+ $ retVal = false ;
731
+ }
732
+ return $ retVal ;
729
733
}
730
734
731
735
private function formatKey ( string $ key ) : string {
@@ -816,9 +820,10 @@ private function validate( $path, $mode ) {
816
820
/** @var string */
817
821
$ key = $ this ->getOption ( 'Key ' );
818
822
if ( $ mode == 'x ' &&
819
- $ this ->getClient ()->doesObjectExist (
823
+ $ this ->getClient ()->doesObjectExistV2 (
820
824
$ bucket ,
821
825
$ key ,
826
+ false ,
822
827
$ this ->getOptions ( true )
823
828
)
824
829
) {
@@ -1031,7 +1036,7 @@ private function formatUrlStat( $result = null ) {
1031
1036
* @return bool Returns true on success or false on failure
1032
1037
*/
1033
1038
private function createBucket ( $ path , array $ params ) {
1034
- if ( $ this ->getClient ()->doesBucketExist ( $ params ['Bucket ' ] ) ) {
1039
+ if ( $ this ->getClient ()->doesBucketExistV2 ( $ params ['Bucket ' ], false ) ) {
1035
1040
return $ this ->triggerError ( "Bucket already exists: {$ path }" );
1036
1041
}
1037
1042
@@ -1058,7 +1063,7 @@ private function createSubfolder( string $path, array $params ) {
1058
1063
$ params ['Body ' ] = '' ;
1059
1064
1060
1065
// Fail if this pseudo directory key already exists
1061
- if ( $ this ->getClient ()->doesObjectExist (
1066
+ if ( $ this ->getClient ()->doesObjectExistV2 (
1062
1067
$ params ['Bucket ' ],
1063
1068
$ params ['Key ' ]
1064
1069
)
0 commit comments