I'm Problems Using Doctrine does not Jelastic .
Displays the Problem:
"Warning: require_once ( /vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/Driver/DoctrineAnnotations.php " ) : failed to open stream : No such file or directory in /var/www/webroot/ROOT/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/AnnotationRegistry.php on line 64 Fatal error: require_once (): Failed opening require ' /vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/Driver/DoctrineAnnotations.php ' ( include_path = ' .: / usr / share / pear ' ) in /var/www/webroot/ROOT/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/AnnotationRegistry.php the line 64 .
Following url problem: http://temprafesta.jelasticls.com.br/
I have already installed the ZF2 + Composer via SSH and its dependencies. Occurred with success , but when I make an appointment with the Doctrine presents this error.
Could anyone help ?
Kind Regards,
Allan .
From the given error it's clear that the base path is not taken into account. Likely it's a bug in Doctrine. Have you been able to check out another version of Doctrine?
Well, the file that emits that error is this one:
https://github.com/doctrine/annotations/blob/master/lib/Doctrine/Common/Annotations/AnnotationRegistry.php#L64
/**
* Registers file.
*
* #param string $file
*
* #return void
*/
static public function registerFile($file)
{
require_once $file;
}
I dont't know why someone would want to call this method, but there's only two scenarios: It's either Doctrine's code internally, or it's your code.
I've not found too many places where doctrine calls this function, but this one sounds like it's it:
https://github.com/doctrine/doctrine2/blob/664b6bf4c52c893011ec4b7b3c99e94399ed0316/lib/Doctrine/ORM/Configuration.php#L153
Now the question is: Why is __DIR__ being evaluated to /vendor/doctrine/orm/lib/Doctrine/ORM there? It doesn't make sense, unless PHP gets confused because of any fancy filesystem stuff. I'd recommend diving into this part and add some debug output there just to be sure everything works as expected there. I think it doesn't.
Related
I have a variable declared in config/services.yaml
parameters:
login_url: '%env(string:APP_FRONTEND_DOMAIN)%'
I am accessing it in my controller like this:
$loginUrl = (string) ($this->getParameter('login_url') ?? "");
Everything works fine, but psalm is giving following error:
ERROR: PossiblyInvalidCast - src/Controller/MyController.php:57:31 - UnitEnum cannot be cast to string (see https://psalm.dev/190)
$loginUrl = (string) ($this->getParameter('login_url') ?? "");
Any suggestions, how to fix it, please?
Duplicated the question in the official github issue of the pslam-plugin-symfony: https://github.com/psalm/psalm-plugin-symfony/issues/272
Symfony started documenting that getParameter can return UnitEnum in specific cases. This throws up Psalm analysis because in most cases, this is not what happens and you just get a scalar in return.
Unfortunately, this is not something that can be easily handled on the user side (you'd have to make a proxy method to make sure you exclude the UnitEnum case). So ideally, it should be handled by the Psalm's Symfony plugin (even if I'm not sure how). I suggest creating an issue on the tracker on github as I don't see it yet.
Source: I'm a Psalm maintainer
As I mentioned, I duplicated the issue in github pages of the psalm and psalm-plugin and actually received the answer from one of them which solves my problem.
The answer is copied from: https://github.com/psalm/psalm-plugin-symfony/issues/272#issuecomment-1211802478
Here is the related part on Symfony side:
/**
* Gets a service container parameter.
*
* #return array|bool|string|int|float|\UnitEnum|null
*
* #throws ParameterNotFoundException if the parameter is not defined
*/
public function get(string $name);
According to the code, it means $login_url can be array, bool, etc. including \UnitEnum which cannot be casted to string. Thus the error is correct actually.
On the other hand, I know that you specified the type on parameters with environment variable which should be string. To be able to infer the type of parameter, the plugin needs to analyze compiled container XML (assuming that you already configured it) which is currently missing.
For now, you can rewrite it to tackle the error:
$loginUrl = $this->getParameter('login_url');
$loginUrl = is_string($loginUrl) ? $loginUrl : '';
Background: I have installed composer installed zircote/swagger-php and have installed openapi-generator-cli with apt-get.
I am not sure whether or not I am attempting to use these tools correctly, however I've been unable to find documentation pointing me in any direction.
I have a controller file with a whole bunch of code in it. I want to test whether or not I can generate a json file from it using open api annotation.
Here's a sample of my code (I've cut out unrelated chunks of it):
<?php
/**
* #OA\Info(title="My First API", version="0.1")
*/
class Apiv1_LocationController extends App_Controller_API
{
/* Publicly exposed attributes and the field type for filtering */
protected $_exported = array('id','created','modified','name','address','phone','external_id','postcode','country','timezone','date_format','lacps','staff_count');
protected $_schematypes = array(
'string' => ['name','address','phone','external_id','postcode','country','timezone','date_format'],
'int' => ['id','staff_count'],
'timestamp' => ['created','modified'],
'complex'=> ['lacps'],
);
{more unrelated code...}
/**
* #OA\Get(
* path="/api/resource.json",
* #OA\Response(response="200", description="An example resource")
* )
*/
public function getAction()
{
{code inside action...}
}
}
The cli command I use:
openapi-generator-cli generate -g php -i <path_to_LocationController>
I get the following error:
[main] INFO o.o.c.ignore.CodegenIgnoreProcessor - No .openapi-generator-ignore file found.
Exception in thread "main" java.lang.RuntimeException: Issues with the OpenAPI input. Possible causes: invalid/missing spec, malformed JSON/YAML files, etc.
This leads me to believe I am using the openapi-generator-cli tool incorrectly, since I wouldn't be expecting to need a JSON or YAML file, I am trying to generate that file.
I'll keep trying, but if someone could help me realized what I'm doing wrong or how I'm misunderstanding the tool, I'd really appreciate it.
So I realized I'd been going about this in entirely the wrong way.
I used the zircote/swagger-php library to generate the JSON file I required with the following command (In the directory where I wanted the JSON to be generated):
./<path_to_vendor_directory>/vendor/zircote/swagger-php/bin/openapi --pattern "*Controller.php" --output <name_of_file>.json --format json <location_to_search_from_recursively>
I'm running Typo3 7.6 and foolishly tried an out of date extension on my site. I got one error, tried to uninstall the extension and that just made things worse. Now the whole system is crashed from back and front with this error:
Parse error: syntax error, unexpected '=' in
/html/typo3/typo3_src-7.6.10/typo3/sysext/core/Classes/Utility/ExtensionManagementUtility.php
on line 1654
Not sure what it wants me to do with this information.
Here's my code in ExtensionManagementUtility.php on line 1654:
/**
* Execute ext_localconf.php files from extensions
*
* #return void
*/
protected static function loadSingleExtLocalconfFiles()
{
// This is the main array meant to be manipulated in the ext_localconf.php files
// In general it is recommended to not rely on it to be globally defined in that
// scope but to use $GLOBALS['TYPO3_CONF_VARS'] instead.
// Nevertheless we define it here as global for backwards compatibility.
global $TYPO3_CONF_VARS;
foreach ($GLOBALS['TYPO3_LOADED_EXT'] as $_EXTKEY => $extensionInformation) {
if ((is_array($extensionInformation) || $extensionInformation instanceof \ArrayAccess) && isset($extensionInformation['ext_localconf.php'])) {
// $_EXTKEY and $_EXTCONF are available in ext_localconf.php
// and are explicitly set in cached file as well
$_EXTCONF = isset($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf'][$_EXTKEY]) ? $GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf'][$_EXTKEY] : null;
require $extensionInformation['ext_localconf.php'];
}
}
}
How do I get out of this mess?
if you just want to recover your installation you need to deactivate that new extension.
you can try to do it in the install tool (just call your-domain.tld/typo3/install/): in the area "Important Actions" you can find the option Check for broken extensions
or you do it by hand: edit typo3conf/PackageStates.php, search that extension and change the state from active to inactive. then clear all caches!
afterwards you can remove the extension.
It seems that this problem comes from one of the included files, i.e. the configuration of one of your extensions. I don’t get why PHP does not display the actual file name then, but well… lets try to fix it:
To get the filename, insert a line before require… to output it:
echo $_EXTKEY, " ", $extensionInformation['ext_localconf.php'], "\n";
require $extensionInformation['ext_localconf.php'];
After a reload, you should see a list of extension keys and file names, with the last one being the one causing the trouble.
I've installed phpDoc on our server, set up etc. It's producing documentation correctly.
We're using the 'Responsive' template, however this error occurs regardless of the template used.
Under the 'Errors', each file scanned seems to have the following error:
Type Line Description
error 0 No summary was found for this file
I've googled exhaustively for this, and can't find a solution. I've even gone through the effort of tracking down the server error code behind the message PPC:ERR-50000 and attempting to track back the condition which causes the error, but got a bit lost.
My Question:
What does this error mean? Why is it on line 0, and how the hell do I get rid of it?! Even if I have done the docblock correctly, can I hide this error? My error-free ocd is going crazy!
Many thanks
EDIT
Some extra information: Each of my files have the following docblock from line 1 of the file:
<?php
/**
* Short Description
*
* Long Description
*
* #package Some Package
* #subpackage Some Subpackage
* #category Some Category
* #author F Bloggs <gbloggs#email.com>
*/
?>
But does the top of your file have two such docblocks? The first docblock is expected to be the one for the file itself, and a second docblock should pair up with the first documentable code element that appears after it.
However, if you only have one docblock at the top of the file, it will get paired up with the first code element found, thus the "file itself" will seem to be missing its docblock. That is what that error is supposed to indicate.
#ashnazg is right but I want to improve your answer with an example.
A File-level DocBlock should be the first docblock and must have a Summary (in this example the summary is "Class Category | core/Category.class.php").
Then a Class-level DocBlock is placed before a class definition.
<?php
/**
* Class Category | core/Category.class.php
*
* #package MyApp XYZ
* #subpackage Categories
* #author Sandro Miguel Marques <sandromiguel#something.com>
* #version v.1.1 (06/12/2016)
* #copyright Copyright (c) 2016, Sandro
*/
namespace Myapp;
use \PDO;
use \Exception;
use \PDOException;
/**
* Class Category - active record
*
* Recipe categories
*/
class Category {
...
So after a lot of searching on the server, I have a semi-fix for the problem should anyone else be encountering the same issue.
I've found out how to hide the error from the documentation, but not what is causing it.
If the error you are receiving is on Line 0, and is no summary found for this file, then you will need to edit the following file:
phpDocumentor/src/phpDocumentor/Plugin/Core/Transformer/Writer/xml.php
You will then need to search for the protected method: createErrorEntry()
This is what the existing method looks like:
protected function createErrorEntry($error, $parse_errors)
{
$marker_obj = new \DOMElement(strtolower($error->getSeverity()));
$parse_errors->appendChild($marker_obj);
$message = ($this->getTranslator())
? vsprintf($this->getTranslator()->translate($error->getCode()), $error->getContext())
: $error->getCode();
$marker_obj->appendChild(new \DOMText($message));
$marker_obj->setAttribute('line', $error->getLine());
$marker_obj->setAttribute('code', $error->getCode());
}
This method needs to have an IF condition added. Wrap the entire body of the method in the following IF condition:
protected function createErrorEntry($error, $parse_errors)
{
if($error->getCode()!=='PPC:ERR-50000')
{
$marker_obj = new \DOMElement(strtolower($error->getSeverity()));
$parse_errors->appendChild($marker_obj);
$message = ($this->getTranslator())
? vsprintf($this->getTranslator()->translate($error->getCode()), $error->getContext())
: $error->getCode();
$marker_obj->appendChild(new \DOMText($message));
$marker_obj->setAttribute('line', $error->getLine());
$marker_obj->setAttribute('code', $error->getCode());
}
}
This will stop the error being recorded, in effect, it hides the error from the end user, it doesn't fix what I can only assume is a bug in phpDocumentor. So the original error still exists, it just hasn't been recorded.
One thing I did note while debugging, is the vsprintf() function produces an error for on the PPC:ERR-50000 error. The vsprintf() produces the error PHP Warning: vsprintf(): Too few arguments. If i find out how to fix the code to stop the false error (or fix the comments to ensure the error isn't given reason to log), I'll post it here.
For what it's worth, I've found that creating the documentation from the commandline using parameters rather than using parameters in :
phpdoc -d ./ -t ./docs --ignore=vendor/*
vs parameters in a phpdoc.dist.xml configuration file has resolved all of the issues raised in this thread.
I don't think this stops the need for two docblocks at the top of files but it does appear to resolve the "No summary was found for this file" error when building the documentation.
I got the same error because I use PHP > 7 and PHPDocumentor did not recognize the syntax, so this "default error" was provided.
In my code, PHPDocumentor isn't able to parse null returns (?) in functions.
I solved this issue going to this link
https://github.com/phpDocumentor/phpDocumentor/releases
I wgot the "PHP-7 Syntax support" and installed it
wget https://github.com/phpDocumentor/phpDocumentor/releases/download/v2.9.0/phpDocumentor.phar
sudo mv phpDocumentor.phar /usr/local/bin/phpdoc
sudo chmod +x /usr/local/bin/phpdoc
check version:
phpdoc --version
= phpDocumentor version v2.9.0
It works with this phpDocumentor version
I got the exact same error message. I got rid of it..
the solution is very simple. in the file block at the
top, the summary line has a period at the end of it. This indicates
its a summary line.
make sure that no other blocks that follow for attributes or methods or whatever have a summary line with a period at the end. Once I removed those, the error disappeared immediately (PHPDocumentor 2.8.5)
I came accross this issue when my site works with php v7.4 while phpDocumentor.phar is started with php v7.2.5 and there where strong typed properties in my class. Strong typed properties aren't allowed before php v7.4.0.
class Template
{
/**
* #var string The template with some replacement strings
*/
private string $template;
....
I have configured Propel to work with Laravel with the help of http://picqer.com/blog/propel-with-laravel. All model queries are working fine and all data is being fetched properly.
However, the toJSON and exportTo('JSON') methods are not working neither on the Objects or nor on the PropelObjectCollection returned by certain queries.
The exceptions thrown by Laravel are:
For exportTo('JSON') and toJSON() all caps method
Unknown parser class "PropelArrayParser"
For toJson() method:
Unknown parser class "PropelJsonParser"
I think the problem lies somewhere with autoload of Laravel. I am perhaps missing an entry that'd help it locate PropelJsonParser file.
P.S. I have no idea what effects 'php artisan dump-autoload' causes. But I did run it as per tutorial.
The build.properties file looks like:
propel.project = QuranApp
propel.database = mysql
propel.mysql.tableType = InnoDB
propel.database.url = mysql:host=localhost;dbname=quransociety
propel.database.user = user
propel.database.password = password
propel.disableIdentifierQuoting = false
propel.php.dir = ${propel.project.dir}/../../models
propel.output.dir = ${propel.project.dir}/../../database/propel
propel.phpconf.dir = ${propel.project.dir}/conf
propel.schema.dir = ${propel.project.dir}
I've added those two lines in laravel start.php (at the beginning):
set_include_path(dirname(__DIR__) . '/vendor/propel/propel1/runtime/lib/parser' . PATH_SEPARATOR . get_include_path());
require dirname(__DIR__) . '/vendor/propel/propel1/runtime/lib/parser/PropelJSONParser.php';
so basically I'm including them by hand, and this error is gone. There should be other way, that plays nice along with larvel autoload mechanism, but so far I didn't solve it differently