- 1
- 2
Trying to get property '%s' of non-object: Notice -> Warning
Undefined property: %s::$%s Notice -> Warning
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
0
Trying to get property '%s' of non-object: Notice -> Warning
Undefined property: %s::$%s Notice -> Warning
тут брейкинг ченджес подвезли
https://wiki.php.net/rfc/engine_warnings
+2
public function getFlagCode()
{
$code = $this->_storeManager->getStore()->getCode();
switch ($code) {
case 'us':
return 'us';
break;
case 'eu':
return 'eu';
break;
default;
return 'ww';
}
}
+1
catch (Exception &exception)
{
Application->ShowException(&exception);
}
catch (...)
{
try
{
throw Exception("");
}
catch (Exception &exception)
{
Application->ShowException(&exception);
}
}
https://github.com/greatis/Anti-WebMiner/blob/master/AntiWebMiner.cpp#L23
+3
foreach ($files as $n => $f) {
$new_content = $common.$namespace_begin.$f.$namespace_end;
$std_methods = array();
preg_match_all('/std::[a-z_0-9]*/', $new_content, $std_methods);
$std_methods = array_unique($std_methods[0]);
$needed_std_headers = array();
$type_headers = array(
'std::move' => '',
'std::vector' => '',
'std::string' => '',
// [...]
'std::unordered_set' => 'unordered_set');
foreach ($type_headers as $type => $header) {
if (in_array($type, $std_methods)) {
$std_methods = array_diff($std_methods, array($type));
if ($header && !in_array($header, $needed_std_headers)) {
$needed_std_headers[] = $header;
}
}
}
if (!$std_methods) { // know all needed std headers
$new_content = preg_replace_callback(
'/#include <([a-z_]*)>/',
function ($matches) use ($needed_std_headers) {
if (in_array($matches[1], $needed_std_headers)) {
return $matches[0];
}
return '';
},
$new_content
);
}
Тут вот в https://govnokod.ru/20049 CHayT предлагал использовать «PHP» в качестве препроцессора для «C» — так вот в «Телеграме» совет оценили и решили взять на вооружение.
https://github.com/tdlib/td/blob/master/SplitSource.php
+1
https://docs.python.org/3.9/whatsnew/3.9.html#optimizations
См 38 -- > 3.9
0
try {
throw new SQLException();
} catch (SQLException e) {
logger.error("error while updating "
+ e.getMessage());
}
нет слов
+1
#include <vector>
#include <cwchar>
#include <algorithm>
#include <iostream>
int main()
{
std::vector<const wchar_t*> leaders{L"Ленин", L"Сталин", L"Маленков",
L"Хрущёв", L"Брежнев", L"Андропов", L"Черненко", L"Горбачёв"};
std::sort(leaders.begin(), leaders.end(), [](auto strA, auto strB) {
return std::wcscmp(strA, strB) < 0;
});
std::setlocale(LC_ALL, "en_US.utf8");
std::wcout.imbue(std::locale("en_US.utf8"));
for (auto leader : leaders)
std::wcout << leader << '\n';
}
Отсюда:
https://en.cppreference.com/w/cpp/string/wide/wcscmp
+6
#define add(x, y) &((void*)x)[y];
#define mul(x, y) (sizeof (char[x][y]))
из свитера
0
foreach ($properties->xml->ЗначенияСвойства as $property) {
//......
}
$properties->xml->ЗначенияСвойства
+3
# Alternative mysql_real_escape_string without mysql connection
function escape_string($param) {
if(is_array($param))
return array_map(__METHOD__, $param);
if(!empty($param) && is_string($param)) {
return str_replace(array('\\', "\0", "\n", "\r", "'", '"', "\x1a"), array('\\\\', '\\0', '\\n', '\\r', "\\'", '\\"', '\\Z'), $param);
}
return $param;
}
#Using example
$name = @trim(escape_string(stripslashes($_POST['name'])));
https://gist.github.com/wilnaweb/ca37459bdf92aa74bd2dd7994fa5b0df