FileWrapper.inc.php Error

Hi OJS Gurus,
I’ve been getting this error recently, any ideas how to fix it?
OJS 2.4.8.1

Thank you in advance.
HW

[10-Mar-2018 21:47:27] ojs2 has produced an error
Message: WARNING: fopen(): Filename cannot be empty
In file: /home/xxxxxx/public_html/lib/pkp/classes/file/FileWrapper.inc.php
At line: 71
Stacktrace:
File: (unknown) line (unknown)
Function: PKPApplication->errorHandler(2, “fopen(): Filename cannot be empty”, “/home/xxxxxx/public_html/lib/pkp/classes/file/FileWrapper.inc.php”, 71, Array(1))
File: /home/xxxxxx/public_html/lib/pkp/classes/file/FileWrapper.inc.php line 71
Function: fopen(“”, “r”)
File: /home/xxxxxx/public_html/lib/pkp/classes/file/FileWrapper.inc.php line 53
Function: FileWrapper->open()
File: /home/xxxxxx/public_html/lib/pkp/classes/xml/XMLParser.inc.php line 258
Function: FileWrapper->contents()
File: /home/xxxxxx/public_html/lib/pkp/classes/db/XMLDAO.inc.php line 56
Function: XMLParser->parseStruct(Null, Array(0))
File: /home/xxxxxx/public_html/lib/pkp/classes/help/HelpTopicDAO.inc.php line 70
Function: XMLDAO->parseStruct(Null)
File: (unknown) line (unknown)
Function: HelpTopicDAO->_cacheMiss(Object(FileCache), Null)
File: /home/xxxxxx/public_html/lib/pkp/classes/cache/GenericCache.inc.php line 63
Function: call_user_func_array(Array(2), Array(2))
File: /home/xxxxxx/public_html/lib/pkp/classes/cache/FileCache.inc.php line 119
Function: GenericCache->get(Null)
File: /home/xxxxxx/public_html/lib/pkp/classes/help/HelpTopicDAO.inc.php line 89
Function: FileCache->getContents()
File: /home/xxxxxx/public_html/lib/pkp/pages/help/HelpHandler.inc.php line 75
Function: HelpTopicDAO->getTopic(“journal/topic”)
File: (unknown) line (unknown)
Function: HelpHandler->view(Array(2), Object(Request))
File: /home/xxxxxx/public_html/lib/pkp/classes/core/PKPRouter.inc.php line 362
Function: call_user_func(Array(2), Array(2), Object(Request))
File: /home/xxxxxx/public_html/lib/pkp/classes/core/PKPPageRouter.inc.php line 220
Function: PKPRouter->_authorizeInitializeAndCallRequest(Array(2), Object(Request), Array(2), False)
File: /home/xxxxxx/public_html/lib/pkp/classes/core/Dispatcher.inc.php line 134
Function: PKPPageRouter->route(Object(Request))
File: /home/xxxxxx/public_html/lib/pkp/classes/core/PKPApplication.inc.php line 178
Function: Dispatcher->dispatch(Object(Request))
File: /home/xxxxxx/public_html/index.php line 64
Function: PKPApplication->execute()
Server info:
OS: Linux
PHP Version: 5.6.33
Apache Version: N/A
DB Driver: mysql
DB server version: 5.5.58-cll

Are you trying to open a file when you get this?

@ajnyga
I dunno what triggered the errors, but there is 404 error in our log. Theres no additional info about the 404, although stacktrace is already on.

[12-Mar-2018 08:14:15] ojs2: 404 Not Found

can you guide me how to know exactly which file is missing in our system?

Thanks.

It seems that the function is used for reading remote files. Remote galleys come to mind, do you have them?

We don’t have remote galleys.
Our site was attacked a few months back, a hacker tried to deface our home page but they didnt succeed. I noticed their activity because I saw .phtml files in the server, they uploaded those files via the submission process. I immediately archived those submission and delete the users associated.

A week ago I deleted those archived .phtml files completely using the editor role. Could it be the error caused by that? I mean probably they changed some settings that we didnt know, or trying to access the .phtml remotely?

I do no think that the hacking is connected because the FileWrapper is said to be used for reading remote files. This of course includes other files than remote galleys as well.

Looking at your stacktrace more closely now it seems that the error comes from the Journal help section. You maybe have a link titled “Journal Help” in your sidebar. Clicking that should open a window. Maybe you could test that and click through the help topics and see if the error is triggered again.

You can see the link in the test installation here: http://journals.sfu.ca/testdrive/index.php/index/login
If you do not see it, you can active that block plugin from your journal settings. Maybe a file is missing there.

ps. make sure that your files folder is not directly accesible, I mean it should not be a subdirectory of your OJS installation.

Using your hints, I tried to regenerate the error, but no success. Seems like the error is caused by the OJS failed to get topic ID?
I summarized the help sections error below from the log:

public_html/lib/pkp/pages/help/HelpHandler.inc.php line 75
Function: HelpTopicDAO->getTopic(“intro/topic”)
For the Introduction section of OJS Help

public_html/lib/pkp/pages/help/HelpHandler.inc.php line 75
Function: HelpTopicDAO->getTopic(“site/topic”)
For the Site Management section

public_html/lib/pkp/pages/help/HelpHandler.inc.php line 75
Function: HelpTopicDAO->getTopic(“journal/topic”)
For the Journal Website section

But then again, I checked those sections and all seems to be OK.
Also checked them using the online powermapper, and got this result:

[a href= “http://berkalaarkeologi.kemdikbud.go.id/index.php/index/help/view/journal/topic/000008”]Stats

Character “&” is the first character of a delimiter but occurred as data.
This often occurs in text or JavaScript code when a bare angle bracket or ampersand is used instead of an entity reference.
Line 121 HTML Validation

& Reports

Could it be the case? but if so, it is strange because we’ve been using 2.4.8.3 since two months ago, and the errors started to show only from last week.

PS: we already moved the data folder outside of the installation folder, thanks for the info.

Really hard to say if you do not find a way to trigger the error. I do not have a OJS2 installation available anymore so I have limited ways of solving this. In overall it does not seem to be that serious of an error.

I guess you could add a debug code to the FileWrapper around line 71. When the url is empty print the contents of the request to the error log. This might give a better idea of what is going on.

could you please post the debug code here?
Thanks so much for your help.

Maybe something like this added to the filewrapper:

function open($mode = 'r') {
	$this->fp = null;
	$this->fp = fopen($this->url, $mode);
	
	if (!$this->url){
		$application =& PKPApplication::getApplication();
		$request =& $application->getRequest();
		error_log(print_r($request, true));
	}
	
	return ($this->fp !== false);
}

That will only trigger when the url is empty (which is causing the warning) and should output the whole request to help you determine what page is requested when the error happens. Note that it will be a long output so if you are getting that error a lot, then be careful how long you have that in your code.

Thanks for your reply @ajnyga,
sorry for my late reply, I was on business trip for a week.
I will paste the code and report back here as soon as there are more details.

Hi @ajnyga,
We got 3 errors, I dunno if they are related to each other or not.
Thanks so much for your help.

First:

[28-Mar-2018 10:58:24 Asia/Jakarta] ojs2 has produced an error
Message: WARNING: mkdir(): File exists
In file: /home/abcdefg/public_html/lib/pkp/lib/adodb/adodb.inc.php
At line: 1632
Stacktrace:
File: (unknown) line (unknown)
Function: PKPApplication->errorHandler(2, “mkdir(): File exists”, “/home/abcdefg/public_html/lib/pkp/lib/adodb/adodb.inc.php”, 1632, Array(9))
File: /home/abcdefg/public_html/lib/pkp/lib/adodb/adodb.inc.php line 1632
Function: mkdir(“/home/abcdefg/public_html/cache/_db/f7”, 505)
File: /home/abcdefg/public_html/lib/pkp/lib/adodb/adodb.inc.php line 1668
Function: ADOConnection->_gencachename(“SELECT o.article_id,
COUNT() AS count
FROM articles a,
published_articles pa,
issues i,
journals j,
article_search_objects o NATURAL JOIN article_search_object_keywords o0 NATURAL JOIN article_search_keyword_list k0
WHERE pa.article_id = a.article_id AND
a.journal_id = j.journal_id AND
a.status = 3 AND
pa.article_id = o.article_id AND
i.issue_id = pa.issue_id AND
i.published = 1 AND k0.keyword_text = ? AND i.journal_id = ?
GROUP BY o.article_id
ORDER BY count DESC
LIMIT 500a:2:{i:0;s:6:"jepang";i:1;s:1:"1";}", True)
File: /home/abcdefg/public_html/lib/pkp/classes/db/DAO.inc.php line 130
Function: ADOConnection->CacheExecute(3600, "SELECT o.article_id,
COUNT(
) AS count
FROM articles a,
published_articles pa,
issues i,
journals j,
article_search_objects o NATURAL JOIN article_search_object_keywords o0 NATURAL JOIN article_search_keyword_list k0
WHERE pa.article_id = a.article_id AND
a.journal_id = j.journal_id AND
a.status = 3 AND
pa.article_id = o.article_id AND
i.issue_id = pa.issue_id AND
i.published = 1 AND k0.keyword_text = ? AND i.journal_id = ?
GROUP BY o.article_id
ORDER BY count DESC
LIMIT 500”, Array(2))
File: /home/abcdefg/public_html/classes/search/ArticleSearchDAO.inc.php line 126
Function: DAO->retrieveCached(“SELECT o.article_id,
COUNT(*) AS count
FROM articles a,
published_articles pa,
issues i,
journals j,
article_search_objects o NATURAL JOIN article_search_object_keywords o0 NATURAL JOIN article_search_keyword_list k0
WHERE pa.article_id = a.article_id AND
a.journal_id = j.journal_id AND
a.status = 3 AND
pa.article_id = o.article_id AND
i.issue_id = pa.issue_id AND
i.published = 1 AND k0.keyword_text = ? AND i.journal_id = ?
GROUP BY o.article_id
ORDER BY count DESC
LIMIT 500”, Array(2), 3600)
File: /home/abcdefg/public_html/classes/search/ArticleSearch.inc.php line 200
Function: ArticleSearchDAO->getPhraseResults(Object(Journal), Array(1), Null, Null, “”, 500, 1)
File: /home/abcdefg/public_html/classes/search/ArticleSearch.inc.php line 138
Function: ArticleSearch->_getMergedPhraseResults(Object(Journal), Array(1), “”, Null, Null, 500, 1)
File: /home/abcdefg/public_html/classes/search/ArticleSearch.inc.php line 186
Function: ArticleSearch->_getMergedKeywordResults(Object(Journal), Array(4), Null, Null, Null, 500, 1)
File: /home/abcdefg/public_html/classes/search/ArticleSearch.inc.php line 138
Function: ArticleSearch->_getMergedPhraseResults(Object(Journal), Array(4), Null, Null, Null, 500, 1)
File: /home/abcdefg/public_html/classes/search/ArticleSearch.inc.php line 122
Function: ArticleSearch->_getMergedKeywordResults(Object(Journal), Array(3), Null, Null, Null, 500, 1)
File: /home/abcdefg/public_html/classes/search/ArticleSearch.inc.php line 434
Function: ArticleSearch->_getMergedArray(Object(Journal), Array(1), Null, Null)
File: /home/abcdefg/public_html/pages/search/SearchHandler.inc.php line 146
Function: ArticleSearch->retrieveResults(Object(Journal), Array(1), “”, Null, Null, Object(DBResultRange))
File: (unknown) line (unknown)
Function: SearchHandler->search(Array(0), Object(Request))
File: /home/abcdefg/public_html/lib/pkp/classes/core/PKPRouter.inc.php line 362
Function: call_user_func(Array(2), Array(0), Object(Request))
File: /home/abcdefg/public_html/lib/pkp/classes/core/PKPPageRouter.inc.php line 220
Function: PKPRouter->_authorizeInitializeAndCallRequest(Array(2), Object(Request), Array(0), False)
File: /home/abcdefg/public_html/lib/pkp/classes/core/Dispatcher.inc.php line 134
Function: PKPPageRouter->route(Object(Request))
File: /home/abcdefg/public_html/lib/pkp/classes/core/PKPApplication.inc.php line 178
Function: Dispatcher->dispatch(Object(Request))
File: /home/abcdefg/public_html/index.php line 64
Function: PKPApplication->execute()
Server info:
OS: Linux
PHP Version: 5.6.34
Apache Version: N/A
DB Driver: mysql
DB server version: 5.5.58-cll

Second:

[30-Mar-2018 17:46:02 Asia/Jakarta] array (
0 =>
array (
‘file’ => ‘/home/abcdefg/public_html/plugins/generic/acron/AcronPlugin.inc.php’,
‘line’ => 223,
‘function’ => ‘getDAO’,
‘class’ => ‘DAORegistry’,
‘object’ =>
AcronPlugin::__set_state(array(
‘_workingDir’ => ‘/home/lbjcrrea/public_html’,
‘_tasksToRun’ =>
array (
0 =>
array (
‘className’ => ‘plugins.importexport.medra.MedraInfoSender’,
‘frequency’ =>
array (
‘hour’ => 24,
),
‘args’ =>
array (
),
),
1 =>
array (
‘className’ => ‘plugins.importexport.datacite.DataciteInfoSender’,
‘frequency’ =>
array (
‘hour’ => 24,
),
‘args’ =>
array (
),
),
2 =>
array (
‘className’ => ‘plugins.importexport.crossref.CrossrefInfoSender’,
‘frequency’ =>
array (
‘hour’ => 24,
),
‘args’ =>
array (
),
),
3 =>
array (
‘className’ => ‘plugins.importexport.crossref.CrossrefInfoSender’,
‘frequency’ =>
array (
‘hour’ => 24,
),
‘args’ =>
array (
),
),
4 =>
array (
‘className’ => ‘plugins.importexport.crossref.CrossrefInfoSender’,
‘frequency’ =>
array (
‘hour’ => 24,
),
‘args’ =>
array (
),
),
5 =>
array (
‘className’ => ‘classes.tasks.ReviewReminder’,
‘frequency’ =>
array (
‘hour’ => 24,
),
‘args’ =>
array (
),
),
6 =>
array (
‘className’ => ‘classes.tasks.SubscriptionExpiryReminder’,
‘frequency’ =>
array (
‘hour’ => 24,
),
‘args’ =>
array (
),
),
7 =>
array (
‘className’ => ‘classes.tasks.OpenAccessNotification’,
‘frequency’ =>
array (
‘hour’ => 24,
),
‘args’ =>
array (
),
),
),
‘pluginPath’ => ‘plugins/generic/acron’,
‘pluginCategory’ => ‘generic’,
)),
‘type’ => ‘->’,
‘args’ =>
array (
0 => ‘ScheduledTaskDAO’,
),
),
1 =>
array (
‘function’ => ‘shutdownFunction’,
‘class’ => ‘AcronPlugin’,
‘object’ =>
AcronPlugin::__set_state(array(
‘_workingDir’ => ‘/home/lbjcrrea/public_html’,
‘_tasksToRun’ =>
array (
0 =>
array (
‘className’ => ‘plugins.importexport.medra.MedraInfoSender’,
‘frequency’ =>
array (
‘hour’ => 24,
),
‘args’ =>
array (
),
),
1 =>
array (
‘className’ => ‘plugins.importexport.datacite.DataciteInfoSender’,
‘frequency’ =>
array (
‘hour’ => 24,
),
‘args’ =>
array (
),
),
2 =>
array (
‘className’ => ‘plugins.importexport.crossref.CrossrefInfoSender’,
‘frequency’ =>
array (
‘hour’ => 24,
),
‘args’ =>
array (
),
),
3 =>
array (
‘className’ => ‘plugins.importexport.crossref.CrossrefInfoSender’,
‘frequency’ =>
array (
‘hour’ => 24,
),
‘args’ =>
array (
),
),
4 =>
array (
‘className’ => ‘plugins.importexport.crossref.CrossrefInfoSender’,
‘frequency’ =>
array (
‘hour’ => 24,
),
‘args’ =>
array (
),
),
5 =>
array (
‘className’ => ‘classes.tasks.ReviewReminder’,
‘frequency’ =>
array (
‘hour’ => 24,
),
‘args’ =>
array (
),
),
6 =>
array (
‘className’ => ‘classes.tasks.SubscriptionExpiryReminder’,
‘frequency’ =>
array (
‘hour’ => 24,
),
‘args’ =>
array (
),
),
7 =>
array (
‘className’ => ‘classes.tasks.OpenAccessNotification’,
‘frequency’ =>
array (
‘hour’ => 24,
),
‘args’ =>
array (
),
),
),
‘pluginPath’ => ‘plugins/generic/acron’,
‘pluginCategory’ => ‘generic’,
)),
‘type’ => ‘->’,
‘args’ =>
array (
),
),
)

Third:

[30-Mar-2018 17:46:02 Asia/Jakarta] PHP Fatal error: Call to a member function getQualifiedDAOName() on null in /home/abcdefg/public_html/lib/pkp/classes/db/DAORegistry.inc.php on line 68