I am getting this error from the select-file-dropdown.js on the initial load of webmeister.html.
TypeError: 'undefined' is not a function (evaluating 'data.files[i].match(/[^\/]*$/)')
select-file-dropdown.js:68TypeError: 'undefined' is not a function (evaluating 'data.files[i].match(/[^\/]*$/)')
I can fix it if I echo some characters before the json_encode in the browser.php which is fine but it is not really a sensible solution.
It seems to be because the loadDir function in select-file-dropdown.js is passing a url variable with no value assigned.
Can anyone help?
1 decade ago
by dominic
Are you sure PHP is running correctly on your setup? This error usually appears when the PHP code is not executed by the webserver, but returned verbatim to the browser.
Try creating a file
info.php
with the following contents:
<?php phpinfo(); ?>
When you navigate to it, you should see a detailed listing of your PHP setup.
If this all is working, can you try navigating directly to the browse.php in your browser and paste the content here (or make a screenshot). E.g.:
http://localhost/impact/lib/weltmeister/api/browse.php
PHP is functioning correctly on our server. The browse.php script outputs a json object with a property set to "files":[false] where false is the indice which then breaks on the javascript end because false is not cast to zero.
If this script requires a php ini_set or an htaccess setting then please note that in your installation guide.
Here is the php_info.
PHP Version 5.3.22
[Edit: removed info ~dominic]
1 decade ago
by dominic
So apparently you have one of those system where
(...) it is impossible to distinguish between empty match and an error. My naive attempt to workaround this by casting the return value into an array doesn&
039;t work, because this results in an array #"files":[false]
as you noted.
I fixed these issues by specifically checking for
false
return values now:
browse.php:
$dirs = glob( $dir.'*', GLOB_ONLYDIR );
if( $dirs === false ) { $dirs = array(); };
$files = glob( $dir.$find, GLOB_BRACE );
if( $files === false ) { $files = array(); }
glob.php:
foreach( $globs as $glob ) {
$pattern = WM_Config::$fileRoot . str_replace( '..', '', $glob );
$currentFiles = glob( $pattern );
if( $currentFiles !== false ) {
$files = array_merge( $files, $currentFiles );
}
}
The updated version can also be found in the git repo on your download page.
Sorry for the trouble and thanks for your patience!
Page 1 of 1
« first
« previous
next ›
last »