"Class String could not be loaded" PHP Haxe Error - php

I'm getting the following stacktrace, which appears as if PHP chokes while attempting to parse the boot class:
<pre>uncaught exception: <b>Class String could not be loaded</b><br /><br />in file: /path/to/haxe-php-lib/lib/php/Boot.class.php line 751<br />#0 [internal function]: spl_autoload('String')
#1 /path/to/haxe-php-lib/lib/php/Boot.class.php(751): property_exists('String', '__meta__')
#2 /path/to/haxe-php-lib/lib/php/Boot.class.php(857): _hx_type->__construct('String', 'String')
#3 /path/to/NativePHPUtil.php(334): require_once('/path/to/haxe-php-lib/include.php') //include.php is basically `require_once dirname(__FILE__).'/lib/php/Boot.class.php'; restore_exception_handler();`
#4 [internal function]: NativePHPUtil->addRecord('record-name', 'record-type', Object(stdClass))
#5 /path/to/NativePHPController.php(244): call_user_func_array(Array, Array)
#6 /path/index.php(89): NativePHPController->handle()
#7 {main}</pre>
Function from Boot.class.php(751):
public function __construct($cn, $qn, $path = null) {
$this->__tname__ = $cn;
$this->__qname__ = $qn;
$this->__path__ = $path;
if(property_exists($cn, '__meta__'))
$this->__meta__ = eval($cn.'::$__meta__');
}
It doesn't appear to be getting to using haxe-php-lib, just loading the necessary files. So I tried turning off dead-code-removal for PHP and reverting to using the require_once dirname(__FILE__).'/lib/php/Boot.class.php' directly, no joy.
This just started happening on my testing server (PHP 5.3 on Debian) a few days ago and there were no obvious changes to prompt the issue. I've tried pulling down a fresh copy from Git and fiddling with permissions.
What is spl_autoload('String') doing? Any guesses as to what might be causing the issue?
Update We commented out the if statement and everything seems to be working just fine....

Related

Yii 1.1.13 dies with error 500 after using addError

I'm working on a tool which uses Yii version 1.1.13 and after addig new error messages with the addErrormethod, despite it worked fine on the page I used it, it threw a strange, long error message on the index page with an error 500.
Missing argument 1 for CModel::getError(), called in /var/www/html/framework/base/CComponent.php on line 111 and defined (/var/www/html/framework/base/CModel.php:371)
Stack trace:
#0 /var/www/html/protected/models/Testcases.php(132): Testcases->__get()
#1 /var/www/html/protected/views/site/index.php(189): Testcases->search()
#2 /var/www/html/framework/web/CBaseController.php(126): require()
#3 /var/www/html/framework/web/CBaseController.php(95): SiteController->renderInternal()
#4 /var/www/html/framework/web/CController.php(869): SiteController->renderFile()
#5 /var/www/html/framework/web/CController.php(782): SiteController->renderPartial()
#6 /var/www/html/protected/controllers/SiteController.php(295): SiteController->render()
#7 /var/www/html/framework/web/actions/CInlineAction.php(49): SiteController->actionIndex()
#8 /var/www/html/framework/web/CController.php(308): CInlineAction->runWithParams()
#9 /var/www/html/framework/web/CController.php(286): SiteController->runAction()
#10 /var/www/html/framework/web/CController.php(265): SiteController->runActionWithFilters()
#11 /var/www/html/framework/web/CWebApplication.php(282): SiteController->run()
#12 /var/www/html/framework/web/CWebApplication.php(141): CWebApplication->runController()
#13 /var/www/html/framework/base/CApplication.php(184): CWebApplication->processRequest()
#14 /var/www/html/index.php(13): CWebApplication->run()
REQUEST_URI=/index.php
in /var/www/html/protected/models/Testcases.php (132)
in /var/www/html/protected/views/site/index.php (189)
in /var/www/html/protected/controllers/SiteController.php (295)
This bug appeared after generating test cases for my new error message. Then I reverted my modified file from the svn repository as the previous version worked fine, but I still can't get rid of this message.
I added the new errors like this:
if (FieldsQueue::model()->exists("fieldname = 'something'"))
$model->addError('Error', "Something happened");
else if (!isset($_POST['something']))
$model->addError('test',"This is the new error);
else { do something }
Thanks in advance for your helping answers. :)
Hii The definition of addError is
public void addError(string $attribute, string $error)
$attribute Should be your model (db) attribute
In your code
$model->addError('Error', "Something happened");
Error Should be your model attribute
Finally solved, there was a row in the database which caused an error, I still don't know how, and which one was it (I just deleted some I added recently before the bug appeared). It is actually very strange because there wasn't anything about the DB in this error message.

AnchorCMS installation fails

When I've gone through the installation steps for Anchor CMS, I'm getting an error (after final step):
Uncaught Exception
Undefined variable: vars
Origin
install/routes.php on line 183
Trace
#0 /home/.../anchor-cms/install/routes.php(183): System\error::native(8, 'Undefined varia...', '/home/...', 183, Array)
#1 [internal function]: {closure}()
#2 /home/.../anchor-cms/system/route.php(165): call_user_func_array(Object(Closure), Array)
#3 /home/.../anchor-cms/system/router.php(158): System\route->run()
#4 /home/.../anchor-cms/system/start.php(46): System\router->dispatch()
#5 /home/.../anchor-cms/install/index.php(33): require('/home/...')
#6 {main}
Any suggestions? I'm running Linux 64bit (elementaryOS).
You may have already resolved this, but the way I got around this was to remove the undefined variable from line 183 of the install/routes.php file completely.
return Layout::create('account' $vars);
So it then looked like this:
return Layout::create('account');
Refreshing the page will then allow you to create an account and login to the admin interface etc.

How to make zf2 output errors with simple formatting?

I am newbie with zf2 framework. For example, now I get this error:
Fatal error: Uncaught exception 'Zend\ModuleManager\Exception\RuntimeException' with message 'Module (ZfcUserOverride) could not be initialized.' in F:\Server\domains\zf2-skeleton\vendor\zendframework\zendframework\library\Zend\ModuleManager\ModuleManager.php:189 Stack trace:
#0 F:\Server\domains\zf2-skeleton\vendor\zendframework\zendframework\library\Zend\ModuleManager\ModuleManager.php(163): Zend\ModuleManager\ModuleManager->loadModuleByName(Object(Zend\ModuleManager\ModuleEvent))
#1 F:\Server\domains\zf2-skeleton\vendor\zendframework\zendframework\library\Zend\ModuleManager\ModuleManager.php(90): Zend\ModuleManager\ModuleManager->loadModule('ZfcUserOverride')
#2 [internal function]: Zend\ModuleManager\ModuleManager->onLoadModules(Object(Zend\ModuleManager\ModuleEvent))
#3 F:\Server\domains\zf2-skeleton\vendor\zendframework\zendframework\library\Zend\EventManager\EventManager.php(468): call_user_func(Array, Object(Zend\ModuleManager\ModuleEvent))
#4 F:\Server\domains\zf2-skeleton\vendor\zendframework\zendframework\library\Zend\EventManager\EventManager.php(207): Zend\EventManager\EventManager->triggerListeners('loadModules', Object(Zend\ModuleManager\ModuleEvent), NULL)
#5 F:\Server\domains\zf2-skeleton\vendor\zendframework\zendframework\library\Zend\ModuleManager\ModuleManager.php(109): Zend\EventManager\EventManager->trigger('loadModules', Object(Zend\ModuleManager\ModuleManager), Object(Zend\ModuleManager\ModuleEvent))
#6 F:\Server\domains\zf2-skeleton\vendor\zendframework\zendframework\library\Zend\Mvc\Application.php(252): Zend\ModuleManager\ModuleManager->loadModules()
#7 F:\Server\domains\zf2-skeleton\public\index.php(17): Zend\Mvc\Application::init(Array)
#8 {main} thrown in F:\Server\domains\zf2-skeleton\vendor\zendframework\zendframework\library\Zend\ModuleManager\ModuleManager.php on line 189
I formatted it manually, so you can read correct error.
It is hard to do it all time I get some error. How I can make zf2 to output such errors correctly?
I need something like this:
The ZendSkeletonApplication comes with a template that reports errors in a readable format. If you install the ZendSkeletonApplication and build your application off of it, you’ll benefit from this template and other conveniences. Alternatively, you can use just the standard error template or create your own.

Time-out until restart

I set up a cassandra cluster with 2 nodes. After a couple thousand of writes, it starts throwing TimeOut exceptions that don’t go away until after I restart the cassandra services. I am using phpcassa (latest at time of writing).
Cassandra.yaml both
cluster_name: 'Test Cluster'
seed_provider:
class_name: org.apache.cassandra.locator.SimpleSeedProvider
parameters:
seeds: "192.168.2.101"
rpc_address: 0.0.0.0
rpc_port: 8080
Cassandra.yaml 1
initial_token: 0
listen_address: 192.168.2.101
Cassandra.yaml 2
initial_token: 85070591730234615865843651857942052864
listen_address: 192.168.2.102
Assuming this configuration is correct, there must be an issue with my code. Here’s the test script I made to reproduce the error:
$pool = Config::ConnectionPool();
$stressTest = new ColumnFamily($pool, 'TwitterTest');
$id = 392766928478932992;
while(true)
{
try
{
$stressTest->insert($id++, array("analyzed"=>0, "followersCount"=>"35",
"friendsCount"=>"30", "lang"=>"en", "listedCount"=>"0",
"name"=>"Henky Tanky", "statusesCount"=>"X", "text"=>"#HERPDERP dude i kno i lost a 16gb flash drive #MEH",
"time"=>"2013-10-22 23:38:27", "twitterId"=>"392766928478932992", "username"=>"mehzor"),
null, null, \cassandra\ConsistencyLevel::ANY);
}
catch (Exception $ex){
print_r($ex);
exit;
}
}
class Config {
static function ConnectionPool(){
return new ConnectionPool('KSTwit', array('192.168.2.101:8080', '192.168.2.102:8080'));
}
}
With that config I get a 'cassandra\TimedOutException' (Stacktrace 1)
// Set max-retries to 5, and read/write timeout to 60 seconds
new ConnectionPool('KSTwit', array('192.168.2.101:8080', '192.168.2.102:8080'), NULL, 5, 60000, 60000);
With that config I get a 'Thrift\Exception\TTransportException' (Stacktrace 2)
I have tried various ConsistencyLevels;
ONE, QUORUM and ANY. Same issue with all of them.
As I said, the exceptions don’t occur until after a couple throusand of writes. However, if I restart the script after an exception ocurred it will throw exceptions immediately. I have to restart the cassandra services and then it can take a couple thousand again. This only seems to occur with writes. It also occurs if I don’t use counter columns so it’s not an issue with that.
Stack trace 1
Error performing add on 192.168.2.101:8080: exception 'cassandra\TimedOutException' in /var/installstuff/cassphp/lib/Thrift/Base/TBase.php:206
Stack trace:
#0 /var/installstuff/cassphp/lib/cassandra/Cassandra.php(3575): Thrift\Base\TBase->_read('Cassandra_add_r...', Array, Object(Thrift\Protocol\TBinaryProtocolAccelerated))
#1 /var/installstuff/cassphp/lib/cassandra/Cassandra.php(768): cassandra\Cassandra_add_result->read(Object(Thrift\Protocol\TBinaryProtocolAccelerated))
#2 /var/installstuff/cassphp/lib/cassandra/Cassandra.php(728): cassandra\CassandraClient->recv_add()
#3 [internal function]: cassandra\CassandraClient->add('All Tweets', Object(cassandra\ColumnParent), Object(cassandra\CounterColumn), 1)
#4 /var/installstuff/cassphp/lib/phpcassa/Connection/ConnectionPool.php(264): call_user_func_array(Array, Array)
#5 /var/installstuff/cassphp/lib/phpcassa/ColumnFamily.php(44): phpcassa\Connection\ConnectionPool->call('add', 'All Tweets', Object(cassandra\ColumnParent), Object(cassandra\CounterColumn), 1)
#6 /var/installstuff/cassphp/examples/db/TweetDatabase.php(103): phpcassa\ColumnFamily->add('All Tweets', 'Total')
#7 /var/installstuff/cassphp/examples/core/Helper.php(16): {closure}()
#8 /var/installstuff/cassphp/examples/db/TweetDatabase.php(104): Helper::DoForgiving(Object(Closure))
#9 /var/installstuff/cassphp/examples/core/twitterParser.php(98): TweetDatabaseCassandra->AddTweet('392633738364190...', Array)
#10 /var/installstuff/cassphp/examples/core/twitterParser.php(192): TwitterParser->RunOnce()
#11 /var/installstuff/cassphp/examples/runners/twitterParserCassandra.php(19): TwitterParser->Run()
#12 {main}
Stack trace 2
Error performing add on 192.168.2.101:8080: exception 'Thrift\Exception\TTransportException' with message 'TSocket: timed out reading 4 bytes from 192.168.2.101:8080' in /var/installstuff/cassphp/lib/Thrift/Transport/TSocket.php:284
Stack trace:
#0 /var/installstuff/cassphp/lib/Thrift/Transport/TTransport.php(74): Thrift\Transport\TSocket->read(4)
#1 /var/installstuff/cassphp/lib/Thrift/Transport/TFramedTransport.php(139): Thrift\Transport\TTransport->readAll(4)
#2 /var/installstuff/cassphp/lib/Thrift/Transport/TFramedTransport.php(106): Thrift\Transport\TFramedTransport->readFrame()
#3 /var/installstuff/cassphp/lib/Thrift/Transport/TTransport.php(74): Thrift\Transport\TFramedTransport->read(4)
#4 /var/installstuff/cassphp/lib/Thrift/Protocol/TBinaryProtocol.php(305): Thrift\Transport\TTransport->readAll(4)
#5 /var/installstuff/cassphp/lib/Thrift/Protocol/TBinaryProtocol.php(197): Thrift\Protocol\TBinaryProtocol->readI32(NULL)
#6 /var/installstuff/cassphp/lib/cassandra/Cassandra.php(760): Thrift\Protocol\TBinaryProtocol->readMessageBegin(NULL, 0, 0)
#7 /var/installstuff/cassphp/lib/cassandra/Cassandra.php(728): cassandra\CassandraClient->recv_add()
#8 [internal function]: cassandra\CassandraClient->add('All Tweets', Object(cassandra\ColumnParent), Object(cassandra\CounterColumn), 1)
#9 /var/installstuff/cassphp/lib/phpcassa/Connection/ConnectionPool.php(264): call_user_func_array(Array, Array)
#10 /var/installstuff/cassphp/lib/phpcassa/ColumnFamily.php(44): phpcassa\Connection\ConnectionPool->call('add', 'All Tweets', Object(cassandra\ColumnParent), Object(cassandra\CounterColumn), 1)
#11 /var/installstuff/cassphp/examples/db/TweetDatabase.php(103): phpcassa\ColumnFamily->add('All Tweets', 'Total')
#12 /var/installstuff/cassphp/examples/core/Helper.php(17): {closure}()
#13 /var/installstuff/cassphp/examples/db/TweetDatabase.php(104): Helper::DoForgiving(Object(Closure))
#14 /var/installstuff/cassphp/examples/core/twitterParser.php(98): TweetDatabaseCassandra->AddTweet('392642135327264...', Array)
#15 /var/installstuff/cassphp/examples/core/twitterParser.php(192): TwitterParser->RunOnce()
#16 /var/installstuff/cassphp/examples/runners/twitterParserCassandra.php(19): TwitterParser->Run()
#17 {main}
The cassandra log doesn't really show anything interesting. Except for this ocurring a lot, but that happens even when the exceptions don't occur so I don't think it's the issue;
INFO 10:58:58,241 Timed out replaying hints to /192.168.2.102; aborting further deliveries
WARN 11:07:17,979 MemoryMeter uninitialized (jamm not specified as java agent); assuming liveRatio of 10.0. Usually this means cassandra-env.sh disabled jamm because you are using a buggy JRE; upgrade to the Sun JRE instead
Keyspace is setup using ‘SIMPLE_STRATEGY’ and ‘replication_factor=2’ According to the ‘nodetool ring’ command on both machines, the nodes are functioning ‘normal’ even after the exceptions have been triggered. I honestly don’t know what to try next, can anyone spot the issue?
I fixed the issue in one of two ways (can't be sure.)
I initially installed cassandra using a guide online which listed these repo's;
deb http://www.apache.org/dist/cassandra/debian 11x main
deb-src http://www.apache.org/dist/cassandra/debian 11x main
These are outdated, there's a 20x version, so I updated to that.
I also replaced jsvc with sun's java. It's all working fine now.

Yii framework - controller actions

I am trying to create sample project in yii but I am having this problem while trying to run my code:
CHttpException
The system is unable to find the requested action "error". (C:\wamp\www\yii\framework\web\CController.php:484)
#0 C:\wamp\www\yii\framework\web\CController.php(271): CController->missingAction('error')
#1 C:\wamp\www\yii\framework\web\CWebApplication.php(276): CController->run('error')
#2 C:\wamp\www\yii\framework\base\CErrorHandler.php(310): CWebApplication->runController('site/error')
#3 C:\wamp\www\yii\framework\base\CErrorHandler.php(183): CErrorHandler->render('error', Array)
#4 C:\wamp\www\yii\framework\base\CErrorHandler.php(108): CErrorHandler->handleException(Object(CHttpException))
#5 C:\wamp\www\yii\framework\base\CApplication.php(713): CErrorHandler->handle(Object(CExceptionEvent))
#6 [internal function]: CApplication->handleException(Object(CHttpException))
#7 {main}
Can anyone tell me the reason ? As I think this is not the problem of my code.
An exception has occurred (most likely due to a bug or misconfiguration) and Yii attempted to run the error handler, which in this case is the error action on the site controller.
The error occurs because you do not have a site controller, or it does not have an error action.

Categories