File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -81,7 +81,7 @@ final class WebView implements
8181 * ```
8282 */
8383 get {
84- $ result = $ this ->saucer ->saucer_webview_url ($ this ->id ->ptr , \FFI ::addr (
84+ $ ptr = $ this ->saucer ->saucer_webview_url ($ this ->id ->ptr , \FFI ::addr (
8585 $ error = $ this ->saucer ->new ('int ' ),
8686 ));
8787
@@ -90,9 +90,21 @@ final class WebView implements
9090 }
9191
9292 try {
93- return Request::castUrl (\FFI ::string ($ result ));
93+ $ length = $ this ->saucer ->new ('size_t ' );
94+ $ this ->saucer ->saucer_url_string ($ ptr , null , \FFI ::addr ($ length ));
95+
96+ if ($ length ->cdata === 0 ) {
97+ return new Uri ();
98+ }
99+
100+ $ url = $ this ->saucer ->new ("char[ {$ length ->cdata }] " );
101+ $ this ->saucer ->saucer_url_string ($ ptr , \FFI ::addr ($ url [0 ]), \FFI ::addr ($ length ));
102+
103+ $ urlString = \FFI ::string (\FFI ::addr ($ url [0 ]), $ length ->cdata );
104+
105+ return Request::castUrl ($ urlString );
94106 } finally {
95- \FFI ::free ($ result );
107+ \FFI ::free ($ ptr );
96108 }
97109 }
98110 /**
You can’t perform that action at this time.
0 commit comments