Does Doctrine/DBAL is compatible with PHP5.6? - doctrine

Doctrine ORM seems to need PHP5.3 and next one's.
There is no information about Doctrine DBAL I want to use. I think the ORM is based on DBAL, so it should be PHP5.3+, but is there any breakdown to make it work with last PHP release (5.6).

You have two options:
Use Doctrine ORM 2.5 codebase (currently master branch, not yet stable).
Apply this patch to ClassMetadataInfo class:
--- ClassMetadataInfo.php 2014-07-07 08:46:51.658104373 -0400
+++ ClassMetadataInfo.patch.php 2014-07-07 08:38:05.442127032 -0400
## -827,7 +827,7 ##
public function newInstance()
{
if ($this->_prototype === null) {
- if (PHP_VERSION_ID === 50429 || PHP_VERSION_ID === 50513) {
+ if (PHP_VERSION_ID === 50429 || PHP_VERSION_ID === 50513 || PHP_VERSION_ID === 50600) {
$this->_prototype = $this->reflClass->newInstanceWithoutConstructor();
} else {
$this->_prototype = unserialize(sprintf('O:%d:"%s":0:{}', strlen($this->name), $this->name));
Source: http://www.snip2code.com/Snippet/87237/Doctrine--2-3-6-on-PHP----5-6-%28vendor-do/

Related

Remove particular type of error from Datadog

Currently, I see error status for all the authentication errors and it feels like a lot of extra noise in the total errors chart. I looked at https://github.com/DataDog/dd-trace-js/pull/909 and tried to use the custom execute provided for graphql
import ddTrace from 'dd-trace'
let tracer = ddTrace.init({
debug: false
}) // initialized in a different file to avoid hoisting.
tracer.use('graphql', {
hooks: {
execute: (span, args, res) => {
if (res && res.errors && res.errors[0] && res.errors[0].status !== 403) {
span?.setTag('error', res.errors)
}
}
}
})
export default tracer
But still, res with only 403 error is going into error status. Please help me with how can I achieve this.
Update: I found this bit of code in the tracing client repo:
tracer.use('graphql', {
hooks: {
execute: (span, args, res) => {
if (res?.errors?.[0]?.status === 403) { // assuming "status" is a number
span?.setTag('error', null) // remove any error set by the tracer
}
}
}
})
https://github.com/DataDog/dd-trace-js/issues/1249
maybe it would help
Old message:
Never mind. seems like my solution is only for express, graphql doesn't support that property
You probably want to just modify the validateStatus property in the http module:
Callback function to determine if there was an error. It should take a status code as its only parameter and return true for success or false for errors
https://datadoghq.dev/dd-trace-js/interfaces/plugins.http.html#validatestatus
As an example you should be able to mark 403s as not be errors with something like this:
const tracer = require('dd-trace').init();
tracer.use('express', {
validateStatus: code => code < 400 && code != 403
})

Problem with install security patch in magento 2.2.7

I want to install a patch to my project
Patch like this:
Index: vendor/magento/framework/DB/Adapter/Pdo/Mysql.php
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- vendor/magento/framework/DB/Adapter/Pdo/Mysql.php (revision 6a8701ca9402697f5eaf022e35b9217d3281546c)
+++ vendor/magento/framework/DB/Adapter/Pdo/Mysql.php (date 1553502112000)
## -2904,7 +2904,7 ##
if (isset($condition['to'])) {
$query .= empty($query) ? '' : ' AND ';
$to = $this->_prepareSqlDateCondition($condition, 'to');
- $query = $this->_prepareQuotedSqlCondition($query . $conditionKeyMap['to'], $to, $fieldName);
+ $query = $query . $this->_prepareQuotedSqlCondition($conditionKeyMap['to'], $to, $fieldName);
}
} elseif (array_key_exists($key, $conditionKeyMap)) {
$value = $condition[$key];
I also added to the composer:
"extra": {
"magento-force": "override",
"patches": {
"magento/framework": {
"Fix: PRODSECBUG-2198":
"patches/composer/magento/framework/PRODSECBUG2198.patch"
}
}
}
When I try to run composer install then return this error:
Could not apply patch! Skipping. The error was: Cannot apply patch patches/composer/magento/framework/PRODSECBUG2198.patch
Project for Magento 2.2.7, I installed cweagans/composer-patches but still have problem. Someone can help?
I don't have too much experience with the patches package, but in one of our project, we use it too. In the patch file, the location to the files to be patched is given relative to the package root. So, if you want to patch something in magento/framework, your patch file should probably use DB/Adapter/Pdo/Mysql.php as the filenames

PerformanceObserver throwing error in Firefox, working in Chrome

I am implementing PerformanceObserver to track 'first-paint' & 'first-contentful-paint'.
const observer = new PerformanceObserver((list) => {
for (const entry of list.getEntries()) {
if (typeof(Storage) !== 'undefined') {
if (entry.name === 'first-paint') {
localStorage.setItem(rumMetrics.RUM_METRICS_FIRST_PAINT, entry.startTime);
}
else if (entry.name === 'first-contentful-paint') {
localStorage.setItem(rumMetrics.RUM_METRICS_FIRST_CONTENTFUL_PAINT, entry.startTime);
}
}
else {
console.log('local storage is not supported here. RUM metrics won\'t be recorded.');
}
}
});
observer.observe({ entryTypes: ['paint'] });
This works perfectly in Chrome but throws an error in Firefox.
TypeError: The expression cannot be converted to return the specified type. (line: observer.observe({ entryTypes: ['paint'] });)
Update-1: 20th Apr 2018
Mozilla has confirmed the bug and it is affecting FF61 Nightly as well
Original Answer
Confirmed that this is a bug even in the developer version.
Below is the bug for the same
https://bugzilla.mozilla.org/show_bug.cgi?id=1454581

Puppet Install specific version of package depending on application version

I have a module which installs my Application.
To install system packages i'm using virtual resource:
#package {[
'unzip',
'wget',
'htop',
'xorg-x11-server-Xvfb']:
ensure => installed,
}
define myapp1_packages {
realize(
Package['unzip'],
Package['fontconfig'],
Package['libfreetype.so.6'])
}
#myapp1_packages{ 'myapp1_packages': }
Then I use realize in my manifest to install the above packages:
realize(myapp1_packages['myapp1_packages'])
But for each version of my application I also need appropriate versions of system packages.
I need something like that:
if $app_version == '1.0' {
"install unzip-1xx"
"install fontconfig-1-xx"
"install libfreetype.so.6-1-x-xx"
elseif $app_version == '2.0'
"install unzip-2xx"
"install fontconfig-2-xx"
"install libfreetype.so.6-2-x-xx"
What is most elegant way to do this? And is it possible to keep virtual resources in that case? I'm looking to use ensure_packages but i worried about resource duplication. Thanks for the help!
The best thing to do here is to make $app_version a parameter for your module: https://docs.puppet.com/puppet/4.10/lang_classes.html#class-parameters-and-variables. Note an example from the documentation here: https://docs.puppet.com/puppet/4.10/lang_classes.html#appendix-smart-parameter-defaults.
For your situation, the class would look like:
myclass($app_version = 'default version') {
if $app_version == '1.0' {
#package { 'unzip': ensure => '1xx' }
#package { 'fontconfig': ensure => '1-xx' }
#package { 'libfreetype': ensure => '6-1-xx' }
}
elsif $app_version == '2.0' {
#package { 'unzip': ensure => '2xx' }
#package { 'fontconfig': ensure => '2-xx' }
#package { 'libfreetype': ensure => '6-2-xx' }
}
}
thus also allowing you to retain your virtual resources.
You can then pass parameters to this class by declaring it like:
class { 'myclass': app_version => '2.0' }
or using automatic data bindings with hieradata:
# puppet manifest
include myclass
# hieradata
myclass::app_version: 2.0
Your collector elsewhere will then realize the correct versions for your packages.

JSCover with PhantomJS - TypeError: 'null' is not an object

When I try to run JSCover with PhantomJS, I see below ERROR:
Steps followed:
1) Run the JSCover Server:
java -jar ~/JSCover/target/dist/JSCover-all.jar -ws --report-dir=report
2) Run the PhantomJS runner with JSCover:
*phantomjs --debug=true ~/JSCover/src/test/javascript/lib/PhantomJS/run-jscover-jasmine.js
localhost8080/<app>/module/framework/test/SpecRunner.html
TypeError: 'null' is not an object(evaluating''document.body.querySelector('.description').innerText')`
phantomjs://webpage.evaluate():3
phantomjs://webpage.evaluate():22
phantomjs://webpage.evaluate():22
2013-09-19T16:36:07 [DEBUG] WebPage - evaluateJavaScript result QVariant(, )
2013-09-19T16:36:07 [DEBUG] WebPage - evaluateJavaScript "(function() { return (function () {
jscoverage_report('phantom');
})(); })()"
2013-09-19T16:36:07 [DEBUG] WebPage - evaluateJavaScript result QVariant(, )
2013-09-19T16:36:07 [DEBUG] Network - Resource request error: 5 ( "Operation canceled" ) URL: localhost8080/<app_home>/lib/backbone/1.0.0/backbone.js?cb=0.5381254460662603
This was an issue that I ran into yesterday. It turns out that the example script does not work for newer versions, so I built a new Phantom Script that works for Jasmine 2.X which fixes it. You can locate the working script here in my repository:
https://github.com/tkaplan/PhantomJS-Jasmine
I faced with the same issue when I try running Jasmine with PhantomJS.
I realized that the latest version of Jasmine-html.js (jasmine-2.0.0-rc2)
does not go along with PhantomJS's run-jasmine.js (phantomjs-1.9.2-windows).
In the jasmine-2.0.0-rc2 version of Jasmine-html.js,
The '.description' class is not available if all tests passed.
This 'description' class is created only if any test failed.
Thus, when I run the phantomjs with all tests passed, I get the above error message.
I modified run-jasmine.js to adapt to Jasmine-html.js (jasmine-2.0.0-rc2) to
resolve this issue.
Are you loading your tests asynchronously? I use requirejs for modular javascript. It is also used to load the test specs:
<script data-main='SpecRunner' src='/test/scripts/libs/require.js'></script>
When using JSCover, the run-jscover-jasmine.js script does not account for this async behaviour, so the DOM nodes referenced in the query do not exist (yet). I modified the script to delay the waitFor call by 1 second:
page.open(system.args[1], function(status){
if (status !== "success") {
console.log("Unable to access network");
phantom.exit();
} else {
// Added 1s delay here
window.setTimeout(function() {
waitFor(function(){
return page.evaluate(function(){
return document.body.querySelector('.symbolSummary .pending') === null
});
}, function(){
var exitCode = page.evaluate(function(){
console.log('');
console.log(document.body.querySelector('.description').innerText);
var list = document.body.querySelectorAll('.results > #details > .specDetail.failed');
if (list && list.length > 0) {
console.log('');
console.log(list.length + ' test(s) FAILED:');
for (i = 0; i < list.length; ++i) {
var el = list[i],
desc = el.querySelector('.description'),
msg = el.querySelector('.resultMessage.fail');
console.log('');
console.log(desc.innerText);
console.log(msg.innerText);
console.log('');
}
return 1;
} else {
console.log(document.body.querySelector('.alert > .passingAlert.bar').innerText);
return 0;
}
});
page.evaluate(function(){
jscoverage_report('phantom');
});
phantom.exit(exitCode);
});
}, 1000);
}
});
Depending on the amount of code loaded, you may have to increase the delay.

Resources