Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[2.4.*] Fix MakeViewVariableOptionalSolution to disallow stream wrappers and files that do not end in .blade.php #361

Closed
wants to merge 58 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
225d93b
Run tests on PHP 8, Laravel 8
Synchro Sep 9, 2020
f8968e2
Dummy commit to trigger actions
Synchro Sep 9, 2020
115a886
Dummy commit to trigger actions
Synchro Sep 9, 2020
d908b38
Drop PHP 7.2 from test action
Synchro Sep 9, 2020
18896d6
Only test on PHP 7.4 and 8
Synchro Sep 9, 2020
0890571
Drop prefer-lowest for now
Synchro Sep 9, 2020
03e61dd
Merge branch 'master' of https://github.com/facade/ignition into master
Synchro Oct 14, 2020
7b34c40
fix typo
freekmurze Oct 14, 2020
b12ddf9
Update deps for PHP 8.0 compat for facade/flare-client-php and facade…
Synchro Oct 21, 2020
122a5fc
Config tweaks
Synchro Oct 21, 2020
508936f
Use composer 2
Synchro Oct 21, 2020
8f58387
Fix yaml
Synchro Oct 21, 2020
fa10ffa
The highlight package is no longer needed.
selcukcukur Oct 26, 2020
4435969
Fix tests
AlexVanderbist Oct 27, 2020
5c9a755
Merge pull request #324 from selcukcukur/patch-1
AlexVanderbist Oct 27, 2020
d897b9e
Update CHANGELOG.md
AlexVanderbist Oct 27, 2020
b548297
Merge pull request #327 from facade/AlexVanderbist-patch-1
AlexVanderbist Oct 27, 2020
81698c5
Merge pull request #326 from facade/Synchro-master
AlexVanderbist Oct 27, 2020
0684646
Fix typo in comment (#328)
manavo Oct 28, 2020
482384a
Fix grammar & spelling in solution card component (#332)
unlikenesses Nov 11, 2020
3b3403f
add support for LiveWire component urls
rubenvanassche Nov 13, 2020
03a8aa1
Fix MakeViewVariableOptionalSolution to disallow stream wrappers and …
cfreal Nov 17, 2020
acfb01b
Fix styling
freekmurze Nov 17, 2020
0866803
Update CHANGELOG.md
freekmurze Nov 17, 2020
84053f6
Bump highlight.js from 9.15.10 to 10.4.1 (#341)
dependabot[bot] Dec 4, 2020
9b410f8
Use Livewire compatible compiler engine when using Livewire (#340)
austenc Dec 9, 2020
d8dc4f9
Update CHANGELOG.md
freekmurze Dec 9, 2020
77c13a2
Added support for Nova text editor (#343)
ngurney Dec 28, 2020
7034600
Update CHANGELOG.md
freekmurze Dec 28, 2020
0b4e4fe
update ignition js
freekmurze Dec 28, 2020
2b6fd8b
wip
freekmurze Dec 28, 2020
a5e9a02
wip
freekmurze Dec 29, 2020
3cc4da4
wip
freekmurze Dec 29, 2020
772aaf1
wip
freekmurze Dec 29, 2020
0267c4a
fix for breaking change in highlightjs
AdrianMrn Dec 29, 2020
4d659cb
changelog & prettier
AdrianMrn Dec 29, 2020
6accf62
Bump ini from 1.3.5 to 1.3.7 (#342)
dependabot[bot] Dec 29, 2020
565c9b4
Fix double `$` on PHP 8 (#338)
remzikocak Dec 29, 2020
8e907d8
Update CHANGELOG.md
freekmurze Dec 29, 2020
66b3138
fix logged context not being sent to Flare
rubenvanassche Jan 26, 2021
8bbc0a3
fix tinker logs not being sent to Flare
rubenvanassche Feb 2, 2021
98154e8
Fix styling
rubenvanassche Feb 2, 2021
a167be5
facade/ignition#302: Fix memory leaks caused by log and query recorder
TheLevti Jan 17, 2021
a92dcbe
Merge pull request #344 from TheLevti/feature/fix-mem-leaks
rubenvanassche Feb 5, 2021
e91d673
Update CHANGELOG.md
rubenvanassche Feb 5, 2021
f9463e7
facade/ignition#344: Fix wrong config usage
TheLevti Feb 14, 2021
1864eef
Merge pull request #354 from TheLevti/feature/fix-config-copy-paste-bug
rubenvanassche Feb 15, 2021
be73521
Update CHANGELOG.md
rubenvanassche Feb 15, 2021
fa131f3
Remove custom grouping
rubenvanassche Feb 15, 2021
5e9ef38
Update changelog
rubenvanassche Feb 16, 2021
11ffca1
Fix MakeViewVariableOptionalSolution to disallow stream wrappers and …
anasmirza534 Feb 18, 2021
e957d06
fix ignition not working when there is no argv
rubenvanassche Mar 4, 2021
17097f7
Update changelog
rubenvanassche Mar 4, 2021
1f1f688
Merge branch 'master' into 2.4.1-branch
AlexVanderbist Mar 8, 2021
879fe28
fixed passing null value to function that expecting string
anasmirza534 Mar 9, 2021
2e2738f
merge conflict
anasmirza534 Mar 9, 2021
eeac30d
facade/ignition-contracts 1.0.2 required php ^7.3
anasmirza534 Mar 9, 2021
29c9bbe
refactor code and added test handling null value as path and variable
anasmirza534 Mar 19, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
20 changes: 14 additions & 6 deletions .github/workflows/run-tests.yml
Expand Up @@ -12,13 +12,15 @@ jobs:

strategy:
matrix:
php: [7.4, 7.3, 7.2]
laravel: [7.*]
dependency-version: [prefer-lowest, prefer-stable]
php: [7.4, 8.0]
laravel: [7.*, 8.*]
dependency-version: [prefer-stable]
os: [ubuntu-latest, windows-latest]
include:
- laravel: 7.*
testbench: 5.*
- laravel: 8.*
testbench: 6.*

name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.dependency-version }} - ${{ matrix.os }}

Expand All @@ -32,11 +34,17 @@ jobs:
php-version: ${{ matrix.php }}
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick
coverage: none
tools: composer:v2

- name: Install dependencies
- name: Install PHP 7 dependencies
run: |
composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" --no-interaction --no-update
composer update --${{ matrix.dependency-version }} --prefer-dist --no-interaction --no-suggest
composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" --no-interaction --no-update
composer update --${{ matrix.dependency-version }} --no-interaction --no-progress
if: "matrix.php < 8"

- name: Install PHP 8 dependencies
run: composer update --${{ matrix.dependency-version }} --ignore-platform-req=php --no-interaction --no-progress
if: "matrix.php >= 8"

- name: Execute tests
run: vendor/bin/phpunit
Expand Down
63 changes: 62 additions & 1 deletion CHANGELOG.md
Expand Up @@ -2,6 +2,67 @@

All notable changes to `ignition` will be documented in this file

## 2.5.14 - 2021-03-03

- fix ignition not working when there is no argv

## 2.5.13 - 2021-02-16

- remove custom grouping

## 2.5.12 - 2021-02-15

- fix wrong config usage (#354)

## 2.5.11 - 2021-02-05

- fix memory leaks caused by log and query recorder (#344)

## 2.5.10 - 2021-02-02

- fix tinker logs not being sent to Flare

## 2.5.9 - 2021-01-26

- fix logged context not being sent to Flare

## 2.5.8 - 2020-12-29

- fix double `$` on PHP 8 (#338)

## 2.5.7 - 2020-12-29

- fix for breaking change in highlight.js (fixes 2.5.5)

## 2.5.6 - 2020-12-29

- revert to compiled js of 2.5.3

## 2.5.5 - 2020-12-29

- added compiled js of previous release

## 2.5.4 - 2020-12-29

- added support for Nova text editor (#343)

## 2.5.3 - 2020-12-08

- Use Livewire compatible compiler engine when using Livewire (#340)

## 2.5.2 - 2020-11-14

- fix `MakeViewVariableOptionalSolution` to disallow stream wrappers and files that do not end in ".blade.php" (#334)

## 2.5.1 - 2020-11-13

- add support for LiveWire component urls

## 2.5.0 - 2020-10-27

- add PHP 8.0-dev support
- remove unnecessary `scrivo/highlight.php` dependency

## 2.4.1 - 2020-10-14

- fix copy casing
Expand All @@ -17,7 +78,7 @@ All notable changes to `ignition` will be documented in this file
## 2.3.7 - 2020-09-06

- add loading state on share button (#309)
- compatiblity fix for L8
- compatibility fix for L8

## 2.3.6 - 2020-08-10

Expand Down
7 changes: 3 additions & 4 deletions composer.json
Expand Up @@ -10,15 +10,14 @@
"homepage": "https://github.com/facade/ignition",
"license": "MIT",
"require": {
"php": "^7.2.5",
"php": "^7.2.5|^8.0",
"ext-json": "*",
"ext-mbstring": "*",
"facade/flare-client-php": "^1.0",
"facade/ignition-contracts": "^1.0",
"facade/flare-client-php": "^1.3.7",
"facade/ignition-contracts": "^1.0.1",
"filp/whoops": "^2.4",
"illuminate/support": "^7.0|^8.0",
"monolog/monolog": "^2.0",
"scrivo/highlight.php": "^9.15",
"symfony/console": "^5.0",
"symfony/var-dumper": "^5.0"
},
Expand Down
2 changes: 2 additions & 0 deletions config/flare.php
Expand Up @@ -32,6 +32,8 @@
'report_query_bindings' => true,
'report_view_data' => true,
'grouping_type' => null,
'report_logs' => true,
'maximum_number_of_collected_logs' => 200,
],

/*
Expand Down
2 changes: 1 addition & 1 deletion config/ignition.php
Expand Up @@ -10,7 +10,7 @@
| Choose your preferred editor to use when clicking any edit button.
|
| Supported: "phpstorm", "vscode", "vscode-insiders",
| "sublime", "atom"
| "sublime", "atom", "nova"
|
*/

Expand Down
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -7,7 +7,7 @@
},
"dependencies": {
"git-url-parse": "^11.1.2",
"highlight.js": "^9.15.6",
"highlight.js": "^10.4.1",
"lodash": "^4.17.19",
"markdown-it": "^9.0.1",
"md5": "^2.2.1",
Expand Down
8 changes: 4 additions & 4 deletions resources/compiled/ignition.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions resources/js/components/Shared/editorUrl.js
Expand Up @@ -10,6 +10,7 @@ export default function editorUrl(config, file, lineNumber) {
vscode: 'vscode://file/%path:%line',
'vscode-insiders': 'vscode-insiders://file/%path:%line',
atom: 'atom://core/open/file?filename=%path&line=%line',
nova: 'nova://core/open/file?filename=%path&line=%line',
};

file =
Expand Down
4 changes: 2 additions & 2 deletions resources/js/components/Solutions/SolutionCard.vue
Expand Up @@ -73,15 +73,15 @@
</button>
<p v-if="executionSuccessful">
<strong class="font-semibold"
>The solution was executed succesfully.</strong
>The solution was executed successfully.</strong
>
<a href="#" @click.prevent="refresh" class="link-solution"
>Refresh now.</a
>
</p>
<p v-if="executionSuccessful === false">
Something went wrong when executing the solution. Please try
refresh the page and try again.
refreshing the page and try again.
</p>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion resources/js/components/Stack/Snippet.vue
Expand Up @@ -50,7 +50,7 @@
</template>

<script>
import hljs from 'highlight.js/lib/highlight';
import hljs from 'highlight.js/lib/core';
hljs.registerLanguage('php', require('highlight.js/lib/languages/php'));

import ExceptionClass from '../Shared/ExceptionClass.vue';
Expand Down
12 changes: 12 additions & 0 deletions src/Context/LaravelRequestContext.php
Expand Up @@ -54,6 +54,18 @@ public function getRoute(): array
];
}

public function getRequest(): array
{
$properties = parent::getRequest();


if ($this->request->hasHeader('x-livewire') && $this->request->hasHeader('referer')) {
$properties['url'] = $this->request->header('referer');
}

return $properties;
}

protected function getRouteParameters(): array
{
try {
Expand Down
90 changes: 59 additions & 31 deletions src/IgnitionServiceProvider.php
Expand Up @@ -3,6 +3,7 @@
namespace Facade\Ignition;

use Exception;
use Facade\FlareClient\Api;
use Facade\FlareClient\Flare;
use Facade\FlareClient\Http\Client;
use Facade\Ignition\Commands\SolutionMakeCommand;
Expand All @@ -28,7 +29,6 @@
use Facade\Ignition\Middleware\AddLogs;
use Facade\Ignition\Middleware\AddQueries;
use Facade\Ignition\Middleware\AddSolutions;
use Facade\Ignition\Middleware\CustomizeGrouping;
use Facade\Ignition\Middleware\SetNotifierName;
use Facade\Ignition\QueryRecorder\QueryRecorder;
use Facade\Ignition\SolutionProviders\BadMethodCallSolutionProvider;
Expand Down Expand Up @@ -78,6 +78,10 @@ public function boot()
$this->publishes([
__DIR__.'/../config/ignition.php' => config_path('ignition.php'),
], 'ignition-config');

if (isset($_SERVER['argv']) && ['artisan', 'tinker'] === $_SERVER['argv']) {
Api::sendReportsInBatches(false);
}
}

$this
Expand All @@ -90,8 +94,14 @@ public function boot()
$this->setupQueue($this->app->get('queue'));
}

$this->app->make(QueryRecorder::class)->register();
$this->app->make(LogRecorder::class)->register();
if (config('flare.reporting.report_logs')) {
$this->app->make(LogRecorder::class)->register();
}

if (config('flare.reporting.report_queries')) {
$this->app->make(QueryRecorder::class)->register();
}

$this->app->make(DumpRecorder::class)->register();
}

Expand All @@ -106,9 +116,12 @@ public function register()
->registerWhoopsHandler()
->registerIgnitionConfig()
->registerFlare()
->registerLogRecorder()
->registerDumpCollector();

if (config('flare.reporting.report_logs')) {
$this->registerLogRecorder();
}

if (config('flare.reporting.report_queries')) {
$this->registerQueryRecorder();
}
Expand All @@ -131,6 +144,10 @@ protected function registerViewEngines()
});

$this->app->make('view.engine.resolver')->register('blade', function () {
if (class_exists(\Livewire\CompilerEngineForIgnition::class)) {
return new \Livewire\CompilerEngineForIgnition($this->app['blade.compiler']);
}

return new CompilerEngine($this->app['blade.compiler']);
});

Expand Down Expand Up @@ -275,13 +292,14 @@ protected function getLogLevel(string $logLevelString): int
return $logLevel;
}

protected function registerLogRecorder()
protected function registerLogRecorder(): self
{
$logCollector = $this->app->make(LogRecorder::class);

$this->app->singleton(LogRecorder::class);

$this->app->instance(LogRecorder::class, $logCollector);
$this->app->singleton(LogRecorder::class, function (Application $app): LogRecorder {
return new LogRecorder(
$app,
$app->get('config')->get('flare.reporting.maximum_number_of_collected_logs')
);
});

return $this;
}
Expand Down Expand Up @@ -315,37 +333,45 @@ protected function registerCommands()
return $this;
}

protected function registerQueryRecorder()
protected function registerQueryRecorder(): self
{
$queryCollector = $this->app->make(QueryRecorder::class);

$this->app->singleton(QueryRecorder::class);

$this->app->instance(QueryRecorder::class, $queryCollector);
$this->app->singleton(QueryRecorder::class, function (Application $app): QueryRecorder {
return new QueryRecorder(
$app,
$app->get('config')->get('flare.reporting.report_query_bindings'),
$app->get('config')->get('flare.reporting.maximum_number_of_collected_queries')
);
});

return $this;
}

protected function registerBuiltInMiddleware()
{
$middleware = collect([
$middlewares = [
SetNotifierName::class,
AddEnvironmentInformation::class,
AddLogs::class,
AddDumps::class,
AddQueries::class,
AddSolutions::class,
])
->map(function (string $middlewareClass) {
return $this->app->make($middlewareClass);
});
];

if (config('flare.reporting.collect_git_information')) {
$middleware[] = (new AddGitInformation());
if (config('flare.reporting.report_logs')) {
$middlewares[] = AddLogs::class;
}

if (! is_null(config('flare.reporting.grouping_type'))) {
$middleware[] = new CustomizeGrouping(config('flare.reporting.grouping_type'));
$middlewares[] = AddDumps::class;

if (config('flare.reporting.report_queries')) {
$middlewares[] = AddQueries::class;
}

$middlewares[] = AddSolutions::class;

$middleware = collect($middlewares)
->map(function (string $middlewareClass) {
return $this->app->make($middlewareClass);
});

if (config('flare.reporting.collect_git_information')) {
$middleware[] = (new AddGitInformation());
}

foreach ($middleware as $singleMiddleware) {
Expand Down Expand Up @@ -432,12 +458,14 @@ protected function setupQueue(QueueManager $queue)
$queue->looping(function () {
$this->app->get(Flare::class)->reset();

if (config('flare.reporting.report_logs')) {
$this->app->make(LogRecorder::class)->reset();
}

if (config('flare.reporting.report_queries')) {
$this->app->make(QueryRecorder::class)->reset();
}

$this->app->make(LogRecorder::class)->reset();

$this->app->make(DumpRecorder::class)->reset();
});
}
Expand Down