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

doctrine:database:create use Oracle database get Notice. #3296

Closed
lcp0578 opened this issue Sep 22, 2018 · 6 comments
Closed

doctrine:database:create use Oracle database get Notice. #3296

lcp0578 opened this issue Sep 22, 2018 · 6 comments

Comments

@lcp0578
Copy link

lcp0578 commented Sep 22, 2018

Bug Report

Q A
BC Break yes
Version 2.5.13

Summary

Current behaviour

php7 bin/console doctrine:database:create --connection=oracle -v

In AbstractOracleDriver.php line 121:

  [Symfony\Component\Debug\Exception\ContextErrorException]
  Notice: Undefined index: dbname


Exception trace:
 Doctrine\DBAL\Driver\AbstractOracleDriver->getEasyConnectString() at /Users/lcp0578/htdocs/sxjicheng/water_datacenter/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/OCI8/Driver.php:61
 Doctrine\DBAL\Driver\OCI8\Driver->_constructDsn() at /Users/lcp0578/htdocs/sxjicheng/water_datacenter/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/OCI8/Driver.php:42
 Doctrine\DBAL\Driver\OCI8\Driver->connect() at /Users/lcp0578/htdocs/sxjicheng/water_datacenter/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php:360
 Doctrine\DBAL\Connection->connect() at /Users/lcp0578/htdocs/sxjicheng/water_datacenter/vendor/doctrine/doctrine-bundle/Command/CreateDatabaseDoctrineCommand.php:84
 Doctrine\Bundle\DoctrineBundle\Command\CreateDatabaseDoctrineCommand->execute() at /Users/lcp0578/htdocs/sxjicheng/water_datacenter/vendor/symfony/symfony/src/Symfony/Component/Console/Command/Command.php:252
 Symfony\Component\Console\Command\Command->run() at /Users/lcp0578/htdocs/sxjicheng/water_datacenter/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:964
 Symfony\Component\Console\Application->doRunCommand() at /Users/lcp0578/htdocs/sxjicheng/water_datacenter/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Console/Application.php:86
 Symfony\Bundle\FrameworkBundle\Console\Application->doRunCommand() at /Users/lcp0578/htdocs/sxjicheng/water_datacenter/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:248
 Symfony\Component\Console\Application->doRun() at /Users/lcp0578/htdocs/sxjicheng/water_datacenter/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Console/Application.php:74
 Symfony\Bundle\FrameworkBundle\Console\Application->doRun() at /Users/lcp0578/htdocs/sxjicheng/water_datacenter/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:148
 Symfony\Component\Console\Application->run() at /Users/lcp0578/htdocs/sxjicheng/water_datacenter/bin/console:27

doctrine:database:create [--shard SHARD] [--connection [CONNECTION]] [--if-not-exists] [-h|--help] [-q|--quiet] [-v|vv|vvv|--verbose] [-V|--version] [--ansi] [--no-ansi] [-n|--no-interaction] [-e|--env ENV] [--no-debug] [--] <command>

doctrine config:

# config.yml
# Doctrine Configuration
doctrine:
    dbal:
        default_connection: default
        connections:
            default:
                driver: pdo_mysql
                host: '%database_host%'
                port: '%database_port%'
                dbname: '%database_name%'
                user: '%database_user%'
                password: '%database_password%'
                charset: UTF8
            oracle:
                driver: oci8
                host: '%database_oracle_host%'
                port: '%database_oracle_port%'
                dbname: '%database_oracle_name%'
                user: '%database_oracle_user%'
                password: '%database_oracle_password%'
                servicename: '%database_oracle_servicename%'
                charset: AL32UTF8
#paramters.yml
parameters:
    database_host: 127.0.0.1
    database_port: null
    database_name: water_datacenter
    database_user: root
    database_password: lcp0578
    database_oracle_host: 127.0.0.1
    database_oracle_port: 1521
    database_oracle_name: water_datacenter
    database_oracle_user: sys
    database_oracle_password: lcp0578
    database_oracle_servicename: orclcdb
    mailer_transport: smtp
    mailer_host: 127.0.0.1
    mailer_user: null
    mailer_password: null
    secret: ThisTokenIsNotSoSecretChangeIt
composer7 show -i doctrine/dbal
You are using the deprecated option "installed". Only installed packages are shown by default now. The --all option can be used to show all packages.
name     : doctrine/dbal
descrip. : Database Abstraction Layer
keywords : database, dbal, persistence, queryobject
versions : * v2.5.13
type     : library
license  : MIT License (MIT) (OSI approved) https://spdx.org/licenses/MIT.html#licenseText
source   : [git] https://github.com/doctrine/dbal.git 729340d8d1eec8f01bff708e12e449a3415af873
dist     : [zip] https://api.github.com/repos/doctrine/dbal/zipball/729340d8d1eec8f01bff708e12e449a3415af873 729340d8d1eec8f01bff708e12e449a3415af873
names    : doctrine/dbal

autoload
psr-0
Doctrine\DBAL\ => lib/

requires
doctrine/common >=2.4,<2.8-dev
php >=5.3.2

requires (dev)
phpunit/phpunit 4.*
symfony/console 2.*||^3.0

suggests
symfony/console For helpful console commands such as SQL execution and import of files.
@morozov
Copy link
Member

morozov commented Sep 22, 2018

The issue can be reproduced with v2.8.0 as following:

$conn = \Doctrine\DBAL\DriverManager::getConnection([
    'driver' => 'oci8',
    'host' => 'localhost',
    'user' => 'system',
    'password' => 'oracle',
]);

var_dump(
    $conn->fetchColumn('SELECT * FROM dual')
);

The connection gets established successfully, but it triggers the notice:

Notice: Undefined index: dbname in lib/Doctrine/DBAL/Driver/AbstractOracleDriver.php on line 125

Call Stack:
    0.0001     397208   1. {main}() test.php:0
    0.0079     991840   2. Doctrine\DBAL\Connection->fetchColumn() test.php:36
    0.0079     991840   3. Doctrine\DBAL\Connection->executeQuery() lib/Doctrine/DBAL/Connection.php:610
    0.0079     991840   4. Doctrine\DBAL\Connection->connect() lib/Doctrine/DBAL/Connection.php:921
    0.0079     991840   5. Doctrine\DBAL\Driver\OCI8\Driver->connect() lib/Doctrine/DBAL/Connection.php:389
    0.0083    1012120   6. Doctrine\DBAL\Driver\OCI8\Driver->_constructDsn() lib/Doctrine/DBAL/Driver/OCI8/Driver.php:43
    0.0083    1012120   7. Doctrine\DBAL\Driver\OCI8\Driver->getEasyConnectString() lib/Doctrine/DBAL/Driver/OCI8/Driver.php:62

string(1) "X"

@morozov
Copy link
Member

morozov commented Sep 22, 2018

@lcp0578 why did you mark it a BC break?

@lcp0578
Copy link
Author

lcp0578 commented Sep 23, 2018

@morozov Oh,it it a bug, not BC break.

@morozov
Copy link
Member

morozov commented Sep 26, 2018

Fixed via #3297.

@morozov morozov closed this as completed Sep 26, 2018
@morozov morozov added this to the 2.9.0 milestone Sep 26, 2018
@lcp0578
Copy link
Author

lcp0578 commented Sep 27, 2018

@morozov great job.

@morozov morozov modified the milestones: 2.9.0, 2.8.1 Dec 2, 2018
@github-actions
Copy link

github-actions bot commented Aug 1, 2022

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 1, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants