I have defined the 2 variables, in contact and shirts. As you can see they are also in the li in header. Still i get the message that both of the variables are undefined.
I get this error message:
( ! ) SCREAM: Error suppression ignored for ( ! )
Notice: Undefined variable: section in
C:\wamp\www\Test\shirts4mike\inc\header.php on line 17
Call Stack #TimeMemoryFunctionLocation 10.0003243592{main}(
)..\index.php:0
20.0006246920 include( 'C:\wamp\www\Test\shirts4mike\inc\header.php' )..\index.php:3 ">
and the same for line 18.
shirts.php:
<?php
$pageTitle = "Mike's Full Catalog of Shirts";
$section = "shirts";
include('inc/header.php'); ?>
<div class="section page">
<h1>Mikes’s Full Catalog of Shirts</h1>
</div>
<?php include ('inc/footer.php'); ?>
contact.php:
<?php
$pageTitle = "Contact Mike";
$section = "contact";
include('inc/header.php'); ?>
<div class="section page">
<h1>Contact</h1>
</div>
<?php include ('inc/footer.php'); ?>
header.php:
<html>
<head>
<title> <?php echo $pageTitle ?></title>
<link rel="stylesheet" href="css/style.css" type="text/css">
<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Oswald:400,700" type="text/css">
<link rel="shortcut icon" href="favicon.ico">
</head>
<body>
<div class="header">
<div class="wrapper">
<h1 class="branding-title">Shirts 4 Mike</h1>
<ul class="nav">
<li class="shirts <?php if ($section == "shirts"){ echo "on"; } ?>">Shirts</li>
<li class="contact <?php if ($section == "contact"){ echo "on"; } ?>">Contact</li>
<li class="cart">Shopping Cart</li>
</ul>
</div>
</div>
<div id="content">
When you see SCREAM in a PHP error message like this, it is due to the following circumstances:
You have PHP's xDebug extension installed.
xDebug is configured to prevent error supression.
Your PHP code is attempting to suppress an error message using the # symbol or other error suppression mechanisms, and xDebug is overriding this.
xDebug is a PHP extension designed to help with debugging PHP programs. It should generally not be installed on a production system; only on a development system.
xDebug has a setting called "Scream" which is designed to prevent errors being suppressed. This is again intended for use in a development system. The developer may want errors to be supressed under normal circumstances, but while debugging it is useful to see those errors. So the scream setting overrides all of PHP's normal ways of hiding error messages. This is useful for debugging, but is a terrible thing to have on a production system.
xDebug should never be installed on a public facing production server, so if that describes your system you should remove it, or ask for it to be removed. This could be as simple as modifying the PHP.ini file to remove the references to xDebug (although that will just disable the extension rather than un-installing it).
If it is installed and you can't do anything about it, then you need to find a better web host that doesn't install development tools on production systems.
Having said all of that, if you're getting the message that $section is undefined, then it does imply a bug in the code that needs to be fixed.
The error is occurring in header.php, when it is included from index.php.
You've shown us shirts.php and contact.php, both of which set $section correctly. You haven't shown us index.php, but I would guess that it includes header.php in the same way as the others, but doesn't set $section like the others do.
You can therefore fix the bug by editing index.php so that it sets $section in the same way a the other pages do. Even if it just sets it to a blank string, that will be enough to fix the bug.
I hope that helps.
You're looking at the wrong files
The stack trace indicates that two files were included to get to this particular error (in reverse order):
inc\header.php
index.php
In the question, index.php isn't shown - but it is most likely that you have:
<?php
$pageTitle = "something";
include('inc/header.php');
i.e. the variables that are missing are not declared before they are used in the code that you are executing.
SCREAM
scream is an extension which makes it ignore use of the # operator - i.e. somewhere in the code that is being executed, it is being used, it's generally held as bad practice to ignore errors. You can however turn scream off - which is appropriate for a production/live app, though of course the errors/warnings/notices should be addressed.
Related
I just installed Visual Studio 2019 (v16.4.3, immediately updated to 16.4.4). I have VS2017 on my system, but no prior versions of VS2019.
I created a new Blazor app project. It automatically created Index, Counter, and other pages. It created it as a .NET Core 3.1 app (as 3.1 is now installed automatically with VS2019 v16.4 and later, apparently).
I am literally following this "Get started" page:
https://learn.microsoft.com/en-us/aspnet/core/blazor/get-started?view=aspnetcore-3.1&tabs=visual-studio
I run the app with no changes from what was generated. Clicking the button on the Counter page does nothing. I don't see any messages in the Debug Output window that have any relations.
I did some searches and found reports of similar issues but the solutions don't seem to apply.
Any idea what is wrong? (it is SO annoying when a freshly generated, unmodified project does not work!)
The code for the Counter page was generated as:
#page "/counter"
<h1>Counter</h1>
<p>Current count: #currentCount</p>
<button class="btn btn-primary" #onclick="IncrementCount">Click me</button>
#code {
private int currentCount = 0;
private void IncrementCount()
{
currentCount++;
}
}
_Host.cshtml is:
#page "/"
#namespace ToDoList.Pages
#addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
#{
Layout = null;
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>ToDoList</title>
<base href="~/" />
<link rel="stylesheet" href="css/bootstrap/bootstrap.min.css" />
<link href="css/site.css" rel="stylesheet" />
</head>
<body>
<app>
<component type="typeof(App)" render-mode="ServerPrerendered" />
</app>
<div id="blazor-error-ui">
<environment include="Staging,Production">
An error has occurred. This application may no longer respond until reloaded.
</environment>
<environment include="Development">
An unhandled exception has occurred. See browser dev tools for details.
</environment>
Reload
<a class="dismiss">🗙</a>
</div>
<script src="_framework/blazor.server.js"></script>
</body>
</html>
Update:
Per comment suggestions:
I rebooted my computer
Went straight into VS2019 and created a New Project. Selected Blazor App. Accepted all defaults. So, ended up with a project named BlazorApp1.
Hit F5 to start it up. Same results. Clicking the 'Click me' button the Counter does not do anything.
Entire contents of BlazorApp1.csproj:
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
</PropertyGroup>
</Project>
Note that the Get Started link I am following specifically says to use .NET Core 3.1 (vs 2.1). It says to OPTIONALLY update to the 3.2 preview, but that's only needed if I want to do a Blazor WebAssembly (which I don't). I prefer to only have released code on my system, so I don't want to updated to 3.2 Preview for something that is supposed to work with 3.1.
VS2019 defaulted to launching the app in Internet Explorer.
I changed it to launch it in Edge. It works in Edge.
Final update:
I got it to work in IE11. To do so:
I downloaded the Daddoon Blazor Polyfill package from here:
https://github.com/Daddoon/Blazor.Polyfill
From the downloaded zip, I copied Publish\Blazor.Polyfill.Publish\blazor.polyfill.min.js to a subfolder that I created, named "js", under the wwwroot subfolder in my project folder. I.e. in ToDoList\wwwroot, I created a subfolder named 'js' and then copied the blazor.polyfill.min.js file into that subfolder.
Then, I edited the file _Host.cshtml. I added the first line here (in front of the second line, which was already there, generated by VS and the Blazor Server template):
<script src="js/blazor.polyfill.min.js"></script>
<script src="_framework/blazor.server.js"></script>
I found a bunch of things that said "use Polyfills", but I couldn't find anything that said "here is how you actually do that." So, hopefully this helps someone else. Also, if I did something in a way that is suboptimal, hopefully someone will see this and tell me how to do it in a better way.
I had the same problem
To solve it, go to your project's Properties >> Debug >> uncheck Enable SSL. Then run your project by clicking e.g. IIS Express.
I think i have already read all the related questions here, but sadly i couldn't find an answer yet.
My problem is, locally everything runs fine without errors but when i deploy my website to my server, i'm getting there the following error:
The following sections have been defined but have not been rendered for the layout page >"~/Views/Shared/_Layout.cshtml": "styles"
I'm using Asp.Net MVC 4 with the Razor engine and .Net 4.5.
In _Layout.cshtml i have the following block defined:
<head>
....
#Styles.Render("~/Content/Css")
#Scripts.Render("~/bundles/modernizr")
#RenderSection("styles", required: false)
</head>
And in Index.cshtml the following block:
#section styles{
<link rel="stylesheet" href=... />
#Scripts.Render("~/bundles/js/somejs")
}
This is driving me crazy. If this error would also occur on my development machine, i could debug it. But it only happens on my server, locally everything runs fine.
Even other projects with similar code pieces run fine on my server.
Maybe someone has any hints for me?
I suspect that the contents of the _Layout.cshtml or Index.cshtml on your server is not what you think it is. Maybe the deployed version is different than what you have locally. Deployment went wrong?
I'm using apache-solr from bitnami I downloaded a week ago. Everything is going fine about indexing and searching, but I can't execute jsp files.
When I try to open main.jsp, the file isn't executed, the browser only shows the codes I wrote on main.jsp. Here's the codes on main.jsp I got from a tutorial website:
<html>
<head>
<title>Using GET and POST Method to Read Form Data</title>
</head>
<body>
<center>
<h1>Using GET Method to Read Form Data</h1>
<ul>
<li><p><b>First Name:</b>
<%= request.getParameter("first_name")%>
</p></li>
<li><p><b>Last Name:</b>
<%= request.getParameter("last_name")%>
</p></li>
</ul>
</body>
</html>
And then, when I try to open /solr/admin/stats.jsp, it says:
>HTTP ERROR 500
>
>Problem accessing /solr/admin/stats.jsp. Reason:
>
> JSP support not configured
>
>Powered by Jetty://
So, then I tried to configure the JSP support by typing:
>$ java -jar jetty.jar OPTIONS=Server,jsp
in Cygwin. But it says:
>Error: Unable to access jarfile jetty.jar
I've tried to add this snippet in jetty.xml:
<Call class="java.lang.System" name="setProperty">
<Arg>org.apache.jasper.compiler.disablejsr199</Arg>
<Arg>true</Arg>
</Call>
And after restarting the apache and solr, it doesn't resolving my problem, either. I want to try adding this snippet to start.ini:
>-Dorg.apache.jasper.compiler.disablejsr199=true
But, I can't find start.ini.
Please help me.
I have a problem. I had a app on the manifest v1.
But now it tells me to change it to v2. But it gives me an error like:
Refused to execute inline script because it violates the following
Content Security Policy directive: "script-src 'self'
chrome-extension-resource:".
I tried to change in the manifest:
"web_accessible_resources": [
"jquery-1.7.1.min.js",
"plugin.js"
]
But in the html code, I have:
<script type="text/javascript" src="jquery-1.7.1.min.js"></script>
<script src="plugin.js"></script>
How do I put it now? Should I delete that? If i delete it won't run! My popup doesn't even opens anymore :|
Hope you understood my problem, thanks
(I'll thank more if someone gave an example of API v2 using javaScript to download :) )
This error usually means that there is some script being executed directly inside your HTML page, not included via an external javascript file.
For example:
<script type="text/javascript">alert('hello');</script> embedded inside your html file is an inline script. The correct way to do it would be
<script type="text/javascript" src="hello.js"></script> .
Your file hello.js would include alert('hello');
I hope this helps.
I am currently using ReSharper build 6.0.2202.688 and have come across a very strange issue. When I hit the "Enter" key to add a line break from within a Script tag, ReSharper is automatically adding the line "foo foo".
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<script src="senchatouch.2/sencha-touch-all-debug.js" type="text/javascript"></script>
<link href="senchatouch.2/resources/css/sencha-touch.css" rel="stylesheet" type="text/css" />
</head>
<body>
<script type="text/javascript">
foo foo
foo foo
foo foo
foo foo
foo foo
foo foo
foo foo
foo foo
});</script>
</body>
</html>
I tried to find this in the LiveTemplates but dont see any that would apply.
I did not see any ReSharper configuring that would cause this issue either. Also, it just randomly started happening as I was going through some Sencha Touch tutorials.
Any idea what would cause this?
Thanks
Please install the latest ReSharper 6.1.1
This bug was fixed since the release of version 6.0 that you're currently using.
I also had this problem and upgraded to ReSharper 6.1.1. However, it didn't fix it. In fact, according to the YouTrack page for this bug, it wasn't fixed until version 7.0.43.13
http://youtrack.jetbrains.com/issue/RSRP-291030
It was happening to me in 7.0.1 (7.0.1098.2760)
I've found the fault to be within a malformed script block whereby a server-side script block was embedded inside a client-side one. e.g.
<script type="text/javascript" language="javascript">
<script runat="server" language="C#">
string ServerString = "this breaks things";
</script>
var clientString="<%=ServerString() %>";
</script>
<script type="text/javascript" language="javascript">
// try typing something here and hitting enter for "foo"
</script>
The fix for me was to move the nested server side script block outside of the client side script block.
Note: Blame removal - this wasn't my code! I was getting random foo inserted into my code and wanted it to stop!
I've opened a new support ticket with JetBrains as it seems odd to want to insert "foo" and delete other characters from source, even if I have malformed html/script.