Posts by gmsantos • 17,221 points
395 posts
-
0
votes1
answer44
viewsA: How to copy files from a Docker container to your local desktop
By error, it seems that you are already in the Desktop directory (by the error path C:\\Users\\my_user\\desktop\\~\\desktop). Just one point would be enough: docker cp container_id:app.txt .…
-
5
votes1
answer49
viewsA: PDO does not return error even in a Try catch block
Change the error mode from its PDO class to PDO::ERRMODE_EXCEPTION: $pdo = new PDO( "mysql:host=127.0.0.1; dbname=projetocadastro;", "root", "123456", [PDO::ATTR_ERRMODE =>…
-
1
votes1
answer61
views -
4
votes1
answer49
viewsA: As I change + by %2B
You can do this with urlencode() <a href="profile?pr=<?=urlencode($oturum_kadi);?>" class="element-menu-principal"> Upshot: <?php echo urlencode('+Biel'); // %2BBiel…
-
0
votes1
answer30
viewsA: Undefined Property: Dateperiod::$format
Error says it is not possible to use the method format. You are using the object the wrong way. Check in the documentation of DatePeriod the available methods: DatePeriod implements Traversable { /*…
-
1
votes1
answer61
viewsA: Build with Maven does not find lib in Artifacts
For the error message, Maven is not finding the Maven Central packages. For this to work you need to set up Maven Central as upstream from your Artifacts feed. You can check this settings in your…
-
4
votes2
answers173
viewsA: Can I use the dd() function in production?
It is normal the controller does not terminate the execution, as it itself returns nothing. The controller executes verificaItens but does nothing with the Response maid. Isolate in the context of…
-
2
votes2
answers376
viewsA: How to rename a remote and same local branch from the remote?
The name of a branch in git is only a reference, what really counts is the sequence line between the commits along with their hashes. So, all you have to do is create a new branch under the new…
-
0
votes3
answers43
viewsA: How to Cast Another Class in PHP
It is not possible to initialize a property with an object directly in the class property statement, but you can do this in the constructor. Recommended is the constructor of your class requiring…
-
2
votes2
answers42
viewsA: Retrieve specific information in string
This string seems to me to be a clipping of an XML, but it is badly formed (missing some parts). You can read this string with the Simplexml: <?php $xml = <<<'XML' <root…
-
4
votes2
answers803
viewsA: SOAP request showing error
A very common error I see, at least in PHP, are developers trying to use SOAP with Curl or Guzzle and mounting XML in hand. PHP has a native SOAP client that eliminates all this work. Just enable or…
-
6
votes2
answers1354
viewsA: What are the differences between an image and a container?
A good analogy for understanding images and containers is that of the comment. The class would be the image, where you create the definition and behaviors that a particular container will have, and…
-
0
votes2
answers35
viewsA: Why is the return 115?
The printf already prints an output on the screen, right after the echo writes the return of printf, which is the size of the printed string. Use without the echo which will have the expected…
-
2
votes1
answer446
viewsA: Error: Constant Expression contains invalid Operations
I didn’t dig deep, but I believe that at the moment of class definition the super global $_SESSION is not yet available. You can set this value at the time of class instantiation: <?php…
-
0
votes1
answer100
viewsA: Error when adding foreign key in SQL table
I believe that the column was missing in the creation of the table Situation or else your database does not support the syntax you are trying to use. You can do this in Mysql: create table situacao…
-
1
votes1
answer132
viewsA: Failure to establish connection between two Docker containers
When you go up containers on Docker, they work as isolated servers, so it won’t be possible even for you to use localhost or any other variation from one container to another. Imagine that you are…
-
2
votes1
answer1766
viewsA: Optional parameters on the Laravel Route
Just place a question mark at the end of the parameter to make it optional: Route::get('/cursos/{id_categoria_curso?}/{id_atuacao_area?}', 'SiteController@cursosFiltro')->name('cursos'); Still,…
-
2
votes2
answers1943
viewsA: Problems accessing the application from the browser
Testing here the problem seems to me to be like the php artisan serve. It failed to properly expose the network to windows properly. To correct that, I passed the argument --host 0.0.0.0 for the…
-
1
votes2
answers562
viewsA: Is it possible to develop apps on Docker without Hyper-v?
In addition to the processor features and the architecture of your OS, you need to know which Docker editions are available. Your system version will also influence. Docker Desktop: It is the…
-
2
votes1
answer319
viewsA: How to make a git clone without the . git repository?
You can’t do that with the clone, but it’s possible with the archive or checkout-index: git archive master | tar -x -C /somewhere/else The git archive will create a package with committed code on…
-
1
votes2
answers546
viewsA: PHP adding and subtracting wrong
The problem itself is the operation with floating point numbers. They are not an exact value, but an approximation. This also occurs in any language, not only in PHP. For example in Javascritpt: a =…
-
0
votes1
answer249
viewsA: Problem with PSR-4 and Poser autoload
The first part of his namespace needs to be the same as defined in Composer.json. Starting from this first part, PSR-4 follows its directory structure. Beware of upper and lower case letters, this…
-
0
votes1
answer86
viewsA: PHP 5 deprecated functions for migrating to PHP 7, function @
The operator @ is used to suppress error messages. It may even be that the code that depends on this method is already wrong in time, even in PHP 5. In that case I would remove the @ to ensure that…
-
0
votes1
answer111
viewsA: Problem updating
Only using the relative path to your extensions directory is enough: extension_dir = "ext" If you want to use the absolute path, remember that Windows uses backslash to separate directories:…
-
2
votes2
answers426
viewsA: Interpretation of Tags with HTML
Both syntaxes, as you mentioned are used to display the contents of the strings within your page, the first escaping special characters to avoid XSS attacksen and the second syntax allowing this. I…
-
2
votes2
answers2564
viewsA: Doubt about marking "volumes" inside the Docker-Compose.yml
The db_data is a reference to a volume defined within your docker-compose.yml. Within the service db it is indicating that you should save the data to an internal volume managed by Docker (and not…
-
3
votes1
answer164
viewsA: About the behavior of userland functions and internal functions in PHP
This proposal has already been approved and implemented and will come in PHP 8, according to this rfc. With it, invalid arguments passed for internal functions will always result in a TypeError…
-
2
votes2
answers343
viewsA: Doubt about autoload using Poser
Actually Laravel and any other PHP framework does this require without you noticing. They use a concept called Front Controller, where the way PHP works, all your requests go through a single file,…
-
2
votes1
answer55
viewsA: How to filter the input of a form to the Database?
In PHP there are already native functions that work best to filter data entries. The functions filter_* allow a series of validations and sanitizers where it is possible to do virtually everything.…
-
2
votes1
answer45
viewsA: Server Confusion Problem for Windows
You have to configure your server to consider the folder public as the root of the web server. It is necessary to enable the mod_rewrite in Apache as well. Search the Hostgator panel for the option…
-
3
votes1
answer69
viewsA: Parameters for encrypted columns
For some reason when you have encrypted columns, when using them inside a Procedure the type and size of the variable must be equal to that defined in the table. In this case change the parameters…
-
1
votes1
answer223
viewsA: .htaccess and rewrite rules in PHP server
I don’t know if . htaccess works or is working on this server. The internal php server will not consider . htaccess Can someone at least give me some idea of what I should try to solve? Regardless…
-
4
votes4
answers1185
viewsA: Change only the day of registration
whereas DATAINCLUSAO is the type datetime you can try the following UPDATE: UPDATE tabela SET datainclusao = CONVERT( datetime, FORMAT(datainclusao, 'yyyy-MM-01 H:mm:ss') ); In function FORMAT I am…
-
5
votes3
answers62
viewsA: Error while connecting to php server
Lacked a function prior to the definition of the method get. Without it he confuses the static with a property and waits for a variable. Follow a simplified working version: <?php class…
-
5
votes1
answer39
viewsA: PHP SDK Moip: What tag to use for Banks when in Online Debit?
What version of the SDK are you using? It seems to me that v2 only has the support for bank transfer with Banco Itaú, according to support page theirs: Accepted payment methods for E-commerce and…
-
2
votes1
answer155
viewsA: Mode of echo echo type
The Laravel Valley transforms {{ }} in a function internal call e(), that comes from escape. The code of that function e() is as follows: function e($value, $doubleEncode = true) { if ($value…
-
5
votes2
answers97
viewsA: How to convert a value (which appears to be octal) to literal string in PHP (5.6)?
The problem is using the 0 when declaring the month. From your web server you will already receive the value in string, then only in the cases that you put directly into the code will have problems.…
-
2
votes1
answer66
viewsA: Error using Fuelphp in version 7
You are using a version of Fuelphp that does not support PHP 7. Upgrade to version 1.8 by renaming the class \Fuel\Error for \Fuel\Errorhandler. More details you can find in the changelog fuelphp.…
-
1
votes1
answer531
viewsA: Autoload of Poser is not working
The problem is that Windows file system is case incentive and in Ubuntu is case sentitive. What does that mean? On Windows use Sistema\Sistema works with all uppercase files as in lowercase…
-
1
votes1
answer132
viewsA: how to concatenate array index with your previous one?
There is no way. What you can do is set the properties directly: <?php class Site { private $site = [ 'domain' => 'site.com.br', 'www' => 'www.site.com.br' ]; }…
-
1
votes2
answers851
viewsA: Sharing variables between functions in the controller
The function compact only works with local scope variables. To reuse these variables you need to pass them to the new method. public function routeEndpoint() { // .. return…
-
5
votes2
answers38
viewsA: Generate a string that contains only the numbers of another string in php
As pointed out in the comment the syntax error is at the point position. The correct use of this allocation operator is .= function extraiSoNumsDeString($string){ $result=""; for($i=0;…
-
4
votes3
answers58
viewsA: How to concatenate a variable in the middle of another variable?
You can get to something similar using variable variables in PHP. $name = 'clientes'; $lista_var = "default_{$name}_list"; $$lista_var = "Lista de clientes"; echo $default_clientes_list; Behold…
-
9
votes2
answers1712
viewsA: What is the difference between the prefer-dist and prefer-source options in Composer?
I would like to know what each one does and/or if there is a difference between both. These options refer to how Composer will download and manage dependencies within your vendor directory.…
commiserateanswered gmsantos 17,221 -
2
votes1
answer95
viewsA: How to protect my account from unauthorized`pushs`?
How you block access to your repository depends on how you clone the repository. On Github when you clone from https, whenever you interact with the remote repository you will be prompted for your…
-
1
votes1
answer58
viewsA: Does it make any difference to use .class.php?
Talking about conventions, like PSR4, one should not put the .class.php because it will influence the autoload road-class namespace. Other than that, it doesn’t change anything. Actually, it doesn’t…
-
4
votes1
answer553
viewsA: How to configure Autoload Composer?
The specification of autoload of PSR-4 describes how the class should be loaded within your project. In Composer when defining the json we have these two parts: { "Namespace\\Base\\" :…
-
3
votes2
answers970
viewsA: How to resolve conflict between Vue.js and Laravel 5.4 no. Blade
As Lade already uses {{ }} to display the contents of the variables, use @ to escape the keys and so use Vue in your view with Blade: <div id="app"> @{{ message }} </div>…
-
1
votes1
answer13
viewsA: What approach should be used in Resource type controllers to list and search for items?
One approach that can be used is to accept query strings to filter in the index. public function index(Request $request) { $query = $request->query('campo1', 'campo2'); // Ou todos os campos.. é…
-
1
votes1
answer130
viewsA: Error using Middleware on Laravel/Lumen
It seems to me that these middleware listed existed only in version 5.0 of bootstrap/app.php and were removed in later versions. In Lumen 5.6 this section of middleware is that way: /*…