block8 / b8framework Goto Github PK
View Code? Open in Web Editor NEWA lightweight, simple framework for high-throughput PHP applications
A lightweight, simple framework for high-throughput PHP applications
Thank you for good job, but can you add more instructions to wiki, for example, how to start with framework
This is an issue affecting usage of PHPCI, using the recommended virtual host settings for nginx, but the bug is in b8framework code so I thought I'd post the issue here.
When a URL contains a question mark on nginx, the method b8\Http\Request::getRequestPath
strips the entire request path, meaning the framework can't resolve the URL to a controller. The issue appears to be with how the SCRIPT_NAME is stripped from the path:
if ($_SERVER['SCRIPT_NAME'] != $_SERVER['REQUEST_URI']) {
$scriptPath = str_replace('/index.php', '', $_SERVER['SCRIPT_NAME']);
$path = str_replace($scriptPath, '', $path);
}
On nginx, the values for these parameters would look something like the following:
["SCRIPT_NAME"]=>
string(25) "/settings/github_callback"
["REQUEST_URI"]=>
string(51) "/settings/github_callback?code=etc"
When the framework strips the SCRIPT_NAME it strips everything but the query string.
This breaks the display of checkboxes in Bootstrap 3.2 (or lower?) sites. Ideally the checkbox class will be provided when creating the form control in the controller and not be forced upon you.
e.g. with a table 'case':
$ php Generate.php
PHP Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'case' at line 1' in /var/www/site.dev/vendor/block8/b8framework/b8/Database/Map.php:52
Stack trace:
#0 /var/www/site.dev/vendor/block8/b8framework/b8/Database/Map.php(52): PDO->query('SHOW CREATE TAB...')
#1 /var/www/site.dev/vendor/block8/b8framework/b8/Database/Map.php(27): b8\Database\Map->_getRelationships()
#2 /var/www/site.dev/vendor/block8/b8framework/b8/Database/CodeGenerator.php(22): b8\Database\Map->generate()
#3 /var/www/site.dev/Generate.php(4): b8\Database\CodeGenerator->__construct(Object(b8\Database), 'site', '/var/www/site....', true)
#4 {main}
thrown in /var/www/site.dev/vendor/block8/b8framework/b8/Database/Map.php on line 52
Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'case' at line 1' in /var/www/site.dev/vendor/block8/b8framework/b8/Database/Map.php on line 52
PDOException: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'case' at line 1 in /var/www/site.dev/vendor/block8/b8framework/b8/Database/Map.php on line 52
Call Stack:
0.0005 223944 1. {main}() /var/www/site.dev/Generate.php:0
0.0208 422360 2. b8\Database\CodeGenerator->__construct() /var/www/site.dev/Generate.php:4
0.0239 488320 3. b8\Database\Map->generate() /var/www/site.dev/vendor/block8/b8framework/b8/Database/CodeGenerator.php:22
0.0242 501600 4. b8\Database\Map->_getRelationships() /var/www/site.dev/vendor/block8/b8framework/b8/Database/Map.php:27
0.0243 501816 5. PDO->query() /var/www/site.dev/vendor/block8/b8framework/b8/Database/Map.php:52
Direct access to superglobals isn't allowed in HHVM. In order to make the b8framework run on HHVM, the request parameters need to be accessed with the filter_input function function. Correct me if I'm wrong, but isn't this a better approach to getting request parameters anyway? I thought superglobals were deprecated in practice. As always I'm willing to try and make this work and submit a PR.
Currently, the framework does not record the host that the database connection is established to:
https://github.com/Block8/b8framework/blob/master/b8/Database.php#L126
and as a result, you cannot retrieve this information later. PHPCI, for example, needs to know which host it is connected to in order to pass that information to the MySQL plugin. This is also causing PHPCI itself to fail, since PHPCI_DB_HOST
is no longer defined:
The challenge is that the read
and write
servers may be different, so you would need to store these hosts separately or find a way to extract it from PDO itself. I imagine PDO also does not store this information since it does not make sense in the case of UNIX sockets, SQLite, etc.
Because "b8" missing when calling database's params :
In block8/b8framework/b8/Database.php, l.54 you have :
$settings = $config->get('database', array());
And $settings = $config->get('b8.database', array()); should be search according your last installCommand which write $conf['b8']['database']...
Missing func.:
Email validation
isUnique - check db if value exists
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.