phppgadmin 5.1 Misc has a deprecated constructor - phppgadmin

10 minute ago I tried to connect with phppgadmin 5.1 but i found this error message on web server error log :
" Misc has a deprecated constructor in /usr/share/phppgadmin/classes/Misc.php on line 8"
Phppgadmin is out of work.
I use php 7.0.
Someone knows how to fix it?
Thanks so much.

In my own research, in PHP 7, PHP 4 style constructors (methods that have the same name as the class they are defined in) are deprecated, and will be removed in the future. PHP 7 will emit E_DEPRECATED if a PHP 4 constructor is the only constructor defined within a class. Classes that implement a __construct() method are unaffected.
So my fix is open Misc.php, and locate the class Misc, in it there is a function called Misc, rename the function name with anything except for Misc because it will produce that error you've mentioned.

I found the same problem.Just browse and find Misc.php file it is located in classes folder inside your phpPgAdmin folder.Then,open it and search for Misc function and change it to anything except MIsc.In my case i changed it to Misc1.enter image description here

The easiest way to solve is to locate the Misc.php file in phppgadmin/classes/ and search for the the constructor function.You can see the class name is Misc and the constructor is also Misc.
This (notice) message is based on changes to PHP 7,So an old way of using a constructor is still in use, is what that message means.
What is expected is instead of having a class with a constructor like this:
<?php
class Misc{
function Misc() {
echo 'I am the constructor';
}
}
?>
would now be expected to look like this:
<?php
class Misc{
function __construct() {
echo 'I am the constructor';
}
}
?>
See the first section section of this PHP 7 deprecation info.
You can just comment out the old method and change it to the new method.It should work fine.
/* Constructor line : 15*/
Function __construct() {
}

Related

Error calling method in java-class 'ClassA' 'org.my.ClassB' is incompatible with 'org.my.ClassB'

I have two classes org.my.ClassA and org.my.ClassB both classes are in the same package org.my in the WEB-INF/src in the same database.
ClassA has the method public add(org.my.ClassB newB){...}.
In SSJS I have a code block in which I call ClassA.add(ClassB) which normally works fine. Until some unknown point where the Server can't see that org.my.ClassB === org.my.ClassB and it returns the error (message translated from German maybe looks different in English version):
error calling method 'add(org.my.ClassB)' in java-class 'ClassA'.
'org.my.ClassB' is incompatible with 'org.my.ClassB'.
and it points to my line in the SSJS: ClassA.add(ClassB);
What I tried so far:
First I added the line importPackage(org.my); to my SSJS Code. No luck.
I tried to add another method add(Object newB) and then cast the object to ClassB but same result. The error does not seem to come from the java class its from the SSJS code because it cant find the method with an argument of the type org.my.ClassB. But if I test the object in the SSJS code it returns org.my.ClassB.
Then I tried to add the classpath to all variables in the SSJS block like: var newB:org.my.ClassB = new org.my.ClassB(). But same result after some time the application breaks with the same error.
From my Point of view it got to do something with the caching of compiled classes, or so because if I clear the database everything works just fine again.
Hope someone has a solution on this.
This is a class loader problem.
You can find more details about the issue in the answer from Frantisek Kossuth:
See here more details: Meaning of java.lang.ClassCastException: someClass incompatible with someClass

Overriding CDocument OnFileSave()

How do I do this? If you could please kindly include the code for message map and the function itself, that would be greatly appreciated.
EDIT:
More specifically I am wondering how OnFileSave() links to OnSaveDocument(LPCSTR lpszPathName)
How does OnFileSave get lpszPathName?
You don't need to do anything special to override OnSaveDocument(...) it's already a virtual function in CDocument, so your derived class can just declare virtual BOOL OnSaveDocument(LPCTSTR lpszPathName); in it's header, then implement it in the document. Nothing is needed in the message map. OnSaveDocument will be called by the framework as part of OnFileSave which is a handler in the base class for ID_FILE_SAVE. The lpszPathName refers to m_strPathName when called by OnFileSafe, which is set when opening a file or by calling SetPathName. If it's empty when saving, the user is prompted for a file name.
CDocument::OnFileSave is the message handler for the Save menu command. To handle it yourself put this in your document class message map:
ON_COMMAND(ID_FILE_SAVE, OnFileSave)
and add your function:
void CYOURDOCUMENT::OnFileSave()
{
CDocument::OnFileSave();
}
To see everything it does put a breakpoint in your function and start single-stepping.

cannot find how 'F1' key works in application

My application is built in MFC.After the application executes I need to open the help file provided with exe.
But as I press F1 application gives an error message saying the file cannot be found. This happens because no such file of that name exist.
One would think how about changing the name of help file itself? well that cannot be done I have to change the path as well.
I need to know how does the function of F1 button work and where can I find the same?
I am using VC++ 6.0 (I know its very old, but I am stuck with it).
Thank you.
To show your specific help file, you have to overwrite CWinApp::OnHelp. The path to the standard help file is stored in CWinApp::m_pszHelpFilePath. In this example, I use my own m_path variable.
void CMyApp::OnHelp()
{
::HtmlHelp(((CMainFrame*)AfxGetMainWnd())->m_hWnd,m_path,HH_DISPLAY_TOPIC,NULL);
}
If I remember correctly, by default it's handled by CWinApp::OnHelp() so take a look at your override of the application class first, you may find the ON_COMMAND handler there.
I had an class that extends CWinApp, so overwriting the OnHelp function worked this way:
In the header:
class MyApp : public CWinApp
{
public:
afx_msg void OnHelp();
}
In the cpp file:
BEGIN_MESSAGE_MAP(MyApp, CWinApp)
ON_COMMAND(ID_HELP, MyApp::OnHelp)
END_MESSAGE_MAP()
void MyApp::OnHelp()
{
// your own help function
}

Autoloading a class in Symfony 2.1

I'm porting a Symfony 1.2 project to Symfony 2.x. I'm currently running the latest 2.1.0-dev release.
From my old project I have a class called Tools which has some simple functions for things like munging arrays into strings and generating slugs from strings. I'd like to use this class in my new project but I'm unclear how to use this class outside of a bundle.
I've looked at various answers here which recommend changing app/autoload.php but my autoload.php looks different to the ones in the answers, maybe something has changed here between 2.0 and 2.1.
I'd like to keep my class in my src or app directories as they're under source control. My vendors directory isn't as I'm using composer to take care of that.
Any advice would be appreciated here.
Another way is to use the /app/config/autoload.php:
<?php
use Doctrine\Common\Annotations\AnnotationRegistry;
$loader = require __DIR__.'/../vendor/autoload.php';
$loader->add( 'YOURNAMESPACE', __DIR__.'/../vendor/YOURVENDOR/src' );
// intl
if (!function_exists('intl_get_error_code')) {
require_once _DIR__.'/../vendor/symfony/symfony/src/Symfony/Component/Locale/Resources/stubs/functions.php';
$loader->add('', __DIR__.'/../vendor/symfony/symfony/src/Symfony/Component/Locale/Resources/stubs');
}
AnnotationRegistry::registerLoader(array($loader, 'loadClass'));
return $loader;
Just replace YOURNAMESPACE and YOURVENDOR with your values. Works quite well for me, so far.
You're correct, I stumbled upon the changes in autoload from 2.0 to 2.1. The above code works fine with the latest version, to which I upgraded my project ;-)
For a simple case like this the quickest solution is creating a folder (for example Common) directly under src and put your class in it.
src
-- Common
-- Tools.php
Tools.php contains your class with proper namespace, for example
<?php
namespace Common;
class Tools
{
public static function slugify($string)
{
// ...
}
}
Before calling your function do not forget the use statement
use Common\Tools;
// ...
Tools::slugify('my test string');
If you put your code under src following the proper folder structure and namespace as above, it will work without touching app/autoload.php.

Kohana 3 Auto loading Models

I'm attempting to use a Model but I get a fatal error so I assume it doesn't autoload properly.
ErrorException [ Fatal Error ]: Class
'Properties_Model' not found
The offending controller line:
$properties = new Properties_Model;
The model:
class Properties_Model extends Model
{
public function __construct()
{
parent::__construct();
}
}
I also put the class in three different locations hoping one would work, all there failed.
They are:
application/classes/model
application/model
application/models
What am I missing?
Ah, I got this question emailed directly to me (via my website's contact form)!
Here is what I responded with (for the benefit of other people which may run into this problem).
The correct location of a model named
properties is
application/classes/model/properties.php
and the class definition would be as
follows
class Model_Properties extends Model { }
Think of the underscore above as the
directory separator. That is, if you
replaced the underscore with a / you
would have: 'model/properties', which
will be your file under application/classes.
To load the model from a controller,
you can use PHP's standard new
operator or do what I prefer, which is
$propertiesModel = Model::factory('Properties');
I'm not 100% why I prefer this way...
but it works for me :)
First off, The Kohana 3 fileyestem does not work like Kohana 2's!
In K2 the autoloader looks at the class name searches for the class in different folders, based on the suffix of the class.
In K3, class names are "converted" to file paths by replacing underscores with slashes.
i.e. Class Properties_Model becomes classes/properties/model.php
As you can see, using a Model suffix in this new system won't really help to group your models, so basically you prepend "Model" to the class name instead of suffixing it:
Model_Property is located in classes/model/property.php
For more information see the Kohana 3 userguide

Resources