@@ -123,7 +123,7 @@ public function parseRecursive( $url ) {
123
123
$ sitemaps = $ this ->sitemaps ;
124
124
$ urls = $ this ->urls ;
125
125
try {
126
- $ this ->parse ( $ todo [0 ] );
126
+ $ this ->parse ( strval ( $ todo [0 ] ) );
127
127
} catch ( WP2StaticException $ e ) {
128
128
WsLog::w ( $ e ->getMessage () );
129
129
// Keep crawling
@@ -141,7 +141,7 @@ public function parseRecursive( $url ) {
141
141
*/
142
142
public function addToQueue ( array $ url_array ) : void {
143
143
foreach ( $ url_array as $ url ) {
144
- $ url = $ this ->urlEncode ( $ url );
144
+ $ url = $ this ->urlEncode ( strval ( $ url ) );
145
145
if ( $ this ->urlValidate ( $ url ) ) {
146
146
$ this ->queue [] = $ url ;
147
147
}
@@ -239,6 +239,11 @@ protected function getContent() {
239
239
$ this ->config ['guzzle ' ]['headers ' ]['User-Agent ' ] = $ this ->user_agent ;
240
240
}
241
241
$ client = new WP2StaticGuzzleHttp \Client ( [ 'verify ' => false ] );
242
+
243
+ if ( ! is_array ( $ this ->config ['guzzle ' ] ) ) {
244
+ WsLog::w ( 'Guzzle config is not in expected array format ' );
245
+ return null ;
246
+ }
242
247
$ res = $ client ->request ( 'GET ' , $ this ->current_url , $ this ->config ['guzzle ' ] );
243
248
if ( $ res ->getStatusCode () === 200 ) {
244
249
return $ res ->getBody ()->getContents ();
@@ -319,7 +324,7 @@ protected function addArray( $type, array $array ) {
319
324
if ( ! isset ( $ array ['loc ' ] ) ) {
320
325
return false ;
321
326
}
322
- $ array ['loc ' ] = $ this ->urlEncode ( trim ( $ array ['loc ' ] ) );
327
+ $ array ['loc ' ] = $ this ->urlEncode ( trim ( strval ( $ array ['loc ' ] ) ) );
323
328
if ( $ this ->urlValidate ( $ array ['loc ' ] ) ) {
324
329
switch ( $ type ) {
325
330
case self ::XML_TAG_SITEMAP :
0 commit comments