View ProjeQtOr On SourceForge.net
ProjeQtOr - Project Management Tool
Supportez nous sur Capterra
OIN - Open Invention Network
ProjeQtOr free project management software - Meaning of "// FOR PHP 7.1 COMPATIBILITY " in model/persistence/SqlElement.php - ProjeQtOr

Prochaines sessions de formation

Les prochaines formations et démonstrations sont ouvertes, inscrivez-vous rapidement !

 

Démonstration de ProjeQtOr

(gratuit, sur inscription)

Mardi 23 avril (10h30-12h)

Jeudi 16 mai (16h-17h30)

Jeudi 13 juin (10h30-12h)

 
 

Planifiez avec ProjeQtOr

3 et 4 avril (9h - 12h30)

 
 

Administrez avec ProjeQtOr

10 et 11 avril (9h - 12h30)

 

 

 
 

Meaning of "// FOR PHP 7.1 COMPATIBILITY " in model/persistence/SqlElement.php

More
27 Jui 2018 18:05 #1 by Glaurung4567
Hi,
I'm coding new functionnalities on Projeqtor as part of my traineeship. I created a new class with an attribute with a decimal type. I wish to keep the attribute to NULL when getting the objects from the db with getSqlElementsFromCriteria(...), but the function set my attribute from NULL to 0 on the line 2362.

I do not understand the condition nor the comment, could you explain it to me ? Here is the condition:



Thank you
Attachments:

Please Connexion or Create an account to join the conversation.

More
29 Jui 2018 09:15 - 29 Jui 2018 09:16 #2 by babynus
It wont be possible now to keep numeric value to zero.

It is due to major change on PHP 7.1.
Before PHP 7.1 : $a=1; $b=null; $c=$a+$b; // leads to $c=1
After PHP 7.1 : $a=1; $b=null; $c=$a+$b; // leads to error

So we had to manage numeric values to never be null, and replace them with 0 when read from db or from input.
(we could not get through the whole code to parse every sting used in arythmetic operation)
But I agree that it may be disapointing as Null value (no data entered) is not exactly the same as zero value (a zéro is amnually entered)

Babynus
Administrator of ProjeQtOr web site
Last edit: 29 Jui 2018 09:16 by babynus.
The following user(s) said Thank You: Glaurung4567

Please Connexion or Create an account to join the conversation.

More
29 Jui 2018 09:38 #3 by Glaurung4567
Well, i tested this case on a php sandbox and it didn't seem to present any problem.
Here the link: sandbox.onlinephpfunctions.com/code/a592...c2206f6dec8b902a8a40

Sadly i don't have a server with PHP 7.1 (i work with wamp) so i can't test it on Projeqtor.

Please Connexion or Create an account to join the conversation.

More
29 Jui 2018 10:01 #4 by babynus

Sadly i don't have a server with PHP 7.1 (i work with wamp) so i can't test it on Projeqtor.

You can easily have several versions of PHP on Wamp : wampserver.aviatechno.net/
(I have 5 on my dev one)
Try with ProjeQtOr V6.3.7 : you'll have the issues

Babynus
Administrator of ProjeQtOr web site

Please Connexion or Create an account to join the conversation.

More
29 Jui 2018 17:29 #5 by Glaurung4567
Well, i dug deeper into the problem and reproduced the error on PHP 7.1 (I commented the lines to set the attribute to 0 when it's null in SqlElement.php).

But the cause isn't exactly the one you mentionned. It's the addition of a string of a float and an empty string which cause the warning (sandbox.onlinephpfunctions.com/code/47ca...ff53533bc050b57059bc). Here the test I made on Projeqtor :


A possible solution might be to replace the first test of the condition ("if ($this->{$col_name}===null...") by " if ($this->{$col_name}===''"...".
Attachments:

Please Connexion or Create an account to join the conversation.

More
03 Juil 2018 16:09 #6 by babynus
We'll have a try on V7.2 (under development)
But I'm afraid issues will occur.
if ($this->{$col_name}==='' 
and ( ( $dbType=='numeric') or ( $dbType=='decimal') )
cannot be true (db cannot store empty string in a numeric column)

Babynus
Administrator of ProjeQtOr web site

Please Connexion or Create an account to join the conversation.

Moderators: babynusprotion
Time to create page: 0.067 seconds

Paramétrages de cookies

×

Cookies fonctionnels

Ce site utilise des cookies pour assurer son bon fonctionnement et ne peuvent pas être désactivés de nos systèmes. Nous ne les utilisons pas à des fins publicitaires. Si ces cookies sont bloqués, certaines parties du site ne pourront pas fonctionner.

Session

Veuillez vous connecter pour voir vos activités!

Autres cookies

Ce site web utilise un certain nombre de cookies pour gérer, par exemple, les sessions utilisateurs.