yii logs differ - where should we look at? - yii

We are developing using Yii. One user sees warnings trow by Yii, the other user don't.
We have the same app/config.php file.
Could this be apache related ?
Where should we look at for more diferences in order to make them see the same logs ?
index.php and .htaccess are equal on all machines (they under git btw);
The code that we had and that was returning an error that only some users were seeing and others don't is the following:
1 $(document).ready(function(){
2 if('<?php echo Yii::app()->controller->action->id?>' == 'update'){
3 if('<?php echo Yii::app()->user->id;?>' != '<?php echo $model->createUser->id; ?>'){
and the error is:
trying to access property of a non-object
(on line 3).
This error is SOLVED. It's the fact that only some developers sees this and others don't that troubles me.
Please advice

Related

Cache files always created with wrong permissions in Yii 2

I get this error in my log files every time a cache file doesn't exist it seems. On the first page load, I always get this error
[message] => filemtime(): stat failed for [...]/runtime/cache/my/myapp03eab921185f7b68bbca50d8debc0dda.bin
[file] => [...]/vendor/yiisoft/yii2/caching/FileCache.php
[line] => 113
It doesn't happen anymore on next page loads but that one time is really annoying since the slack bot watcher is spamming our channel with this useless warning. Is there a way to avoid that, or is it a permission problem?
The "runtime", "cache" and "my" folders all have 775.
Update
Turns out the issue is that I'm using error_get_last() that is also getting warning-level errors. So it's a different issue entirely, not Yii-related
Make sure that you don't have enabled scream in your php.ini. Warnings from this filemtime() call should be suppressed by # operator, but scream setting can override this operator and generate warning anyway.
if (#filemtime($cacheFile) > time()) {
// ...
}
You must be getting this in PHP 7.1. try to run this with PHP 5.5 and see if you are getting the same error.
To reproduce you need to delete all files from runtime/cache directory
Then start app again(reload page) and look into runtime/cache. It is empty
Yii2 doesn't make cache again
Got same issue in Yii. The error was on the same string (FileCache.php:113)
if (#filemtime($cacheFile) > time()) {...
In my case reason was that my custom php error handler (heir
of the class yii\base\ErrorHandler) didn't check if
error type need to be handled according error_reporting().
Custom handlers allways gets every error, even muted by Error Control operator (#)
https://www.php.net/manual/en/function.set-error-handler.php
error_reporting() settings will have no effect and your error handler will be called regardless

PHP Session Variable - Property access is not allowed yet

I have the following code at the top of my index.php:
<?php
session_start();
require 'includes/db_connect.php';
if(!isset($_SESSION['conn'])){
$_SESSION['conn'] = db_connect('igslogistics01');
}
var_dump($_SESSION);
?>
The result of the output is:
Warning: var_dump(): Property access is not allowed yet
I have seen similar questions asked, related mainly to db connections but as you can see in my case I can't access any of the session variable.
The server is running PHP v 7.1.0
Any suggestions or pointers would be appreciated.

DokuWiki LDAP can't see any groups

We have just changed our domain after protracted name change (the name actually happened two years ago!) and our DokuWiki installation has stopped being able to see any groups and memberships.
The config has been updated to reflect the new server and DCs and login is working correctly, it is only the groups that aren't working.
$conf['auth']['ldap']['server'] = 'ldap://MYDC.mydomain.co.uk:389';
$conf['auth']['ldap']['binddn'] = '%{user}#mydomain.co.uk';
$conf['auth']['ldap']['usertree'] = 'dc=mydomain,dc=co,dc=uk';
$conf['auth']['ldap']['userfilter'] = '(userPrincipalName=%{user}#mydomain.co.uk)';
$conf['auth']['ldap']['mapping']['name'] = 'displayname';
$conf['auth']['ldap']['mapping']['grps'] = 'array(\'memberof\' => \'/CN=(.+?),/i\')';
$conf['auth']['ldap']['grouptree'] = 'dc=mydomain,dc=co,dc=uk';
$conf['auth']['ldap']['groupfilter'] = '(&(cn=*)(Member=%{dn})(objectClass=group))';
$conf['auth']['ldap']['referrals'] = '0';
$conf['auth']['ldap']['version'] = '3';
$conf['auth']['ldap']['debug'] = 1;
Obviously I have edited the doain name there, but for the life of me I can't see what's wrong here, It all worked fine yesterday on the old domain.
I should also state that this is an old version of DokuWiki that for various reasons I can't actually update.
The debug line gives me a "ldap search: success" line, but if I add "?do=check" onto any url within the system I get "You are part of the groups"...... and nothing, it can't see any groups.
It's a massive pain as we have a pretty intricate ACL setup for the site, so it's not like I can just throw it open to all.
If anyone has any suggestions, no matter how obvious, please pass them on.
Solved it by changing the dokuwiki authentication plugin that was used, the 'authad' is more simple to use and just works with what I'm doing.
As a side bonus it also means that I have finally been able to get the install upgraded to the current version.

Prestashop admin panel is lost after trying to export language packet

There were some language problems in my site which uses a specific theme so I thought,I should pick out the language pack edit and reload it. Because I couldn't find a way to edit it using browser on admin panel.
I just pressed a button named export language packet. I don't know if something happened that time. But it didn't give me a file (an exported file I mean) . So I didn't do anything else. But since that time I can't reach my admin panel. While I write the URL it shows me a big white screen.
On the other side the site itself (not admin panel) is reachable. What can I do to fix my problem?
Hi,
This is the error
( ! ) SCREAM: Error suppression ignored for
( ! ) Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting ']' in C:\wamp\www\httpdocs\translations\tr\admin.php on line 586
Call Stack
# Time Memory Function Location
1 0.0009 690552 {main}( ) ..\index.php:0
2 1.7995 9942280 DispatcherCore->dispatch( ) ..\index.php:50
3 2.0567 10375504 ControllerCore::getController( ) ..\Dispatcher.php:342
4 2.0686 12512728 AdminControllerCore->__construct( ) ..\Controller.php:128
5 2.0689 12514200 AdminControllerCore->l( ) ..\AdminController.php:304
6 2.0711 12612344 TranslateCore::getAdminTranslation( ) ..\AdminController.php:1737
The error you got is in your translation file in file translations\tr\admin.php on line number 586.
To fix that error, take a backup of that file, i.e. keep a copy of that file in some other place, then try to find out the syntax error you got there. It is some kind of PHP syntax error there in that translation file. As the translation file is only for the admin section, therefore your site front end may be fine and your site admin section is not working.
If you are not able to find that error and fix it, then delete all contents from that file, and then try to load the admin section.
You should use a translation pack which is provided by prestashop, ie download it from the prestashop http://www.prestashop.com/en/translations .
Also if you want to edit translations, use admin. In your question you mentioned, that you were not able to edit translations, please do provide details for that problem, and also try to edit translations while keeping error reporting on, so if there is any problem, you will get the errors printed. If you got errors printed, then update your question with that error message.
Let me know if you still got any questions.

How to flush current output in RApache?

I'm testing using RApache as an SSE (Server Sent Events) and similar (long poll, comet, etc.) back-end. I seem to be stuck on how to flush my output. Is it possible?
Here is my test R script:
setContentType("text/plain")
repeat{
cat(format(Sys.time()),"\n")
#sendBin(paste(format(Sys.time()),"\n"))
flush(stdout())
Sys.sleep(1)
}
My Rapache.conf entry is:
<Location /rtest/sse>
Options -MultiViews
SetHandler r-handler
RFileHandler /var/www/local/rtest/sse.r
</Location>
And I test it using either wget or curl:
wget -O - http://localhost/rtest/sse
curl http://localhost/rtest/sse
Both just sit there, meaning nothing is being sent.
Using sendBin() made no change, and neither did using flush().
If I change repeat to for(i in 1:5) then it sits there for 5 seconds and then shows 5 timestamps (spaced one second apart). So, I believe everything else is working fine and this is purely a buffering issue.
UPDATE: Looking at this with fresh eyes after 5 months, I think I could have described the problem more clearly: the problem is that RApache appears to be buffering all the output, and not sending anything until the R script exits. To be useful for streaming it has to send data out of Apache and on to the client each time flush() is called, i.e. while the R script is still running.
So, my question is: is there a way to get RApache to behave like that?
UPDATE 2 I tried adding flush.console() before or after the flush(stdout()) but no difference. I also tried setStatus(status=200L) at the top. And I tried SERVER$no_cache=T;SERVER$no_local_copy=T; at the top of the script. Again it made no difference. (Yes, none of those should have helped, but it never hurts to try!)
Here is a link to how PHP implements flush when it is running as an Apache module:
http://git.php.net/?p=php-src.git;a=blob;f=sapi/apache2handler/sapi_apache2.c#l290
I think the key point is that there is a call to ap_rflush(r). I'm guessing that RApache is not making the ap_rflush() call.
You are passing the wrong MIME type. Try changing with
setContentType("text/event-stream")
EDIT1:
this is the attempt, (still unsuccessful) I mentioned in the comment below, to implement SSE in Rook.
<%
res$header('Content-Type', 'text/event-stream')
res$header('Cache-Control', 'no-cache')
res$header('Connection', 'keep-alive')
A <- 1
sendMessage <- function(){
while(A<=4){
cat("id: ", Sys.time(), "\n", "data: hello\n\n", sep="")
A <- A+1
flush(stdout())
Sys.sleep(1)
}
}
-%>
<% sendMessage() %>
the while loop condition was supposed to be always TRUE but I'm having your same problem so I had to do a finite loop...
The good new is I DO have data reaching the browser. I can tell by looking, in developer tools, at the Content-Length in the Response Header section. it says 114 for the above code and you change, say, "Hello" in "Hello!" it'll say 118.
The js code is: (you'll need JQuery as well)
$(document).ready(function(){
$("button").click(function(){
var source = new EventSource("../R/sse.Rhtml");
source.onopen = function(event){
console.log("readyState: " + source.readyState);
}
source.onmessage = function(event){
$("#div").append(event.data);
};
source.onerror = function(event){
console.log(event);
};
});
});
So, in essence
1) The connection is open (readyState 1)
2) Buffering is still there
3) Data (after buffering) reaches the browser but an error happens in receiving them properly.
EIDT2:
it's interesting to note that brew()ing the above .Rhtml file the output is not buffered. There must be a configuration the in the web server (both the R internal and Apache) that buffer the data flows.
As a side note, flush is not even needed, cat's output defaults to stout(). So the options are:
Web server configuration
The R equivalent of the PHP ob_flush(); which is always used in any PHP implementation I've seen. this is example