Session_regenerate_id error in MacOS - yii

I have the following code in yii
$identity=new UserIdentity($username,$password);
if($identity->authenticate())
{
Yii::app()->User->login($identity);
$this->redirect(array('site/index'));
}
else
{
}
It works fine on XAMPP in Windows environment. But when i test it in Mac OS it gives the following error
session_regenerate_id(): Cannot regenerate session id - headers
already sent
Can anyone explain why this is happening and fix the problem?
Thanks in advance

Related

Spark with Kotlin Tutorial from Github is not working

i installed the tutorial project https://github.com/tipsy/spark-kotlin in the latest jetbrains community ide and started the code. I started the project, went to http://localhost:4567/ and i see 404 Not found in the chrome browser. In the console i see a std output of the user collection and messages like:
"[qtp955940837-21] INFO spark.http.matching.MatcherFilter - The
requested route [/] has not been mapped in Spark for Accept:
[text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,/;q=0.8]"
I'm new spark and i don't know how to fix it. I'm running on java 10 right now.
thanks for your help :-)
You shouldn't browse http://localhost:4567. You should browse http://localhost:4567/users.
According to the source code:
path("/users") {
get("") { req, res ->
jacksonObjectMapper().writeValueAsString(userDao.users)
}
get("/:id") { req, res ->
userDao.findById(req.params("id").toInt())
}
// .... blabla
There is no listener for /.

Fatal error: Class 'PHPUnit_Extensions_Selenium2TestCase' not found in *.php

I am completely new to Seleniu, and am trying to set up PHPUnit with Selenium 2, following this tutorial https://www.youtube.com/watch?v=zva_GETXimI
So far this is what I've done:
Installed PHPUnit using PHAR as instructed here https://phpunit.de/manual/current/en/installation.html
Installed Selenium Server
Upgraded to PHP5.6 (but my Apache is still 2.22 instead of 2.4)
Installed PHPUnit_selenium package using Composer
Created a testLogin.php file:
<?php
class testLogin extends PHPUnit_Extensions_Selenium2TestCase{
public function setUp()
{
$this->setHost('localhost');
$this->setPort(4444);
$this->setBrowser('firefox');
$this->setBrowserUrl('http://localhost/Achievers');
}
}
When I run testLogin.php using 'phpunit testLogin.php' I get an error:
Class 'PHPUnit_Extensions_Selenium2TestCase' not found in /home/osadmin/projects/Sel/testLogin.php on line 5
Since I am just starting out, I have no idea how to fix this. On googling the error, it shows to add this line to my php file:
require_once('PHPUnit/Extensions/Selenium2TestCase.php');
But I'm not sure how I can use this since there is no PHPUnit folder, just a file linked to the PHAR.
Could someone please shed some light on how to fix this issue?
Thanks.
EDIT:
As per Ushakov's suggestion, I tried /path/to/phpunit.phar testLogin.php
But it gives the same error.
If I add this line to the testLogin.php: require_once('/usr/local/bin/phpunit');
and run /path/to/phpunit.phar testLogin.php
I get this:
#!/usr/bin/env php
PHP Notice: Constant __PHPUNIT_PHAR__ already defined in /usr/local/bin/phpunit on line 18
PHP Notice: Constant __PHPUNIT_PHAR_ROOT__ already defined in /usr/local/bin/phpunit on line 19
PHP Fatal error: Cannot redeclare class DeepCopy\DeepCopy in phar:///usr/local/bin/phpunit/myclabs-deep-copy/DeepCopy/DeepCopy.php on line 15
Solved it by adding this line to the PHP file:
require_once 'vendor/autoload.php';
No tutorial I have seen mentions this, but it can be found in github projects
For anyone else coming late to the party - this worked for me:
class testLogin extends \PHPUnit\Extensions\Selenium2TestCase
(Using PHP 7.0.3 and installing Selenium package with Composer ).

Expected Safari data directory does not exist

Selenium 2.41,
Mac_OSX = 10.8.5,
Safari = 6.0.5
While launching Safari driver getting error message "The expected Safari data directory does not exist: /Users/null/Library/Safari"
After googling found out code in Safari extension classes is expecting System.getenv("USER"),
if (Platform.MAC.is(current)) {
return new File("/Users/" + System.getenv("USER"), "Library/Safari");
}
Configured .bash_profile and launchd.conf file, However this does not seem to fix the issue...
When i execute syso(System.getenv("USER"); in eclipse ide its still returning "null"
Could anyone please assist in resolving this issue
Thanks In advance
That'w weird, I'm on mac and in terminal:
echo $USER
gives my user.
According to http://docs.oracle.com/javase/tutorial/essential/environment/sysprop.html the correct property for your question would be
System.getProperty("user.name")
Also have a look at System.getProperty("user.home") (but note it could get messy under Windows when using Java 7 or older).

Worklight - EncryptedCache open fails with error status 10

I am having some problems with EncryptedCache on my HTC One Android phone.
The same code works on another phone and in the browser simulator but fails on my HTC One android phone with an unusual error code.
I am using: Worklight 6.2
Failing on: HTC one, android 4.4.2 (Cyanogenmod)
Working on: Samsung I9100 Galaxy S II
Working on: browser simulator
WL.EncryptedCache.open fails on my phone and return status 10..
(* WL.EncryptedCache.write fails on my phone and return status 6..)
I have also run the sample app from developerworks as-is on my HTC One phone with the same results and error code.
Sample app link
Logcat log:
Captured from Sample app
1) Destroyed cache
2) Entered a new key
3) Opened cache
4) Got alert error message
Full log can be downloaded from here
My code is:
function wlCommonInit(){
var STORAGE_ID = 'todos';
WL.EncryptedCache.open(STORAGE_ID, true,
function(){ //success
console.log('--> cache opened');
console.log("--> Loading Angular");
angular.element(document).ready(function() {
angular.bootstrap(document, ['todomvc']);
//location.hash = "/";
});
},
function(status){ //fail
console.log("WL.EncryptedCache open error status: " + status);
switch(status){
case WL.EncryptedCache.ERROR_KEY_CREATION_IN_PROGRESS:
alert("ERROR: KEY CREATION IN PROGRESS");
break;
case WL.EncryptedCache.ERROR_LOCAL_STORAGE_NOT_SUPPORTED:
alert("ERROR: LOCAL STORAGE NOT SUPPORTED");
break;
case WL.EncryptedCache.ERROR_NO_EOC:
alert("ERROR: NO EOC");
break;
case WL.EncryptedCache.ERROR_COULD_NOT_GENERATE_KEY:
alert("ERROR: COULD NOT GENERATE KEY");
break;
case WL.EncryptedCache.ERROR_CREDENTIALS_MISMATCH:
alert("ERROR: CREDENTIALS MISMATCH");
break;
default:
alert("AN ERROR HAS OCCURED. STATUS :: " + status);
}
});
}
Sorry to say I cannot currently reproduce this.
Installed Worklight Studio 6.2 from the Eclipse marketplace into a fresh copy of Eclipse and a new workspace
Downloaded the Encrypted Offline Cache sample project > import to Eclipse
Added the Android environment and > Run As > Run on Worklight Development Server
Installed on device (Nexus 5, Android 4.4)
Opened a cache, encrypted some value, closed cache, quit app, re-open, re-open cache, decrypt key, etc etc... all operations seem to pass.
Could you please use Wireshark while you use the app and provide the trace log from there?
In addition, if you could also try the above steps.
I too was getting the same error. My steps were open cache, write, close. Then open again and read.
The issue was close and open again. I kept the cache open for the entire session and it worked fine.
Looks like when you destroy cache, you might have to close it and open again to write a new entry.
Hope it helps.

XCode - Internal Error when starting a specific project

It first happend, when I changed something with the .xib-File and somehow I cannot find anything similiar (enough) on the internet that might help. And of course I did try turning it off and on again!
More details from the alert window I got:
Internal Error
File: /SourceCache/DevToolsBase/DevToolsBase-1691/pbxindex/PBXProjectIndex.m
Line: 6266
Object:
Method: _locationForNewFileRecords:
Assertion failed: headHeader && headHeader->type == PBXSymFreeBlock
Thanks for your help in advance!
This solution sounds a bit odd but try this:
Clean all Targets in XCode
Close XCode
Restart your Mac
Try to build your app again